summaryrefslogtreecommitdiff
path: root/ext/pty/extconf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pty/extconf.rb')
-rw-r--r--ext/pty/extconf.rb21
1 files changed, 17 insertions, 4 deletions
diff --git a/ext/pty/extconf.rb b/ext/pty/extconf.rb
index 5e126fe0cf..ae2cb45d3c 100644
--- a/ext/pty/extconf.rb
+++ b/ext/pty/extconf.rb
@@ -1,15 +1,28 @@
+# frozen_string_literal: true
require 'mkmf'
-if /mswin32|mingw|bccwin32/ !~ RUBY_PLATFORM
+$INCFLAGS << " -I$(topdir) -I$(top_srcdir)"
+
+if /mswin|mingw|bccwin/ !~ RUBY_PLATFORM
have_header("sys/stropts.h")
have_func("setresuid")
have_header("libutil.h")
have_header("pty.h")
- have_library("util", "openpty")
- if have_func("openpty") or
+ have_header("pwd.h")
+ if /openbsd/ =~ RUBY_PLATFORM
+ have_header("util.h") # OpenBSD openpty
+ util = have_library("util", "openpty")
+ end
+ openpt = have_func("posix_openpt")
+ if openpt
+ have_func("ptsname_r") or have_func("ptsname")
+ end
+ if openpt or
+ (util or have_func("openpty")) or
have_func("_getpty") or
- have_func("ptsname") or
have_func("ioctl")
+ have_macro("HAVE_FCHMOD") or have_func("fchmod")
+ have_macro("HAVE_FCHOWN") or have_func("fchown")
create_makefile('pty')
end
end