… | |
… | |
38 | POSIX optionally offers support for a monotonic clock source. EV |
38 | POSIX optionally offers support for a monotonic clock source. EV |
39 | can take advantage of this clock source to detect time jumps |
39 | can take advantage of this clock source to detect time jumps |
40 | reliably. Unfortunately, some systems are bound to be broken, so you can |
40 | reliably. Unfortunately, some systems are bound to be broken, so you can |
41 | disable this here: you can completely disable the detection and use of |
41 | disable this here: you can completely disable the detection and use of |
42 | the monotonic clock by answering 'n' here. Support for this clock type |
42 | the monotonic clock by answering 'n' here. Support for this clock type |
43 | will otherwise be autodetected at both compile- and runtime. |
43 | will otherwise be autodetected at both compile- and runtime. (this setting |
|
|
44 | currently affects the use of nanosleep over select as well). |
44 | |
45 | |
45 | EOF |
46 | EOF |
46 | |
47 | |
47 | $DEFINE .= " -DEV_USE_MONOTONIC=" . (0 + (prompt ("Enable optional support for CLOCK_MONOTONIC (y/n)?", "y") =~ /[yY]/)); |
48 | $DEFINE .= " -DEV_USE_MONOTONIC=" . (0 + (prompt ("Enable optional support for CLOCK_MONOTONIC (y/n)?", "y") =~ /[yY]/)); |
48 | |
49 | |
… | |
… | |
116 | print <<EOF; |
117 | print <<EOF; |
117 | |
118 | |
118 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
119 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
119 | |
120 | |
120 | |
121 | |
121 | EV by default uses select, which makes it hard to write efficient servers, |
122 | Select and poll make it hard to write efficient servers, especially if the |
122 | especially if the number of active connections is much lower than the open |
123 | number of active connections is much lower than the watched ones. GNU/Linux |
123 | ones. GNU/Linux systems have a more scalable method called "epoll", which |
124 | systems have a more scalable method called "epoll", which EV can use. For |
124 | EV can use. For this to work, both your kernel and glibc have to support |
125 | this to work, both your kernel and glibc have to support epoll, but if you |
125 | epoll, but if you can compile it, the detection will be done at runtime, |
126 | can compile it, the detection will be done at runtime, and EV will safely |
126 | and EV will safely fall back to using select when epoll isn't available. |
127 | fall back to using select when epoll isn't available. If unsure, accept |
127 | If unsure, accept the default. |
128 | the default. |
128 | |
129 | |
129 | EOF |
130 | EOF |
130 | |
131 | |
131 | $DEFINE .= " -DEV_USE_EPOLL=" . (0 + (prompt ("Enable epoll backend (y/n)?", (-e "/usr/include/sys/epoll.h") ? "y" : "n") =~ /[yY]/)); |
132 | $DEFINE .= " -DEV_USE_EPOLL=" . (0 + (prompt ("Enable epoll backend (y/n)?", (-e "/usr/include/sys/epoll.h") ? "y" : "n") =~ /[yY]/)); |
132 | |
133 | |
… | |
… | |
137 | |
138 | |
138 | Similarly to the epoll backend above, EV can take advantage of kqueue on |
139 | Similarly to the epoll backend above, EV can take advantage of kqueue on |
139 | many BSD systems. Support for kqueue will be detected at runtime, with a |
140 | many BSD systems. Support for kqueue will be detected at runtime, with a |
140 | safe fallback to other methods when it cannot be used. |
141 | safe fallback to other methods when it cannot be used. |
141 | |
142 | |
142 | Note that kqueue is broken on most operating systems, so it defaults to |
143 | Note that kqueue is broken on most operating systems, so by default it |
143 | 'n' on most platforms that claim to support it. Here is what we know: |
144 | won't be used on many platforms, but you can still create your own event |
|
|
145 | loop with qkueue backend. |
144 | |
146 | |
145 | OS X: completely, utterly broken on at least <= 10.5. |
147 | Here is what we know: |
|
|
148 | |
|
|
149 | NetBSD: partially working in at least 3.1. Yeah! :) |
146 | FreeBSD: broken on at least <= 6.2-STABLE, |
150 | FreeBSD: broken on at least 6.2-STABLE, |
147 | sockets and pipes *might* work, ptys definitely don't. |
151 | sockets *likely* work, ptys definitely don't. |
148 | NetBSD: reports indicate that it likely WORKS. Yeah! :) |
|
|
149 | OpenBSD: reports indicate that it likely doesn't work |
152 | OpenBSD: reports indicate that it likely doesn't work |
150 | (similar problems as on FreeBSD). |
153 | (similar problems as on FreeBSD). |
|
|
154 | OS X: completely, utterly broken on at least < 10.5. |
151 | |
155 | |
152 | EOF |
156 | EOF |
153 | |
157 | |
154 | my $can_kqueue = $^O =~ /netbsd/i && -e "/usr/include/sys/event.h"; |
158 | my $can_kqueue = -e "/usr/include/sys/event.h"; |
155 | |
159 | |
156 | $DEFINE .= " -DEV_USE_KQUEUE=" . (0 + (prompt ("Enable kqueue backend (y/n)?", $can_kqueue ? "y" : "n") =~ /[yY]/)); |
160 | $DEFINE .= " -DEV_USE_KQUEUE=" . (0 + (prompt ("Enable kqueue backend (y/n)?", $can_kqueue ? "y" : "n") =~ /[yY]/)); |
157 | |
161 | |
158 | print <<EOF; |
162 | print <<EOF; |
159 | |
163 | |
160 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
164 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
161 | |
165 | |
162 | |
166 | |
163 | Similarly to the kqueue backend above, EV can take advantage of the |
167 | Similarly to the kqueue backend above, EV can take advantage of the |
164 | solaris 10 port interface. Support for port will be detected at runtime, |
168 | solaris 10 event port interface. Support for event ports will be detected |
165 | with a safe fallback to other methods when it cannot be used. |
169 | at runtime, with a safe fallback to other methods when it cannot be used. |
166 | |
170 | |
167 | EOF |
171 | EOF |
168 | |
172 | |
169 | $DEFINE .= " -DEV_USE_PORT=" . (0 + (prompt ("Enable port backend (y/n)?", (-e "/usr/include/sys/port.h") ? "y" : "n") =~ /[yY]/)); |
173 | $DEFINE .= " -DEV_USE_PORT=" . (0 + (prompt ("Enable event port backend (y/n)?", (-e "/usr/include/sys/port.h") ? "y" : "n") =~ /[yY]/)); |
170 | |
174 | |
171 | print <<EOF; |
175 | print <<EOF; |
172 | |
176 | |
173 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
177 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
174 | |
178 | |
… | |
… | |
182 | |
186 | |
183 | $SOLARIS_LIBS = $^O =~ /solaris/ ? " -lsocket -lnsl" : ""; |
187 | $SOLARIS_LIBS = $^O =~ /solaris/ ? " -lsocket -lnsl" : ""; |
184 | |
188 | |
185 | $LIBS = prompt "Extra libraries for pthread_atfork and clock_gettime?", "-lpthread -lrt$SOLARIS_LIBS"; |
189 | $LIBS = prompt "Extra libraries for pthread_atfork and clock_gettime?", "-lpthread -lrt$SOLARIS_LIBS"; |
186 | |
190 | |
|
|
191 | |
|
|
192 | print <<EOF; |
|
|
193 | |
|
|
194 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
|
|
195 | |
|
|
196 | |
|
|
197 | A backend of a different kind is the Linux inotify(7) interface, which can |
|
|
198 | be used to speed up (and reduce resource consumption) of stat watchers. If |
|
|
199 | you have it, it is usually a good idea to enable it. |
|
|
200 | |
|
|
201 | EOF |
|
|
202 | |
|
|
203 | my $can_inotify = -e "/usr/include/sys/inotify.h"; |
|
|
204 | |
|
|
205 | $DEFINE .= " -DEV_USE_INOTIFY=" . (0 + (prompt ("Enable inotify support (y/n)?", $can_inotify ? "y" : "n") =~ /[yY]/)); |
187 | |
206 | |
188 | print <<EOF; |
207 | print <<EOF; |
189 | |
208 | |
190 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
209 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
191 | |
210 | |
… | |
… | |
201 | SUFFIX => '.gz', |
220 | SUFFIX => '.gz', |
202 | }, |
221 | }, |
203 | depend => { |
222 | depend => { |
204 | "EV.c" => "EV/EVAPI.h " |
223 | "EV.c" => "EV/EVAPI.h " |
205 | . "libev/ev.c libev/ev.h libev/ev_epoll.c libev/ev_select.c libev/ev_kqueue.c libev/ev_poll.c " |
224 | . "libev/ev.c libev/ev.h libev/ev_epoll.c libev/ev_select.c libev/ev_kqueue.c libev/ev_poll.c " |
206 | . "libev/event.h libev/event.c evdns.h evdns.c libev/ev_vars.h libev/ev_wrap.h", |
225 | . "libev/ev_vars.h libev/ev_wrap.h", |
207 | }, |
226 | }, |
208 | INC => "-Ilibev", |
227 | INC => "-Ilibev", |
209 | DEFINE => "$DEFINE", |
228 | DEFINE => "$DEFINE", |
210 | NAME => "EV", |
229 | NAME => "EV", |
211 | LIBS => [$LIBS], |
230 | LIBS => [$LIBS], |
… | |
… | |
213 | @anyevent, |
232 | @anyevent, |
214 | }, |
233 | }, |
215 | VERSION_FROM => "EV.pm", |
234 | VERSION_FROM => "EV.pm", |
216 | PM => { |
235 | PM => { |
217 | 'EV.pm' => '$(INST_LIBDIR)/EV.pm', |
236 | 'EV.pm' => '$(INST_LIBDIR)/EV.pm', |
218 | 'EV/DNS.pm' => '$(INST_LIBDIR)/EV/DNS.pm', |
|
|
219 | 'EV/EVAPI.h' => '$(INST_LIBDIR)/EV/EVAPI.h', |
237 | 'EV/EVAPI.h' => '$(INST_LIBDIR)/EV/EVAPI.h', |
220 | 'EV/MakeMaker.pm' => '$(INST_LIBDIR)/EV/MakeMaker.pm', |
238 | 'EV/MakeMaker.pm' => '$(INST_LIBDIR)/EV/MakeMaker.pm', |
221 | 'libev/ev.h' => '$(INST_LIBDIR)/EV/ev.h', |
239 | 'libev/ev.h' => '$(INST_LIBDIR)/EV/ev.h', |
222 | }, |
240 | }, |
223 | ); |
241 | ); |