summaryrefslogtreecommitdiff
path: root/ext/io/nonblock/extconf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/io/nonblock/extconf.rb')
-rw-r--r--ext/io/nonblock/extconf.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/io/nonblock/extconf.rb b/ext/io/nonblock/extconf.rb
new file mode 100644
index 0000000000..505c9e6252
--- /dev/null
+++ b/ext/io/nonblock/extconf.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: false
+require 'mkmf'
+target = "io/nonblock"
+
+unless RUBY_ENGINE == 'ruby'
+ File.write("Makefile", dummy_makefile($srcdir).join(""))
+ return
+end
+
+have_func("rb_io_descriptor", "ruby/io.h")
+
+hdr = %w"fcntl.h"
+if have_macro("O_NONBLOCK", hdr) and
+ (have_macro("F_GETFL", hdr) or have_macro("F_SETFL", hdr))
+ create_makefile(target)
+end