1 | use 5.006; |
1 | use 5.006; |
2 | |
2 | |
3 | use Config; |
3 | use Config; |
4 | use ExtUtils::MakeMaker; |
4 | use ExtUtils::MakeMaker; |
5 | |
|
|
6 | |
5 | |
7 | unless (-e "libev/ev_epoll.c") { |
6 | unless (-e "libev/ev_epoll.c") { |
8 | print <<EOF; |
7 | print <<EOF; |
9 | |
8 | |
10 | *** |
9 | *** |
… | |
… | |
64 | EOF |
63 | EOF |
65 | |
64 | |
66 | if (prompt ("Prefer clock_gettime (CLOCK_REALTIME) over gettimeofday (y/n)?", "y") !~ /[yY]/) { |
65 | if (prompt ("Prefer clock_gettime (CLOCK_REALTIME) over gettimeofday (y/n)?", "y") !~ /[yY]/) { |
67 | $DEFINE .= " -DEV_USE_REALTIME=0"; |
66 | $DEFINE .= " -DEV_USE_REALTIME=0"; |
68 | } |
67 | } |
|
|
68 | |
|
|
69 | print <<EOF; |
|
|
70 | |
|
|
71 | |
|
|
72 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
|
|
73 | |
|
|
74 | EV can use various backends with various portability issue. The select |
|
|
75 | backend is the most portable and makes for a good fallback, but it can be |
|
|
76 | limited to a low number of file descriptors and/or might not compile. If |
|
|
77 | you have problems with compiling ev_select., you might try to play around |
|
|
78 | with disabling it here, or forcing it to use the fd_set provided by your |
|
|
79 | OS, via the next question. I highly recommend keeping it in. |
|
|
80 | |
|
|
81 | EOF |
|
|
82 | |
|
|
83 | if (prompt ("Enable select backend (y/n)?", "y") =~ /[yY]/) { |
|
|
84 | $DEFINE .= " -DEV_USE_SELECT"; |
|
|
85 | |
|
|
86 | print <<EOF; |
|
|
87 | |
|
|
88 | |
|
|
89 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
|
|
90 | |
|
|
91 | The select backend can operate in two modes. One uses the system-provided |
|
|
92 | fd_set and is usually limited to 1024 file descriptors (64 on windows), |
|
|
93 | the other requires your header files to define NFDBITS and declare a |
|
|
94 | suitable fd_mask type. If you run into problems compiling ev_select.c, you |
|
|
95 | can try forcing the use of the system fd_set here. |
|
|
96 | |
|
|
97 | EOF |
|
|
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 | |
|
|
104 | print <<EOF; |
|
|
105 | |
|
|
106 | |
|
|
107 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
|
|
108 | |
|
|
109 | The second very portable backend is poll(2). It does not exist on windows |
|
|
110 | and various versions of Mac OS X (and on the other versions it simply |
|
|
111 | doesn't work), but works basically everywhere else. It is recommended to use |
|
|
112 | the default here unless you run into compile problems in ev_poll.c. |
|
|
113 | |
|
|
114 | EOF |
|
|
115 | |
|
|
116 | if (prompt ("Enable poll backend (y/n)?", (-e "/usr/include/poll.h") ? "y" : "n") =~ /[yY]/) { |
|
|
117 | $DEFINE .= " -DEV_USE_POLL"; |
|
|
118 | } |
69 | |
119 | |
70 | print <<EOF; |
120 | print <<EOF; |
71 | |
121 | |
72 | |
122 | |
73 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
123 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
… | |
… | |
89 | print <<EOF; |
139 | print <<EOF; |
90 | |
140 | |
91 | |
141 | |
92 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
142 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
93 | |
143 | |
94 | Similarly to the epoll backend above, EV can take advantage of kqueue on |
144 | Similarly to the epoll backend above, EV can take advantage of kqueue |
95 | many BSD systems (it seems to be broken on Mac OS X though). The kqueue |
145 | on many BSD systems (it seems to be broken on Mac OS X though, but what |
96 | backend has not been tested, however, so it is disabled by default. Please |
146 | isn't broken on that shoddy platform... ah yes, the cash gushing by apple, |
97 | test (and preferably fix) the kqueue backend when you have a machine |
147 | selling defective software works perfectly there). Support for kqueue will |
98 | supporting it. Support for kqueue will be detected at runtime, with a |
148 | be detected at runtime, with a safe fallback to other methods when it |
99 | safe fallback to other methods when it cannot be used. |
149 | cannot be used. |
100 | |
150 | |
101 | EOF |
151 | EOF |
102 | |
152 | |
103 | if (prompt ("Enable kqueue backend (y/n)?", (-e "/usr/include/sys/event.h") ? "y" : "n") =~ /[yY]/) { |
153 | if (prompt ("Enable kqueue backend (y/n)?", (-e "/usr/include/sys/event.h") ? "y" : "n") =~ /[yY]/) { |
104 | $DEFINE .= " -DEV_USE_KQUEUE"; |
154 | $DEFINE .= " -DEV_USE_KQUEUE"; |
|
|
155 | } |
|
|
156 | |
|
|
157 | print <<EOF; |
|
|
158 | |
|
|
159 | |
|
|
160 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
|
|
161 | |
|
|
162 | Similarly to the kqueue backend above, EV can take advantage of the |
|
|
163 | solaris 10 port interface. Support for port will be detected at runtime, |
|
|
164 | with a safe fallback to other methods when it cannot be used. |
|
|
165 | |
|
|
166 | EOF |
|
|
167 | |
|
|
168 | if (prompt ("Enable port backend (y/n)?", (-e "/usr/include/sys/port.h") ? "y" : "n") =~ /[yY]/) { |
|
|
169 | $DEFINE .= " -DEV_USE_PORT"; |
105 | } |
170 | } |
106 | |
171 | |
107 | print <<EOF; |
172 | print <<EOF; |
108 | |
173 | |
109 | |
174 | |
… | |
… | |
123 | |
188 | |
124 | |
189 | |
125 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
190 | *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
126 | |
191 | |
127 | EOF |
192 | EOF |
|
|
193 | |
|
|
194 | my @anyevent = eval { require AnyEvent; $AnyEvent::VERSION < 2.6 } ? (AnyEvent => 2.6) : (); |
128 | |
195 | |
129 | WriteMakefile( |
196 | WriteMakefile( |
130 | dist => { |
197 | dist => { |
131 | 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 . ;', |
132 | COMPRESS => 'gzip -9v', |
199 | COMPRESS => 'gzip -9v', |
… | |
… | |
139 | }, |
206 | }, |
140 | INC => "-Ilibev", |
207 | INC => "-Ilibev", |
141 | DEFINE => "$DEFINE", |
208 | DEFINE => "$DEFINE", |
142 | NAME => "EV", |
209 | NAME => "EV", |
143 | LIBS => [$LIBS], |
210 | LIBS => [$LIBS], |
|
|
211 | PREREQ_PM => { |
|
|
212 | @anyevent, |
|
|
213 | }, |
144 | VERSION_FROM => "EV.pm", |
214 | VERSION_FROM => "EV.pm", |
145 | PM => { |
215 | PM => { |
146 | 'EV.pm' => '$(INST_LIBDIR)/EV.pm', |
216 | 'EV.pm' => '$(INST_LIBDIR)/EV.pm', |
147 | 'EV/DNS.pm' => '$(INST_LIBDIR)/EV/DNS.pm', |
217 | 'EV/DNS.pm' => '$(INST_LIBDIR)/EV/DNS.pm', |
148 | 'EV/EVAPI.h' => '$(INST_LIBDIR)/EV/EVAPI.h', |
218 | 'EV/EVAPI.h' => '$(INST_LIBDIR)/EV/EVAPI.h', |