1 | use 5.008002; |
1 | use 5.008002; |
2 | |
2 | |
3 | use strict qw(vars subs); |
3 | use strict qw(vars subs); |
4 | use Config; |
4 | use Config; |
5 | use ExtUtils::MakeMaker; |
5 | use ExtUtils::MakeMaker; |
|
|
6 | |
|
|
7 | sub have_inc($) { |
|
|
8 | scalar grep -r "$_/$_[0]", $Config{usrinc}, split / /, $Config{incpth} |
|
|
9 | } |
6 | |
10 | |
7 | unless (-e "libev/ev_epoll.c") { |
11 | unless (-e "libev/ev_epoll.c") { |
8 | print <<EOF; |
12 | print <<EOF; |
9 | |
13 | |
10 | *** |
14 | *** |
… | |
… | |
93 | |
97 | |
94 | EOF |
98 | EOF |
95 | |
99 | |
96 | if (prompt ("Force use of system fd_set for select backend (y/n)?", "n") =~ /[yY]/) { |
100 | if (prompt ("Force use of system fd_set for select backend (y/n)?", "n") =~ /[yY]/) { |
97 | $DEFINE .= " -DEV_SELECT_USE_FD_SET"; |
101 | $DEFINE .= " -DEV_SELECT_USE_FD_SET"; |
98 | } |
102 | } |
99 | } else { |
103 | } else { |
100 | $DEFINE .= " -DEV_USE_SELECT=0"; |
104 | $DEFINE .= " -DEV_USE_SELECT=0"; |
101 | } |
105 | } |
102 | |
106 | |
103 | print <<EOF; |
107 | print <<EOF; |
104 | |
108 | |
105 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
109 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
106 | |
110 | |
… | |
… | |
110 | doesn't work), but works basically everywhere else. It is recommended to use |
114 | doesn't work), but works basically everywhere else. It is recommended to use |
111 | the default here unless you run into compile problems in ev_poll.c. |
115 | the default here unless you run into compile problems in ev_poll.c. |
112 | |
116 | |
113 | EOF |
117 | EOF |
114 | |
118 | |
115 | $DEFINE .= " -DEV_USE_POLL=" . (0 + (prompt ("Enable poll backend (y/n)?", (-e "/usr/include/poll.h") ? "y" : "n") =~ /[yY]/)); |
119 | $DEFINE .= " -DEV_USE_POLL=" . (0 + (prompt ("Enable poll backend (y/n)?", (have_inc "poll.h") ? "y" : "n") =~ /[yY]/)); |
116 | |
120 | |
117 | print <<EOF; |
121 | print <<EOF; |
118 | |
122 | |
119 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
123 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
120 | |
124 | |
… | |
… | |
127 | fall back to using select when epoll isn't available. If unsure, accept |
131 | fall back to using select when epoll isn't available. If unsure, accept |
128 | the default. |
132 | the default. |
129 | |
133 | |
130 | EOF |
134 | EOF |
131 | |
135 | |
132 | my $can_epoll = -e "/usr/include/sys/epoll.h"; |
136 | my $can_epoll = have_inc "sys/epoll.h"; |
133 | $can_epoll = $ENV{EV_EPOLL} if exists $ENV{EV_EPOLL}; |
137 | $can_epoll = $ENV{EV_EPOLL} if exists $ENV{EV_EPOLL}; |
134 | $DEFINE .= " -DEV_USE_EPOLL=" . (0 + (prompt ("Enable epoll backend (y/n)?", $can_epoll ? "y" : "n") =~ /[yY]/)); |
138 | $DEFINE .= " -DEV_USE_EPOLL=" . (0 + (prompt ("Enable epoll backend (y/n)?", $can_epoll ? "y" : "n") =~ /[yY]/)); |
135 | |
139 | |
136 | print <<EOF; |
140 | print <<EOF; |
137 | |
141 | |
… | |
… | |
155 | (similar problems as on FreeBSD). |
159 | (similar problems as on FreeBSD). |
156 | OS X: completely, utterly broken on at least <= 10.6. |
160 | OS X: completely, utterly broken on at least <= 10.6. |
157 | |
161 | |
158 | EOF |
162 | EOF |
159 | |
163 | |
160 | my $can_kqueue = -e "/usr/include/sys/event.h"; |
164 | my $can_kqueue = have_inc "sys/event.h"; |
161 | $can_kqueue = $ENV{EV_KQUEUE} if exists $ENV{EV_KQUEUE}; |
165 | $can_kqueue = $ENV{EV_KQUEUE} if exists $ENV{EV_KQUEUE}; |
162 | $DEFINE .= " -DEV_USE_KQUEUE=" . (0 + (prompt ("Enable kqueue backend (y/n)?", $can_kqueue ? "y" : "n") =~ /[yY]/)); |
166 | $DEFINE .= " -DEV_USE_KQUEUE=" . (0 + (prompt ("Enable kqueue backend (y/n)?", $can_kqueue ? "y" : "n") =~ /[yY]/)); |
163 | |
167 | |
164 | print <<EOF; |
168 | print <<EOF; |
165 | |
169 | |
… | |
… | |
170 | solaris 10 event port interface. Support for event ports will be detected |
174 | solaris 10 event port interface. Support for event ports will be detected |
171 | at runtime, with a safe fallback to other methods when it cannot be used. |
175 | at runtime, with a safe fallback to other methods when it cannot be used. |
172 | |
176 | |
173 | EOF |
177 | EOF |
174 | |
178 | |
175 | $DEFINE .= " -DEV_USE_PORT=" . (0 + (prompt ("Enable event port backend (y/n)?", (-e "/usr/include/sys/port.h") ? "y" : "n") =~ /[yY]/)); |
179 | $DEFINE .= " -DEV_USE_PORT=" . (0 + (prompt ("Enable event port backend (y/n)?", (have_inc "sys/port.h") ? "y" : "n") =~ /[yY]/)); |
176 | |
180 | |
177 | print <<EOF; |
181 | print <<EOF; |
178 | |
182 | |
179 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
183 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
180 | |
184 | |
… | |
… | |
206 | you have the include file and libc support for it, it is usually a good |
210 | you have the include file and libc support for it, it is usually a good |
207 | idea to enable it, as kernel availability is detected at runtime. |
211 | idea to enable it, as kernel availability is detected at runtime. |
208 | |
212 | |
209 | EOF |
213 | EOF |
210 | |
214 | |
211 | my $can_inotify = -e "/usr/include/sys/inotify.h"; |
215 | my $can_inotify = have_inc "sys/inotify.h"; |
212 | $can_inotify = $ENV{EV_INOTIFY} if exists $ENV{EV_INOTIFY}; |
216 | $can_inotify = $ENV{EV_INOTIFY} if exists $ENV{EV_INOTIFY}; |
213 | $DEFINE .= " -DEV_USE_INOTIFY=" . (0 + (prompt ("Enable inotify support (y/n)?", $can_inotify ? "y" : "n") =~ /[yY]/)); |
217 | $DEFINE .= " -DEV_USE_INOTIFY=" . (0 + (prompt ("Enable inotify support (y/n)?", $can_inotify ? "y" : "n") =~ /[yY]/)); |
214 | |
218 | |
215 | print <<EOF; |
219 | print <<EOF; |
216 | |
220 | |
… | |
… | |
223 | your libc must contain the necessary wrapper. Glibc 2.7 and later should |
227 | your libc must contain the necessary wrapper. Glibc 2.7 and later should |
224 | have this wrapper. |
228 | have this wrapper. |
225 | |
229 | |
226 | EOF |
230 | EOF |
227 | |
231 | |
228 | my $can_eventfd = -e "/usr/include/sys/eventfd.h"; |
232 | my $can_eventfd = have_inc "sys/eventfd.h"; |
229 | $can_eventfd = $ENV{EV_EVENTFD} if exists $ENV{EV_EVENTFD}; |
233 | $can_eventfd = $ENV{EV_EVENTFD} if exists $ENV{EV_EVENTFD}; |
230 | $DEFINE .= " -DEV_USE_EVENTFD=" . (0 + (prompt ("Enable linux eventfd support (y/n)?", $can_eventfd ? "y" : "n") =~ /[yY]/)); |
234 | $DEFINE .= " -DEV_USE_EVENTFD=" . (0 + (prompt ("Enable linux eventfd support (y/n)?", $can_eventfd ? "y" : "n") =~ /[yY]/)); |
231 | |
235 | |
232 | print <<EOF; |
236 | print <<EOF; |
233 | |
237 | |
… | |
… | |
239 | this will be probed at runtime, but your libc must contain the necessary |
243 | this will be probed at runtime, but your libc must contain the necessary |
240 | wrapper. Glibc 2.7 and later should have this wrapper. |
244 | wrapper. Glibc 2.7 and later should have this wrapper. |
241 | |
245 | |
242 | EOF |
246 | EOF |
243 | |
247 | |
244 | my $can_signalfd = -e "/usr/include/sys/signalfd.h"; |
248 | my $can_signalfd = have_inc "sys/signalfd.h"; |
245 | $can_signalfd = $ENV{EV_SIGNALFD} if exists $ENV{EV_SIGNALFD}; |
249 | $can_signalfd = $ENV{EV_SIGNALFD} if exists $ENV{EV_SIGNALFD}; |
246 | $DEFINE .= " -DEV_USE_SIGNALFD=" . (0 + (prompt ("Enable linux signalfd support (y/n)?", $can_signalfd ? "y" : "n") =~ /[yY]/)); |
250 | $DEFINE .= " -DEV_USE_SIGNALFD=" . (0 + (prompt ("Enable linux signalfd support (y/n)?", $can_signalfd ? "y" : "n") =~ /[yY]/)); |
247 | |
251 | |
248 | print <<EOF; |
252 | print <<EOF; |
249 | |
253 | |