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

Comparing EV/Makefile.PL (file contents):
Revision 1.22 by root, Sat Nov 17 01:41:33 2007 UTC vs.
Revision 1.37 by root, Thu Oct 30 04:01:46 2008 UTC

1use 5.006; 1use 5.006;
2 2
3use strict qw(vars subs);
3use Config; 4use Config;
4use ExtUtils::MakeMaker; 5use ExtUtils::MakeMaker;
5 6
6unless (-e "libev/ev_epoll.c") { 7unless (-e "libev/ev_epoll.c") {
7 print <<EOF; 8 print <<EOF;
38POSIX optionally offers support for a monotonic clock source. EV 39POSIX optionally offers support for a monotonic clock source. EV
39can take advantage of this clock source to detect time jumps 40can take advantage of this clock source to detect time jumps
40reliably. Unfortunately, some systems are bound to be broken, so you can 41reliably. Unfortunately, some systems are bound to be broken, so you can
41disable this here: you can completely disable the detection and use of 42disable this here: you can completely disable the detection and use of
42the monotonic clock by answering 'n' here. Support for this clock type 43the monotonic clock by answering 'n' here. Support for this clock type
43will otherwise be autodetected at both compile- and runtime. 44will otherwise be autodetected at both compile- and runtime. (this setting
45currently affects the use of nanosleep over select as well).
44 46
45EOF 47EOF
46 48
47$DEFINE .= " -DEV_USE_MONOTONIC=" . (0 + (prompt ("Enable optional support for CLOCK_MONOTONIC (y/n)?", "y") =~ /[yY]/)); 49my $DEFINE .= " -DEV_USE_MONOTONIC=" . (0 + (prompt ("Enable optional support for CLOCK_MONOTONIC (y/n)?", "y") =~ /[yY]/));
48 50
49print <<EOF; 51print <<EOF;
50 52
51*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 53*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
52 54
116print <<EOF; 118print <<EOF;
117 119
118*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 120*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
119 121
120 122
121EV by default uses select, which makes it hard to write efficient servers, 123Select and poll make it hard to write efficient servers, especially if the
122especially if the number of active connections is much lower than the open 124number of active connections is much lower than the watched ones. GNU/Linux
123ones. GNU/Linux systems have a more scalable method called "epoll", which 125systems have a more scalable method called "epoll", which EV can use. For
124EV can use. For this to work, both your kernel and glibc have to support 126this to work, both your kernel and glibc have to support epoll, but if you
125epoll, but if you can compile it, the detection will be done at runtime, 127can compile it, the detection will be done at runtime, and EV will safely
126and EV will safely fall back to using select when epoll isn't available. 128fall back to using select when epoll isn't available. If unsure, accept
127If unsure, accept the default. 129the default.
128 130
129EOF 131EOF
130 132
133my $can_epoll = -e "/usr/include/sys/epoll.h";
134$can_epoll = $ENV{EV_EPOLL} if exists $ENV{EV_EPOLL};
131$DEFINE .= " -DEV_USE_EPOLL=" . (0 + (prompt ("Enable epoll backend (y/n)?", (-e "/usr/include/sys/epoll.h") ? "y" : "n") =~ /[yY]/)); 135$DEFINE .= " -DEV_USE_EPOLL=" . (0 + (prompt ("Enable epoll backend (y/n)?", $can_epoll ? "y" : "n") =~ /[yY]/));
132 136
133print <<EOF; 137print <<EOF;
134 138
135*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 139*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
136 140
137 141
138Similarly to the epoll backend above, EV can take advantage of kqueue 142Similarly to the epoll backend above, EV can take advantage of kqueue on
139on many BSD systems (it seems to be broken on Mac OS X though, but what 143many BSD systems. Support for kqueue will be detected at runtime, with a
140isn't broken on that shoddy platform... ah yes, the cash gushing by apple, 144safe fallback to other methods when it cannot be used.
141selling defective software works perfectly there). Support for kqueue will
142be detected at runtime, with a safe fallback to other methods when it
143cannot be used.
144 145
145EOF 146Note that kqueue is broken on most operating systems, so by default it
147won't be used on many platforms, but you can still create your own event
148loop with kqueue backend.
146 149
150Here is what we know:
151
152NetBSD: partially working in at least 3.1. Yeah! :)
153FreeBSD: broken on at least 6.2-STABLE,
154 sockets *likely* work, ptys definitely don't.
155OpenBSD: reports indicate that it likely doesn't work
156 (similar problems as on FreeBSD).
157OS X: completely, utterly broken on at least < 10.5.
158
159EOF
160
161my $can_kqueue = -e "/usr/include/sys/event.h";
162$can_kqueue = $ENV{EV_KQUEUE} if exists $ENV{EV_KQUEUE};
147$DEFINE .= " -DEV_USE_KQUEUE=" . (0 + (prompt ("Enable kqueue backend (y/n)?", (-e "/usr/include/sys/event.h") ? "y" : "n") =~ /[yY]/)); 163$DEFINE .= " -DEV_USE_KQUEUE=" . (0 + (prompt ("Enable kqueue backend (y/n)?", $can_kqueue ? "y" : "n") =~ /[yY]/));
148 164
149print <<EOF; 165print <<EOF;
150 166
151*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 167*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
152 168
153 169
154Similarly to the kqueue backend above, EV can take advantage of the 170Similarly to the kqueue backend above, EV can take advantage of the
155solaris 10 port interface. Support for port will be detected at runtime, 171solaris 10 event port interface. Support for event ports will be detected
156with a safe fallback to other methods when it cannot be used. 172at runtime, with a safe fallback to other methods when it cannot be used.
157 173
158EOF 174EOF
159 175
160$DEFINE .= " -DEV_USE_PORT=" . (0 + (prompt ("Enable port backend (y/n)?", (-e "/usr/include/sys/port.h") ? "y" : "n") =~ /[yY]/)); 176$DEFINE .= " -DEV_USE_PORT=" . (0 + (prompt ("Enable event port backend (y/n)?", (-e "/usr/include/sys/port.h") ? "y" : "n") =~ /[yY]/));
161 177
162print <<EOF; 178print <<EOF;
163 179
164*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 180*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
165 181
166 182
167EV needs the functions pthread_atfork and clock_gettime. On most systems 183EV needs the functions pthread_atfork and clock_gettime. On most systems
168you need some special libraries for this (such as -lrt and -lpthread). You 184you need some special libraries for this (such as -lrt and -lpthread). You
169can specify additional libraries to provide these calls now, or accept the 185can specify additional libraries to provide these calls (and any other
170default. 186required by EV) now, or accept the default.
171 187
172EOF 188EOF
173 189
190my $solaris_libs = $^O =~ /solaris/ ? " -lsocket -lnsl" : "";
174$LIBS = prompt "Extra libraries for pthread_atfork and clock_gettime?", "-lpthread -lrt"; 191my $LIBS = prompt "Extra libraries for pthread_atfork and clock_gettime?", "-lpthread -lrt$solaris_libs";
175 192
193
194print <<EOF;
195
196*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
197
198
199A backend of a different kind is the Linux inotify(7) interface, which can
200be used to speed up (and reduce resource consumption) of stat watchers. If
201you have it, it is usually a good idea to enable it.
202
203EOF
204
205my $can_inotify = -e "/usr/include/sys/inotify.h";
206$can_inotify = $ENV{EV_INOTIFY} if exists $ENV{EV_INOTIFY};
207$DEFINE .= " -DEV_USE_INOTIFY=" . (0 + (prompt ("Enable inotify support (y/n)?", $can_inotify ? "y" : "n") =~ /[yY]/));
208
209print <<EOF;
210
211*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
212
213
214Another useful bit of functionality is the Linux eventfd, which is useful
215for faster signal handling (don't care) and intra-thread communications
216(more relevant). Kernel support for this will be probed at runtime, but
217your libc must contain the necessary wrapper. Glibc 2.7 and later should
218have this wrapper.
219
220EOF
221
222my $can_eventfd = -e "/usr/include/sys/eventfd.h";
223$can_eventfd = $ENV{EV_EVENTFD} if exists $ENV{EV_EVENTFD};
224$DEFINE .= " -DEV_USE_EVENTFD=" . (0 + (prompt ("Enable linux eventfd support (y/n)?", $can_eventfd ? "y" : "n") =~ /[yY]/));
176 225
177print <<EOF; 226print <<EOF;
178 227
179*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 228*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
180 229
190 SUFFIX => '.gz', 239 SUFFIX => '.gz',
191 }, 240 },
192 depend => { 241 depend => {
193 "EV.c" => "EV/EVAPI.h " 242 "EV.c" => "EV/EVAPI.h "
194 . "libev/ev.c libev/ev.h libev/ev_epoll.c libev/ev_select.c libev/ev_kqueue.c libev/ev_poll.c " 243 . "libev/ev.c libev/ev.h libev/ev_epoll.c libev/ev_select.c libev/ev_kqueue.c libev/ev_poll.c "
195 . "libev/event.h libev/event.c evdns.h evdns.c libev/ev_vars.h libev/ev_wrap.h", 244 . "libev/ev_vars.h libev/ev_wrap.h",
196 }, 245 },
197 INC => "-Ilibev", 246 INC => "-Ilibev",
198 DEFINE => "$DEFINE", 247 DEFINE => "$DEFINE",
199 NAME => "EV", 248 NAME => "EV",
200 LIBS => [$LIBS], 249 LIBS => [$LIBS],
202 @anyevent, 251 @anyevent,
203 }, 252 },
204 VERSION_FROM => "EV.pm", 253 VERSION_FROM => "EV.pm",
205 PM => { 254 PM => {
206 'EV.pm' => '$(INST_LIBDIR)/EV.pm', 255 'EV.pm' => '$(INST_LIBDIR)/EV.pm',
207 'EV/DNS.pm' => '$(INST_LIBDIR)/EV/DNS.pm',
208 'EV/EVAPI.h' => '$(INST_LIBDIR)/EV/EVAPI.h', 256 'EV/EVAPI.h' => '$(INST_LIBDIR)/EV/EVAPI.h',
209 'EV/MakeMaker.pm' => '$(INST_LIBDIR)/EV/MakeMaker.pm', 257 'EV/MakeMaker.pm' => '$(INST_LIBDIR)/EV/MakeMaker.pm',
210 'libev/ev.h' => '$(INST_LIBDIR)/EV/ev.h', 258 'libev/ev.h' => '$(INST_LIBDIR)/EV/ev.h',
259 'libev/ev.pod' => '$(INST_LIBDIR)/EV/libev.pod',
211 }, 260 },
261 MAN3PODS => {
262 'EV.pm' => '$(INST_MAN3DIR)/EV.$(MAN3EXT)',
263 'EV/MakeMaker.pm' => '$(INST_MAN3DIR)/EV::MakeMaker.$(MAN3EXT)',
264 'libev/ev.pod' => '$(INST_MAN3DIR)/EV::libev.$(MAN3EXT)',
265 },
212); 266);
213 267
214 268

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines