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

Comparing EV/Makefile.PL (file contents):
Revision 1.5 by root, Mon Oct 29 08:48:07 2007 UTC vs.
Revision 1.20 by root, Wed Nov 14 22:30:50 2007 UTC

1use 5.006; 1use 5.006;
2 2
3use Config;
3use ExtUtils::MakeMaker; 4use ExtUtils::MakeMaker;
4 5
6unless (-e "libev/ev_epoll.c") {
5print <<EOF; 7 print <<EOF;
6 8
7*** 9***
8*** You need to install libevent (http://monkey.org/~provos/libevent/) separately 10*** ERROR: libev is missing or damaged. If you used a CVS check-out of EV,
9*** first in a way so that the Makefile.PL can find both -levent and the event.h 11*** you also have to check-out the "libev" module from the same CVS
10*** and evdns.h include files. 12*** repository into the EV dir (i.e. EV/libev from outside).
11*** 13***
12*** Version 1.3e or higher is recommended, but older 1.3 versions likely work too.
13***
14 14
15EOF 15EOF
16 exit 1;
17}
18
19print <<EOF;
20
21
22*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
23
24Welcome to EV configuration. If you are in a hurry, just press return here
25and hope for the best. The defaults should usually do.
26
27EOF
28
29if (prompt ("Skip further questions and use defaults (y/n)?", "y") =~ /[yY]/) {
30 $ENV{PERL_MM_USE_DEFAULT} = 1;
31}
32
33print <<EOF;
34
35
36*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
37
38POSIX optionally offers support for a monotonic clock source. EV
39can take advantage of this clock source to detect time jumps
40reliably. Unfortunately, some systems are bound to be broken, so you can
41disable this here: you can completely disable the detection and use of
42the monotonic clock by answering 'n' here. Support for this clock type
43will otherwise be autodetected at both compile- and runtime.
44
45EOF
46
47if (prompt ("Enable optional support for CLOCK_MONOTONIC (y/n)?", "y") =~ /[yY]/) {
48 $DEFINE .= " -DEV_USE_MONOTONIC";
49}
50
51print <<EOF;
52
53
54*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
55
56POSIX optionally offers support for a (potentially) high-resolution
57realtime clock interface. In a good implementation, using it is faster
58than the normal method of using gettimeofday. Unfortunately, this option
59is also bound to be broken on some systems, so you can disable use and
60probing of this feature altogether here. Otherwise support for this clock
61type will be autodetected at compiletime.
62
63EOF
64
65if (prompt ("Prefer clock_gettime (CLOCK_REALTIME) over gettimeofday (y/n)?", "y") !~ /[yY]/) {
66 $DEFINE .= " -DEV_USE_REALTIME=0";
67}
68
69print <<EOF;
70
71
72*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
73
74EV can use various backends with various portability issue. The select
75backend is the most portable and makes for a good fallback, but it can be
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
81EOF
82
83if (prompt ("Enable select backend (y/n)?", "y") =~ /[yY]/) {
84 $DEFINE .= " -DEV_USE_SELECT";
85
86 print <<EOF;
87
88
89*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
90
91The select backend can operate in two modes. One uses the system-provided
92fd_set and is usually limited to 1024 file descriptors (64 on windows),
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.
132
133EOF
134
135if (prompt ("Enable epoll backend (y/n)?", (-e "/usr/include/sys/epoll.h") ? "y" : "n") =~ /[yY]/) {
136 $DEFINE .= " -DEV_USE_EPOLL";
137}
138
139print <<EOF;
140
141
142*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
143
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.
150
151EOF
152
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
162EV needs the functions pthread_atfork and clock_gettime. On most systems
163you need some special libraries for this (such as -lrt and -lpthread). You
164can specify additional libraries to provide these calls now, or accept the
165default.
166
167EOF
168
169$LIBS = prompt "Extra libraries for pthread_atfork and clock_gettime?", "-lpthread -lrt";
170
171
172print <<EOF;
173
174
175*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
176
177EOF
178
179my @anyevent = eval { require AnyEvent; $AnyEvent::VERSION < 2.6 } ? (AnyEvent => 2.6) : ();
16 180
17WriteMakefile( 181WriteMakefile(
18 dist => { 182 dist => {
19 PREOP => 'pod2text EV.pm | tee README >$(DISTVNAME)/README; chmod -R u=rwX,go=rX . ;', 183 PREOP => 'pod2text EV.pm | tee README >$(DISTVNAME)/README; chmod -R u=rwX,go=rX . ;',
20 COMPRESS => 'gzip -9v', 184 COMPRESS => 'gzip -9v',
21 SUFFIX => '.gz', 185 SUFFIX => '.gz',
22 }, 186 },
23 LIBS => ["-levent"], 187 depend => {
188 "EV.c" => "EV/EVAPI.h "
189 . "libev/ev.c libev/ev.h libev/ev_epoll.c libev/ev_select.c libev/ev_kqueue.c libev/ev_poll.c "
190 . "libev/event.h libev/event.c evdns.h evdns.c libev/ev_vars.h libev/ev_wrap.h",
191 },
192 INC => "-Ilibev",
193 DEFINE => "$DEFINE",
24 NAME => "EV", 194 NAME => "EV",
195 LIBS => [$LIBS],
196 PREREQ_PM => {
197 @anyevent,
198 },
25 VERSION_FROM => "EV.pm", 199 VERSION_FROM => "EV.pm",
26 PM => { 200 PM => {
27 'EV.pm' => '$(INST_LIBDIR)/EV.pm', 201 'EV.pm' => '$(INST_LIBDIR)/EV.pm',
28 'EV/AnyEvent.pm' => '$(INST_LIBDIR)/EV/AnyEvent.pm',
29 'EV/DNS.pm' => '$(INST_LIBDIR)/EV/DNS.pm', 202 'EV/DNS.pm' => '$(INST_LIBDIR)/EV/DNS.pm',
30 'EV/EVAPI.h' => '$(INST_LIBDIR)/EV/EVAPI.h', 203 'EV/EVAPI.h' => '$(INST_LIBDIR)/EV/EVAPI.h',
31 'EV/MakeMaker.pm' => '$(INST_LIBDIR)/EV/MakeMaker.pm', 204 'EV/MakeMaker.pm' => '$(INST_LIBDIR)/EV/MakeMaker.pm',
205 'libev/ev.h' => '$(INST_LIBDIR)/EV/ev.h',
32 }, 206 },
33); 207);
34 208
209

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines