ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/Makefile.PL
Revision: 1.19
Committed: Mon Nov 12 01:01:13 2007 UTC (16 years, 6 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rel-0_8, rel-0_9
Changes since 1.18: +57 -6 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 root 1.4 use 5.006;
2    
3 root 1.7 use Config;
4 root 1.1 use ExtUtils::MakeMaker;
5    
6 root 1.10
7     unless (-e "libev/ev_epoll.c") {
8     print <<EOF;
9    
10     ***
11     *** ERROR: libev is missing or damaged. If you used a CVS check-out of EV,
12     *** you also have to check-out the "libev" module from the same CVS
13     *** repository into the EV dir (i.e. EV/libev from outside).
14     ***
15    
16     EOF
17     exit 1;
18     }
19    
20 root 1.11 print <<EOF;
21    
22    
23     *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
24    
25     Welcome to EV configuration. If you are in a hurry, just press return here
26     and hope for the best. The defaults should usually do.
27    
28     EOF
29    
30     if (prompt ("Skip further questions and use defaults (y/n)?", "y") =~ /[yY]/) {
31     $ENV{PERL_MM_USE_DEFAULT} = 1;
32     }
33    
34     print <<EOF;
35    
36    
37     *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
38    
39 root 1.14 POSIX optionally offers support for a monotonic clock source. EV
40     can take advantage of this clock source to detect time jumps
41     reliably. Unfortunately, some systems are bound to be broken, so you can
42     disable this here: you can completely disable the detection and use of
43     the monotonic clock by answering 'n' here. Support for this clock type
44     will otherwise be autodetected at both compile- and runtime.
45 root 1.11
46     EOF
47    
48     if (prompt ("Enable optional support for CLOCK_MONOTONIC (y/n)?", "y") =~ /[yY]/) {
49     $DEFINE .= " -DEV_USE_MONOTONIC";
50     }
51    
52     print <<EOF;
53    
54    
55     *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
56    
57     POSIX optionally offers support for a (potentially) high-resolution
58     realtime clock interface. In a good implementation, using it is faster
59     than the normal method of using gettimeofday. Unfortunately, this option
60     is also bound to be broken on some systems, so you can disable use and
61     probing of this feature altogether here. Otherwise support for this clock
62     type will be autodetected at compiletime.
63    
64     EOF
65    
66     if (prompt ("Prefer clock_gettime (CLOCK_REALTIME) over gettimeofday (y/n)?", "y") !~ /[yY]/) {
67     $DEFINE .= " -DEV_USE_REALTIME=0";
68     }
69    
70     print <<EOF;
71    
72    
73     *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
74    
75 root 1.19 EV can use various backends with various portability issue. The select
76     backend is the most portable and makes for a good fallback, but it can be
77     limited to a low number of file descriptors and/or might not compile. If
78     you have problems with compiling ev_select., you might try to play around
79     with disabling it here, or forcing it to use the fd_set provided by your
80     OS, via the next question. I highly recommend keeping it in.
81    
82     EOF
83    
84     if (prompt ("Enable select backend (y/n)?", "y") =~ /[yY]/) {
85     $DEFINE .= " -DEV_USE_SELECT";
86    
87     print <<EOF;
88    
89    
90     *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
91    
92     The select backend can operate in two modes. One uses the system-provided
93     fd_set and is usually limited to 1024 file descriptors (64 on windows),
94     the other requires your header files to define NFDBITS and declare a
95     suitable fd_mask type. If you run into problems compiling ev_select.c, you
96     can try forcing the use of the system fd_set here.
97    
98     EOF
99    
100     if (prompt ("Force use of system fd_set for select backend (y/n)?", "n") =~ /[yY]/) {
101     $DEFINE .= " -DEV_SELECT_USE_FD_SET";
102     }
103     }
104    
105     print <<EOF;
106    
107    
108     *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
109    
110     The second very portable backend is poll(2). It does not exist on windows
111     and various versions of Mac OS X (and on the other versions it simply
112     doesn't work), but works basically everywhere else. It is recommended to use
113     the default here unless you run into compile problems in ev_poll.c.
114    
115     EOF
116    
117     if (prompt ("Enable poll backend (y/n)?", (-e "/usr/include/poll.h") ? "y" : "n") =~ /[yY]/) {
118     $DEFINE .= " -DEV_USE_POLL";
119     }
120    
121     print <<EOF;
122    
123    
124     *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
125    
126 root 1.15 EV by default uses select, which makes it hard to write efficient servers,
127     especially if the number of active conencitons is much lower than the open
128     ones. GNU/Linux systems have a more scalable method called "epoll", which
129     EV can use. For this to work, both your kernel and glibc have to support
130     epoll, but if you can compile it, the detection will be done at runtime,
131     and EV will safely fall back to using select when epoll isn't available.
132     If unsure, accept the default.
133 root 1.11
134     EOF
135    
136 root 1.15 if (prompt ("Enable epoll backend (y/n)?", (-e "/usr/include/sys/epoll.h") ? "y" : "n") =~ /[yY]/) {
137     $DEFINE .= " -DEV_USE_EPOLL";
138     }
139    
140     print <<EOF;
141    
142    
143     *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
144    
145 root 1.19 Similarly to the epoll backend above, EV can take advantage of kqueue
146     on many BSD systems (it seems to be broken on Mac OS X though, but what
147     isn't broken on that shoddy platform... ah yes, the cash gushing by apple,
148     selling defective software works perfectly there). Support for kqueue will
149     be detected at runtime, with a safe fallback to other methods when it
150     cannot be used.
151 root 1.11
152 root 1.15 EOF
153    
154 root 1.16 if (prompt ("Enable kqueue backend (y/n)?", (-e "/usr/include/sys/event.h") ? "y" : "n") =~ /[yY]/) {
155 root 1.15 $DEFINE .= " -DEV_USE_KQUEUE";
156     }
157 root 1.11
158     print <<EOF;
159    
160    
161     *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
162    
163     EV needs the functions pthread_atfork and clock_gettime. On most systems
164 root 1.15 you need some special libraries for this (such as -lrt and -lpthread). You
165     can specify additional libraries to provide these calls now, or accept the
166     default.
167 root 1.11
168     EOF
169    
170 root 1.15 $LIBS = prompt "Extra libraries for pthread_atfork and clock_gettime?", "-lpthread -lrt";
171    
172 root 1.11
173     print <<EOF;
174    
175    
176     *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
177    
178     EOF
179    
180 root 1.1 WriteMakefile(
181     dist => {
182 root 1.2 PREOP => 'pod2text EV.pm | tee README >$(DISTVNAME)/README; chmod -R u=rwX,go=rX . ;',
183 root 1.1 COMPRESS => 'gzip -9v',
184     SUFFIX => '.gz',
185     },
186 root 1.10 depend => {
187 root 1.13 "EV.c" => "EV/EVAPI.h "
188 root 1.17 . "libev/ev.c libev/ev.h libev/ev_epoll.c libev/ev_select.c libev/ev_kqueue.c libev/ev_poll.c "
189 root 1.18 . "libev/event.h libev/event.c evdns.h evdns.c libev/ev_vars.h libev/ev_wrap.h",
190 root 1.10 },
191 root 1.8 INC => "-Ilibev",
192 root 1.11 DEFINE => "$DEFINE",
193 root 1.2 NAME => "EV",
194 root 1.11 LIBS => [$LIBS],
195 root 1.2 VERSION_FROM => "EV.pm",
196 root 1.5 PM => {
197     'EV.pm' => '$(INST_LIBDIR)/EV.pm',
198 root 1.12 'EV/DNS.pm' => '$(INST_LIBDIR)/EV/DNS.pm',
199 root 1.5 'EV/EVAPI.h' => '$(INST_LIBDIR)/EV/EVAPI.h',
200     'EV/MakeMaker.pm' => '$(INST_LIBDIR)/EV/MakeMaker.pm',
201 root 1.8 'libev/ev.h' => '$(INST_LIBDIR)/EV/ev.h',
202 root 1.5 },
203 root 1.1 );
204    
205 root 1.6