use rb_str_subseq for tail string on write
[kgio.git] / ext / kgio / extconf.rb
blobf6bd0ccb628c5ab9e966c544a13704fb58b1c6e6
1 require 'mkmf'
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')
7 end
8 have_type('clockid_t', 'time.h')
9 have_library('rt', 'clock_gettime', 'time.h')
11 # taken from ext/socket/extconf.rb in ruby/trunk:
12 # OpenSolaris:
13 have_library("nsl", "t_open")
14 have_library("socket", "socket")
16 have_func("poll", "poll.h")
17 have_func("getaddrinfo", %w(sys/types.h sys/socket.h netdb.h)) or
18   abort "getaddrinfo required"
19 have_func("getnameinfo", %w(sys/types.h sys/socket.h netdb.h)) or
20   abort "getnameinfo required"
21 have_type("struct sockaddr_storage", %w(sys/types.h sys/socket.h)) or
22   abort "struct sockaddr_storage required"
23 have_func('accept4', %w(sys/socket.h))
24 have_header("sys/select.h")
26 if have_header('ruby/io.h')
27   rubyio = %w(ruby.h ruby/io.h)
28   have_struct_member("rb_io_t", "fd", rubyio)
29   have_struct_member("rb_io_t", "mode", rubyio)
30   have_struct_member("rb_io_t", "pathv", rubyio)
31 else
32   rubyio = %w(ruby.h rubyio.h)
33   rb_io_t = have_type("OpenFile", rubyio) ? "OpenFile" : "rb_io_t"
34   have_struct_member(rb_io_t, "f", rubyio)
35   have_struct_member(rb_io_t, "f2", rubyio)
36   have_struct_member(rb_io_t, "mode", rubyio)
37   have_struct_member(rb_io_t, "path", rubyio)
38   have_func('rb_fdopen')
39 end
40 have_type("struct RFile", rubyio) and check_sizeof("struct RFile", rubyio)
41 have_type("struct RObject") and check_sizeof("struct RObject")
42 check_sizeof("int")
43 have_func('rb_io_ascii8bit_binmode')
44 have_func('rb_update_max_fd')
45 have_func('rb_fd_fix_cloexec')
46 have_func('rb_cloexec_open')
47 have_func('rb_thread_blocking_region')
48 have_func('rb_thread_io_blocking_region')
49 have_func('rb_str_set_len')
50 have_func('rb_time_interval')
51 have_func('rb_wait_for_single_fd')
52 have_func('rb_str_subseq')
54 create_makefile('kgio_ext')