Skip to content

Commit fa667f7

Browse files
committed
Fix check for epoll_ctl(). Was broken on Linux
1 parent 752da03 commit fa667f7

1 file changed

Lines changed: 27 additions & 25 deletions

File tree

deps/libev/wscript

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,35 @@ def configure(conf):
1111
print "--- libev ---"
1212
#conf.check_tool('compiler_cc')
1313

14-
conf.check_cc(header_name="sys/inotify.h")
15-
have_epoll = conf.check_cc(header_name="sys/epoll.h")
16-
conf.check_cc(header_name="sys/event.h")
17-
conf.check_cc(header_name="sys/queue.h")
18-
conf.check_cc(header_name="port.h")
19-
conf.check_cc(header_name="poll.h")
20-
conf.check_cc(header_name="sys/select.h")
21-
conf.check_cc(header_name="sys/eventfd.h")
22-
conf.check_cc(header_name="sys/inotify.h", function_name="inotify_init")
23-
if have_epoll:
24-
code = """
25-
#include <sys/epoll.h>
26-
27-
int main() {
28-
epoll_ctl(0, 0, 0, NULL);
29-
return 0;
30-
}
31-
"""
32-
conf.check_cc(fragment=code, define_name="HAVE_EPOLL_CTL", msg="Checking for epoll_ctl")
14+
# Why to the two checks? One is to define HAVE_SYS_EPOLL_H
15+
# the other is to define HAVE_EPOLL_CTL
16+
# Yes, WAF is a piece of shit.
3317

34-
if PLATFORM_IS_DARWIN:
18+
if conf.check_cc(header_name="sys/inotify.h"):
19+
conf.check_cc(header_name="sys/inotify.h", function_name="inotify_init")
20+
21+
if conf.check_cc(header_name="sys/epoll.h"):
22+
conf.check_cc(header_name="sys/epoll.h", function_name="epoll_ctl")
23+
24+
if conf.check_cc(header_name="port.h"):
25+
conf.check_cc(header_name="port.h", function_name="port_create")
26+
27+
if conf.check_cc(header_name="poll.h"):
28+
conf.check_cc(header_name="poll.h", function_name="poll")
29+
30+
if conf.check_cc(header_name="sys/event.h"):
3531
conf.check_cc(header_name="sys/event.h", function_name="kqueue")
36-
else:
32+
33+
if conf.check_cc(header_name="sys/queue.h"):
3734
conf.check_cc(header_name="sys/queue.h", function_name="kqueue")
38-
conf.check_cc(header_name="port.h", function_name="port_create")
39-
conf.check_cc(header_name="poll.h", function_name="poll")
40-
conf.check_cc(header_name="sys/select.h", function_name="select")
41-
conf.check_cc(header_name="sys/eventfd.h", function_name="eventfd")
35+
36+
if conf.check_cc(header_name="sys/select.h"):
37+
conf.check_cc(header_name="sys/select.h", function_name="select")
38+
39+
if conf.check_cc(header_name="sys/eventfd.h"):
40+
conf.check_cc(header_name="sys/eventfd.h", function_name="eventfd")
41+
42+
4243
code = """
4344
#include <syscall.h>
4445
#include <time.h>
@@ -61,6 +62,7 @@ def configure(conf):
6162
conf.check_cc(header_name="time.h", function_name="nanosleep")
6263
elif have_librt:
6364
conf.check_cc(lib="rt", header_name="time.h", function_name="nanosleep")
65+
6466
conf.check_cc(lib="m", header_name="math.h", function_name="ceil")
6567

6668
conf.define("HAVE_CONFIG_H", 1)

0 commit comments

Comments
 (0)