ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/Makefile.PL
(Generate patch)

Comparing Coro/Coro/Makefile.PL (file contents):
Revision 1.20 by root, Mon Feb 18 21:25:01 2002 UTC vs.
Revision 1.28 by root, Tue Aug 10 01:56:30 2004 UTC

13if ($^O =~ /win32/i or $^O =~ /cygwin/) { 13if ($^O =~ /win32/i or $^O =~ /cygwin/) {
14 $DEFINE = " -DCORO_LOOSE"; 14 $DEFINE = " -DCORO_LOOSE";
15} elsif ($^O =~ /irix/) { 15} elsif ($^O =~ /irix/) {
16 $iface = "i"; 16 $iface = "i";
17} elsif ($^O =~ /linux/) { 17} elsif ($^O =~ /linux/) {
18 # default to setjmp/longjmp on non-x86...
19 $iface = $Config{archname} =~ /^i[3456]86-/ ? "l" : "s";
20} elsif ($^O =~ /(free|net|open)bsd/) {
21 # FreeBSD 4.x has ucontext.h but no makecontext et al (see BUGS section of
22 # man context). Assume the same problem for all other BSDs.
18 $iface = "l"; 23 $iface = "s";
19} elsif ($^O =~ /solaris/) { 24} elsif ($^O =~ /solaris/) {
25 $iface = "s";
26} elsif ($^O =~ /darwin/) {
20 $iface = "s"; 27 $iface = "s";
21} elsif (-e "/usr/include/ucontext.h") { 28} elsif (-e "/usr/include/ucontext.h") {
22 $iface = "u"; 29 $iface = "u";
23} else { 30} else {
24 $iface = "s"; 31 $iface = "s";
25} 32}
26 33
27print <<EOF; 34print <<EOF;
28 35
29Version 0.12 introduced experimental C context sharing. This makes it 36Version 0.12 introduced C context sharing. This makes it possible to share
30possible to share the C stack and context between many coroutines, 37the C stack and context between many coroutines, resulting in memory
31resulting in memory savings and slight speed gains, at the cost of 38savings and slight speed gains, at the cost of potential (but mostly
32potential segfaults (especially with exception handling). On my Linux/x86 39theoretical) segfaults. On my Linux/x86 machine this decreased the size
33machine this decreased the size of a new coroutine from 9k to 5k, the 40of a new coroutine from 9k to 5k, but the savings are much more apparent
34savings are much more apparent on machines without mmap or good memory 41on machines without mmap or good memory management. This algorithm relies
35management. This algorithm relies on the non-fact that the same machine 42on the non-fact that the same machine stack pointer indicates the same
36stack pointer indicates the same function call nesting level, which 43function call nesting level, which usually works good enough but might
37usually works good enough but might fail... 44fail...
38 45
39The default (disabled) is safe, as it only increases memory consumption. 46The default (enabled) has been in-use on productions servers for some time
47now, without any problem reports so far.
40 48
41EOF 49EOF
42 50
43print "Do you want to enable experimental context sharing (y/n) [n]? "; 51if (prompt ("Do you want to enable C context sharing (y/n)", "y") !~ /^\s*n/i) {
44
45if (<> =~ /^\s*y/i) {
46 print "\nExperimental context sharing enabled.\n\n"; 52 print "\nExperimental context sharing enabled.\n\n";
47 $DEFINE .= " -DCORO_LAZY_STACK"; 53 $DEFINE .= " -DCORO_LAZY_STACK";
48} 54}
49 55
50if ($iface) { 56if ($iface) {
64 faster than with the ucontext functions). Unfortunately, glibc-2.1 and 70 faster than with the ucontext functions). Unfortunately, glibc-2.1 and
65 below don't even feature a working sigaltstack. 71 below don't even feature a working sigaltstack.
66 72
67l Older GNU/Linux systems (glibc-2.1 and below) need this hack. Since it is 73l Older GNU/Linux systems (glibc-2.1 and below) need this hack. Since it is
68 very linux-specific it is also quite fast for newer versions; when it 74 very linux-specific it is also quite fast for newer versions; when it
69 works, that is... 75 works, that is (currently x86 only)...
70 76
71i IRIX. For some reason, SGI really does not like to follow the unix 77i IRIX. For some reason, SGI really does not like to follow the unix
72 standard (does that surprise you?), so this workaround might be needed 78 standard (does that surprise you?), so this workaround might be needed
73 (it's fast), although s and u should also work now. 79 (it's fast), although s and u should also work now.
74 80
81For most systems, the default chosen should be OK. If you experience
82problems then you should experiment with this setting and/or turn off
83optimizations (make OPTIMIZE=-O0).
84
75EOF 85EOF
76 86
77retry: 87retry:
78 print "Use which implementation,\n",
79 "<s>etjmp/longjump, <u>context, <i>rix or <l>inux [$iface]? ";
80 88
81 my $r = <>; 89 my $r = prompt "Use which implementation,\n" .
90 "<s>etjmp/longjump, <u>context, <i>rix or <l>inux?",
91 $iface;
82 $iface = lc $1 if $r =~ /(\S)/; 92 $iface = lc $1 if $r =~ /(\S)/;
83 93
84 if ($iface eq "u") { 94 if ($iface eq "u") {
85 $DEFINE .= " -DCORO_UCONTEXT"; 95 $DEFINE .= " -DCORO_UCONTEXT";
86 print "\nUsing ucontext implementation\n\n"; 96 print "\nUsing ucontext implementation\n\n";
106WriteMakefile( 116WriteMakefile(
107 NAME => "Coro::State", 117 NAME => "Coro::State",
108 VERSION_FROM => "State.pm", 118 VERSION_FROM => "State.pm",
109 DEFINE => $DEFINE, 119 DEFINE => $DEFINE,
110 DIR => [], 120 DIR => [],
111 PM => {
112 'State.pm' => '$(INST_LIBDIR)/State.pm',
113
114 'MakeMaker.pm' => '$(INST_LIBDIR)/MakeMaker.pm',
115 'CoroAPI.h' => '$(INST_LIBDIR)/CoroAPI.h',
116
117 'Cont.pm' => '$(INST_LIBDIR)/Cont.pm',
118
119 'Specific.pm' => '$(INST_LIBDIR)/Specific.pm',
120
121 'Timer.pm' => '$(INST_LIBDIR)/Timer.pm',
122 'Signal.pm' => '$(INST_LIBDIR)/Signal.pm',
123 'Channel.pm' => '$(INST_LIBDIR)/Channel.pm',
124 'Semaphore.pm' => '$(INST_LIBDIR)/Semaphore.pm',
125 'SemaphoreSet.pm' => '$(INST_LIBDIR)/SemaphoreSet.pm',
126 'RWLock.pm' => '$(INST_LIBDIR)/RWLock.pm',
127 },
128); 121);
129 122
130sub conftest { 123sub conftest {
131 my $type = shift; 124 my $type = shift;
132 125
146 139
147 unlink "a.out"; 140 unlink "a.out";
148 unlink "conftestval"; 141 unlink "conftestval";
149} 142}
150 143
144print <<EOF if $^O =~ /linux/;
151 145
146*****************************************************************************
147* *
148* HEY!! You are using Linux! That's not at all bad, but if you get seg- *
149* faults with Coro almost all the time please refer to README.linux-glibc *
150* *
151*****************************************************************************
152
153EOF
154

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines