require 'mkmf'
target = "io/wait"

unless /djgpp|mswin|mingw|human/ =~ RUBY_PLATFORM
  fionread = %w[sys/ioctl.h sys/filio.h].find do |h|
    have_func("FIONREAD", h)
  end
  exit 1 unless fionread
  $defs << "-DFIONREAD_HEADER=\"<#{fionread}>\""
  create_makefile(target)
end
