blob: 0c1a8704745124111fb9ecd6feda5b6a59c8917e (
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
|
require 'mkmf'
target = "io/wait"
unless defined?(checking_for)
def checking_for(msg)
STDOUT.print "checking for ", msg, "..."
STDOUT.flush
STDOUT.puts((r = yield) ? "yes" : "no")
r
end
end
unless defined?(macro_defined?)
def macro_defined?(macro, src, opt="")
try_cpp(src + <<"SRC", opt)
#ifndef #{macro}
# error
#endif
SRC
end
end
unless /djgpp|mswin|mingw|human/ =~ RUBY_PLATFORM
fionread = %w[sys/ioctl.h sys/filio.h].find do |h|
checking_for("FIONREAD") {macro_defined?("FIONREAD", "#include <#{h}>\n")}
end
exit 1 unless fionread
$defs << "-DFIONREAD_HEADER=\"<#{fionread}>\""
create_makefile(target)
end
|