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

Comparing EV/Makefile.PL (file contents):
Revision 1.11 by root, Thu Nov 1 09:05:32 2007 UTC vs.
Revision 1.21 by root, Fri Nov 16 01:46:26 2007 UTC

1use 5.006; 1use 5.006;
2 2
3use Config; 3use Config;
4use ExtUtils::MakeMaker; 4use ExtUtils::MakeMaker;
5
6 5
7unless (-e "libev/ev_epoll.c") { 6unless (-e "libev/ev_epoll.c") {
8 print <<EOF; 7 print <<EOF;
9 8
10*** 9***
34print <<EOF; 33print <<EOF;
35 34
36 35
37*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 36*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
38 37
39POSIX optionally offers support for a monotonic clock source. EV can 38POSIX optionally offers support for a monotonic clock source. EV
40take advantage of this clock source to detect time jumps reliably. This 39can take advantage of this clock source to detect time jumps
41will usually slow down EV a tiny amount, but this is usually
42well-invested. Unfortunately, some systems are bound to be broken, so 40reliably. Unfortunately, some systems are bound to be broken, so you can
43you can disable this here. Whatever your reasons, you can completely 41disable this here: you can completely disable the detection and use of
44disable the detection and use of this monotonic clock by answering 'n' 42the monotonic clock by answering 'n' here. Support for this clock type
45here. Support for this clock type will otherwise be autodetected at both 43will otherwise be autodetected at both compile- and runtime.
46compile- and runtime.
47 44
48EOF 45EOF
49 46
50if (prompt ("Enable optional support for CLOCK_MONOTONIC (y/n)?", "y") =~ /[yY]/) { 47if (prompt ("Enable optional support for CLOCK_MONOTONIC (y/n)?", "y") =~ /[yY]/) {
51 $DEFINE .= " -DEV_USE_MONOTONIC"; 48 $DEFINE .= " -DEV_USE_MONOTONIC";
72print <<EOF; 69print <<EOF;
73 70
74 71
75*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 72*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
76 73
77EV needs the functions pthread_atfork and clock_gettime. On most systems 74EV can use various backends with various portability issue. The select
78you need some special libraries for this (such as -lrt and -lpthread). You can 75backend is the most portable and makes for a good fallback, but it can be
79specify additional libraries to provide these calls now, or accept the default. 76limited to a low number of file descriptors and/or might not compile. If
77you have problems with compiling ev_select., you might try to play around
78with disabling it here, or forcing it to use the fd_set provided by your
79OS, via the next question. I highly recommend keeping it in.
80 80
81EOF 81EOF
82 82
83$LIBS = prompt "Extra libraries for pthread_atfork and clock_gettime?", "-lpthread -lrt"; 83if (prompt ("Enable select backend (y/n)?", "y") =~ /[yY]/) {
84 $DEFINE .= " -DEV_USE_SELECT";
84 85
85
86print <<EOF; 86 print <<EOF;
87 87
88 88
89*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 89*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
90 90
91EV needs the functions pthread_atfork and clock_gettime. On most systems 91The select backend can operate in two modes. One uses the system-provided
92you need some special libraries for this (such as -lrt and -lpthread). You can 92fd_set and is usually limited to 1024 file descriptors (64 on windows),
93specify additional libraries to provide these calls now, or accept the default. 93the other requires your header files to define NFDBITS and declare a
94suitable fd_mask type. If you run into problems compiling ev_select.c, you
95can try forcing the use of the system fd_set here.
96
97EOF
98
99 if (prompt ("Force use of system fd_set for select backend (y/n)?", "n") =~ /[yY]/) {
100 $DEFINE .= " -DEV_SELECT_USE_FD_SET";
101 }
102}
103
104print <<EOF;
105
106
107*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
108
109The second very portable backend is poll(2). It does not exist on windows
110and various versions of Mac OS X (and on the other versions it simply
111doesn't work), but works basically everywhere else. It is recommended to use
112the default here unless you run into compile problems in ev_poll.c.
113
114EOF
115
116if (prompt ("Enable poll backend (y/n)?", (-e "/usr/include/poll.h") ? "y" : "n") =~ /[yY]/) {
117 $DEFINE .= " -DEV_USE_POLL";
118}
119
120print <<EOF;
121
122
123*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
124
125EV by default uses select, which makes it hard to write efficient servers,
126especially if the number of active conencitons is much lower than the open
127ones. GNU/Linux systems have a more scalable method called "epoll", which
128EV can use. For this to work, both your kernel and glibc have to support
129epoll, but if you can compile it, the detection will be done at runtime,
130and EV will safely fall back to using select when epoll isn't available.
131If unsure, accept the default.
94 132
95EOF 133EOF
96 134
97if (prompt ("Enable epoll backend (y/n)?", (-e "/usr/include/sys/epoll.h") ? "y" : "n") =~ /[yY]/) { 135if (prompt ("Enable epoll backend (y/n)?", (-e "/usr/include/sys/epoll.h") ? "y" : "n") =~ /[yY]/) {
98 $DEFINE .= " -DEV_USE_EPOLL"; 136 $DEFINE .= " -DEV_USE_EPOLL";
101print <<EOF; 139print <<EOF;
102 140
103 141
104*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 142*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
105 143
106EOF 144Similarly to the epoll backend above, EV can take advantage of kqueue
145on many BSD systems (it seems to be broken on Mac OS X though, but what
146isn't broken on that shoddy platform... ah yes, the cash gushing by apple,
147selling defective software works perfectly there). Support for kqueue will
148be detected at runtime, with a safe fallback to other methods when it
149cannot be used.
107 150
108#$ENV{CC} = $Config{cc}; 151EOF
109#$ENV{CFLAGS} = join " ", map $Config{$_}, qw(inc optimize ccflags cccdlflags);
110#system "cd libevent && ./configure --disable-shared --enable-static --disable-maintainer-mode"
111# and die "configure failed.";
112 152
113#$LIBS = qx<cd libevent && make printlibs>; 153if (prompt ("Enable kqueue backend (y/n)?", (-e "/usr/include/sys/event.h") ? "y" : "n") =~ /[yY]/) {
154 $DEFINE .= " -DEV_USE_KQUEUE";
155}
156
157print <<EOF;
158
159
160*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
161
162Similarly to the kqueue backend above, EV can take advantage of the
163solaris 10 port interface. Support for port will be detected at runtime,
164with a safe fallback to other methods when it cannot be used.
165
166EOF
167
168if (prompt ("Enable port backend (y/n)?", (-e "/usr/include/sys/port.h") ? "y" : "n") =~ /[yY]/) {
169 $DEFINE .= " -DEV_USE_PORT";
170}
171
172print <<EOF;
173
174
175*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
176
177EV needs the functions pthread_atfork and clock_gettime. On most systems
178you need some special libraries for this (such as -lrt and -lpthread). You
179can specify additional libraries to provide these calls now, or accept the
180default.
181
182EOF
183
184$LIBS = prompt "Extra libraries for pthread_atfork and clock_gettime?", "-lpthread -lrt";
185
186
187print <<EOF;
188
189
190*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
191
192EOF
193
194my @anyevent = eval { require AnyEvent; $AnyEvent::VERSION < 2.6 } ? (AnyEvent => 2.6) : ();
114 195
115WriteMakefile( 196WriteMakefile(
116 dist => { 197 dist => {
117 PREOP => 'pod2text EV.pm | tee README >$(DISTVNAME)/README; chmod -R u=rwX,go=rX . ;', 198 PREOP => 'pod2text EV.pm | tee README >$(DISTVNAME)/README; chmod -R u=rwX,go=rX . ;',
118 COMPRESS => 'gzip -9v', 199 COMPRESS => 'gzip -9v',
119 SUFFIX => '.gz', 200 SUFFIX => '.gz',
120 }, 201 },
121 depend => { 202 depend => {
122 "EV.c" => "EV/EVAPI.h libev/ev.c libev/ev.h libev/ev_epoll.c libev/ev_select.c", 203 "EV.c" => "EV/EVAPI.h "
204 . "libev/ev.c libev/ev.h libev/ev_epoll.c libev/ev_select.c libev/ev_kqueue.c libev/ev_poll.c "
205 . "libev/event.h libev/event.c evdns.h evdns.c libev/ev_vars.h libev/ev_wrap.h",
123 }, 206 },
124 INC => "-Ilibev", 207 INC => "-Ilibev",
125 DEFINE => "$DEFINE", 208 DEFINE => "$DEFINE",
126 NAME => "EV", 209 NAME => "EV",
127 LIBS => [$LIBS], 210 LIBS => [$LIBS],
211 PREREQ_PM => {
212 @anyevent,
213 },
128 VERSION_FROM => "EV.pm", 214 VERSION_FROM => "EV.pm",
129 PM => { 215 PM => {
130 'EV.pm' => '$(INST_LIBDIR)/EV.pm', 216 'EV.pm' => '$(INST_LIBDIR)/EV.pm',
131 'EV/AnyEvent.pm' => '$(INST_LIBDIR)/EV/AnyEvent.pm',
132 #'EV/DNS.pm' => '$(INST_LIBDIR)/EV/DNS.pm', 217 'EV/DNS.pm' => '$(INST_LIBDIR)/EV/DNS.pm',
133 'EV/EVAPI.h' => '$(INST_LIBDIR)/EV/EVAPI.h', 218 'EV/EVAPI.h' => '$(INST_LIBDIR)/EV/EVAPI.h',
134 'EV/MakeMaker.pm' => '$(INST_LIBDIR)/EV/MakeMaker.pm', 219 'EV/MakeMaker.pm' => '$(INST_LIBDIR)/EV/MakeMaker.pm',
135 'libev/ev.h' => '$(INST_LIBDIR)/EV/ev.h', 220 'libev/ev.h' => '$(INST_LIBDIR)/EV/ev.h',
136 }, 221 },
137); 222);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines