2 $CPPFLAGS << ' -D_GNU_SOURCE'
3 $CPPFLAGS << ' -DPOSIX_C_SOURCE=1'
4 $CPPFLAGS += '-D_POSIX_C_SOURCE=200112L'
5 unless have_macro('CLOCK_MONOTONIC', 'time.h')
6 have_func('CLOCK_MONOTONIC', 'time.h')
8 have_type('clockid_t', 'time.h')
9 have_library('rt', 'clock_gettime', 'time.h')
10 have_func("poll", "poll.h")
11 have_func("getaddrinfo", %w(sys/types.h sys/socket.h netdb.h)) or
12 abort "getaddrinfo required"
13 have_func("getnameinfo", %w(sys/types.h sys/socket.h netdb.h)) or
14 abort "getnameinfo required"
15 have_type("struct sockaddr_storage", %w(sys/types.h sys/socket.h)) or
16 abort "struct sockaddr_storage required"
17 have_func('accept4', %w(sys/socket.h))
18 if have_header('ruby/io.h')
19 rubyio = %w(ruby.h ruby/io.h)
20 have_struct_member("rb_io_t", "fd", rubyio)
21 have_struct_member("rb_io_t", "mode", rubyio)
22 have_struct_member("rb_io_t", "pathv", rubyio)
24 rubyio = %w(ruby.h rubyio.h)
25 rb_io_t = have_type("OpenFile", rubyio) ? "OpenFile" : "rb_io_t"
26 have_struct_member(rb_io_t, "f", rubyio)
27 have_struct_member(rb_io_t, "f2", rubyio)
28 have_struct_member(rb_io_t, "mode", rubyio)
29 have_struct_member(rb_io_t, "path", rubyio)
30 have_func('rb_fdopen')
32 have_type("struct RFile", rubyio) and check_sizeof("struct RFile", rubyio)
33 have_type("struct RObject") and check_sizeof("struct RObject")
35 have_func('rb_io_ascii8bit_binmode')
36 have_func('rb_thread_blocking_region')
37 have_func('rb_thread_io_blocking_region')
38 have_func('rb_str_set_len')
40 create_makefile('kgio_ext')