summaryrefslogtreecommitdiff
path: root/www/node04/files/patch-libev-kqueue
blob: cdc01a94564397760f7df54bdbcf4b97b9a6c34f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
--- deps/libev/wscript.orig	2010-04-10 08:05:03.000000000 +0800
+++ deps/libev/wscript	2010-04-13 09:28:42.000000000 +0800
@@ -2,6 +2,7 @@ import Options
 import platform
 
 PLATFORM_IS_DARWIN = platform.platform().find('Darwin') == 0
+PLATFORM_IS_FREEBSD = platform.platform().find('FreeBSD') == 0
 
 def set_options(opt):
   pass
@@ -27,12 +28,30 @@ def configure(conf):
   if conf.check_cc(header_name="poll.h"):
     conf.check_cc(header_name="poll.h", function_name="poll")
 
-  conf.check_cc(header_name="sys/event.h")
   conf.check_cc(header_name="sys/queue.h")
-  if PLATFORM_IS_DARWIN:
-    conf.check_cc(header_name="sys/event.h", function_name="kqueue")
-  else:
-    conf.check_cc(header_name="sys/queue.h", function_name="kqueue")
+
+  code = """
+      #include <sys/types.h>
+      #include <sys/event.h>
+
+      int main() {
+	  return 0;
+      }
+  """
+  conf.check_cc(fragment=code, define_name="HAVE_SYS_EVENT_H", execute=False,
+                msg="Checking for header sys/event.h")
+
+  code = """
+      #include <sys/types.h>
+      #include <sys/event.h>
+
+      int main() {
+	  int fd = kqueue();
+	  return 0;
+      }
+  """
+  conf.check_cc(fragment=code, define_name="HAVE_KQUEUE", execute=False,
+                msg="Checking for function kqueue")
 
   if conf.check_cc(header_name="sys/select.h"):
     conf.check_cc(header_name="sys/select.h", function_name="select")
@@ -58,7 +77,7 @@ def configure(conf):
   have_librt = conf.check(lib='rt', uselib_store='RT')
   if have_librt:
     conf.check_cc(lib="rt", header_name="time.h", function_name="clock_gettime")
-  if PLATFORM_IS_DARWIN:
+  if PLATFORM_IS_DARWIN or PLATFORM_IS_FREEBSD:
     conf.check_cc(header_name="time.h", function_name="nanosleep")
   elif have_librt:
     conf.check_cc(lib="rt", header_name="time.h", function_name="nanosleep")