… | |
… | |
70 | print <<EOF; |
70 | print <<EOF; |
71 | |
71 | |
72 | |
72 | |
73 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
73 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
74 | |
74 | |
75 | EV needs the functions pthread_atfork and clock_gettime. On most systems |
75 | EV can use various backends with various portability issue. The select |
76 | you need some special libraries for this (such as -lrt and -lpthread). You can |
76 | backend is the most portable and makes for a good fallback, but it can be |
77 | specify additional libraries to provide these calls now, or accept the default. |
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. |
78 | |
81 | |
79 | EOF |
82 | EOF |
80 | |
83 | |
81 | $LIBS = prompt "Extra libraries for pthread_atfork and clock_gettime?", "-lpthread -lrt"; |
84 | if (prompt ("Enable select backend (y/n)?", "y") =~ /[yY]/) { |
|
|
85 | $DEFINE .= " -DEV_USE_SELECT"; |
82 | |
86 | |
83 | |
|
|
84 | print <<EOF; |
87 | print <<EOF; |
85 | |
88 | |
86 | |
89 | |
87 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
90 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
88 | |
91 | |
89 | EV needs the functions pthread_atfork and clock_gettime. On most systems |
92 | The select backend can operate in two modes. One uses the system-provided |
90 | you need some special libraries for this (such as -lrt and -lpthread). You can |
93 | fd_set and is usually limited to 1024 file descriptors (64 on windows), |
91 | specify additional libraries to provide these calls now, or accept the default. |
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 | 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. |
92 | |
133 | |
93 | EOF |
134 | EOF |
94 | |
135 | |
95 | if (prompt ("Enable epoll backend (y/n)?", (-e "/usr/include/sys/epoll.h") ? "y" : "n") =~ /[yY]/) { |
136 | if (prompt ("Enable epoll backend (y/n)?", (-e "/usr/include/sys/epoll.h") ? "y" : "n") =~ /[yY]/) { |
96 | $DEFINE .= " -DEV_USE_EPOLL"; |
137 | $DEFINE .= " -DEV_USE_EPOLL"; |
97 | } |
138 | } |
|
|
139 | |
|
|
140 | print <<EOF; |
|
|
141 | |
|
|
142 | |
|
|
143 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
|
|
144 | |
|
|
145 | 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 | |
|
|
152 | EOF |
|
|
153 | |
|
|
154 | if (prompt ("Enable kqueue backend (y/n)?", (-e "/usr/include/sys/event.h") ? "y" : "n") =~ /[yY]/) { |
|
|
155 | $DEFINE .= " -DEV_USE_KQUEUE"; |
|
|
156 | } |
|
|
157 | |
|
|
158 | print <<EOF; |
|
|
159 | |
|
|
160 | |
|
|
161 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
|
|
162 | |
|
|
163 | EV needs the functions pthread_atfork and clock_gettime. On most systems |
|
|
164 | 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 | |
|
|
168 | EOF |
|
|
169 | |
|
|
170 | $LIBS = prompt "Extra libraries for pthread_atfork and clock_gettime?", "-lpthread -lrt"; |
|
|
171 | |
98 | |
172 | |
99 | print <<EOF; |
173 | print <<EOF; |
100 | |
174 | |
101 | |
175 | |
102 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
176 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
… | |
… | |
109 | COMPRESS => 'gzip -9v', |
183 | COMPRESS => 'gzip -9v', |
110 | SUFFIX => '.gz', |
184 | SUFFIX => '.gz', |
111 | }, |
185 | }, |
112 | depend => { |
186 | depend => { |
113 | "EV.c" => "EV/EVAPI.h " |
187 | "EV.c" => "EV/EVAPI.h " |
114 | . "libev/ev.c libev/ev.h libev/ev_epoll.c libev/ev_select.c " |
188 | . "libev/ev.c libev/ev.h libev/ev_epoll.c libev/ev_select.c libev/ev_kqueue.c libev/ev_poll.c " |
115 | . "libev/event.h libev/event.c libev/evdns.h libev/evdns.c", |
189 | . "libev/event.h libev/event.c evdns.h evdns.c libev/ev_vars.h libev/ev_wrap.h", |
116 | }, |
190 | }, |
117 | INC => "-Ilibev", |
191 | INC => "-Ilibev", |
118 | DEFINE => "$DEFINE", |
192 | DEFINE => "$DEFINE", |
119 | NAME => "EV", |
193 | NAME => "EV", |
120 | LIBS => [$LIBS], |
194 | LIBS => [$LIBS], |
121 | VERSION_FROM => "EV.pm", |
195 | VERSION_FROM => "EV.pm", |
122 | PM => { |
196 | PM => { |
123 | 'EV.pm' => '$(INST_LIBDIR)/EV.pm', |
197 | 'EV.pm' => '$(INST_LIBDIR)/EV.pm', |
124 | 'EV/AnyEvent.pm' => '$(INST_LIBDIR)/EV/AnyEvent.pm', |
|
|
125 | 'EV/DNS.pm' => '$(INST_LIBDIR)/EV/DNS.pm', |
198 | 'EV/DNS.pm' => '$(INST_LIBDIR)/EV/DNS.pm', |
126 | 'EV/EVAPI.h' => '$(INST_LIBDIR)/EV/EVAPI.h', |
199 | 'EV/EVAPI.h' => '$(INST_LIBDIR)/EV/EVAPI.h', |
127 | 'EV/MakeMaker.pm' => '$(INST_LIBDIR)/EV/MakeMaker.pm', |
200 | 'EV/MakeMaker.pm' => '$(INST_LIBDIR)/EV/MakeMaker.pm', |
128 | 'libev/ev.h' => '$(INST_LIBDIR)/EV/ev.h', |
201 | 'libev/ev.h' => '$(INST_LIBDIR)/EV/ev.h', |
129 | }, |
202 | }, |