summaryrefslogtreecommitdiff
path: root/ext/io/wait
diff options
context:
space:
mode:
Diffstat (limited to 'ext/io/wait')
-rw-r--r--ext/io/wait/extconf.rb3
-rw-r--r--ext/io/wait/wait.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/ext/io/wait/extconf.rb b/ext/io/wait/extconf.rb
index 1a0edbd846..eed3543124 100644
--- a/ext/io/wait/extconf.rb
+++ b/ext/io/wait/extconf.rb
@@ -2,8 +2,9 @@ require 'mkmf'
target = "io/wait"
unless macro_defined?("DOSISH", "#include <ruby.h>")
+ have_header(ioctl_h = "sys/ioctl.h") or ioctl_h = nil
fionread = %w[sys/ioctl.h sys/filio.h sys/socket.h].find do |h|
- have_macro("FIONREAD", h)
+ have_macro("FIONREAD", [h, ioctl_h].compact)
end
if fionread
$defs << "-DFIONREAD_HEADER=\"<#{fionread}>\""
diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c
index c073f1de30..42f5e8fc48 100644
--- a/ext/io/wait/wait.c
+++ b/ext/io/wait/wait.c
@@ -14,6 +14,9 @@
#include "ruby/io.h"
#include <sys/types.h>
+#if defined(HAVE_SYS_IOCTL_H)
+#include <sys/ioctl.h>
+#endif
#if defined(FIONREAD_HEADER)
#include FIONREAD_HEADER
#endif