summaryrefslogtreecommitdiff
path: root/deps/libev/wscript
blob: 27b1f01f2aac5ec8ae013e8b904bacc21f8f4bd9 (plain)
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
56
57
58
59
import Options

def set_options(opt):
  pass
  #opt.tool_options('compiler_cc')

def configure(conf):
  print "--- libev ---"
  #conf.check_tool('compiler_cc')

  conf.check_cc(header_name="sys/inotify.h")
  conf.check_cc(header_name="sys/epoll.h")
  conf.check_cc(header_name="sys/event.h")
  conf.check_cc(header_name="sys/queue.h")
  conf.check_cc(header_name="port.h")
  conf.check_cc(header_name="poll.h")
  conf.check_cc(header_name="sys/select.h")
  conf.check_cc(header_name="sys/eventfd.h")
  conf.check_cc(header_name="sys/inotify.h", function_name="inotify_init")
  conf.check_cc(header_name="sys/epoll.h", function_name="epoll_ctl")
  conf.check_cc(header_name="sys/queue.h", function_name="kqueue")
  conf.check_cc(header_name="port.h", function_name="port_create")
  conf.check_cc(header_name="poll.h", function_name="poll")
  conf.check_cc(header_name="sys/select.h", function_name="select")
  conf.check_cc(header_name="sys/eventfd.h", function_name="eventfd")
  code = """
      #include <syscall.h>
      #include <time.h>
      #include <stdio.h>

      int main() {
          struct timespec ts; 
          int status = syscall(SYS_clock_gettime, CLOCK_REALTIME, &ts);
          puts("1"); // fucking waf...
          return 0;
      }
  """
  conf.check_cc(fragment=code, define_name="HAVE_CLOCK_SYSCALL", execute=True,
                msg="Checking for SYS_clock_gettime")

  conf.check_cc(lib="rt", header_name="time.h", function_name="clock_gettime")
  conf.check_cc(lib="rt", header_name="time.h", function_name="nanosleep")
  conf.check_cc(lib="m", header_name="math.h", function_name="ceil")

  conf.define("HAVE_CONFIG_H", 1)

  conf.env.append_value('CCFLAGS', ['-DEV_MULTIPLICITY=0'])
  conf.env.append_value('CXXFLAGS', ['-DEV_MULTIPLICITY=0'])

def build(bld):
  libev = bld.new_task_gen("cc", "staticlib")
  libev.source = 'ev.c'
  libev.target = 'ev'
  libev.name = 'ev'
  libev.includes = '. ../..'
  libev.install_path = None
  if bld.env["USE_DEBUG"]:
    libev.clone("debug");