diff options
Diffstat (limited to 'ext/io/console/extconf.rb')
-rw-r--r-- | ext/io/console/extconf.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/ext/io/console/extconf.rb b/ext/io/console/extconf.rb index 32ad9d3311..6161b747b5 100644 --- a/ext/io/console/extconf.rb +++ b/ext/io/console/extconf.rb @@ -1,7 +1,25 @@ # frozen_string_literal: false require 'mkmf' -ok = true if RUBY_ENGINE == "ruby" +# `--target-rbconfig` compatibility for Ruby 3.3 or earlier +# See https://bugs.ruby-lang.org/issues/20345 +MakeMakefile::RbConfig ||= ::RbConfig + +have_func("rb_io_path") +have_func("rb_io_descriptor") +have_func("rb_io_get_write_io") +have_func("rb_io_closed_p") +have_func("rb_io_open_descriptor") +have_func("rb_ractor_local_storage_value_newkey") + +is_wasi = /wasi/ =~ MakeMakefile::RbConfig::CONFIG["platform"] +# `ok` can be `true`, `false`, or `nil`: +# * `true` : Required headers and functions available, proceed regular build. +# * `false`: Required headers or functions not available, abort build. +# * `nil` : Unsupported compilation target, generate dummy Makefile. +# +# Skip building io/console on WASI, as it does not support termios.h. +ok = true if (RUBY_ENGINE == "ruby" && !is_wasi) || RUBY_ENGINE == "truffleruby" hdr = nil case when macro_defined?("_WIN32", "") @@ -29,7 +47,6 @@ when true elsif have_func("rb_scheduler_timeout") # 3.0 have_func("rb_io_wait") end - $defs << "-D""ENABLE_IO_GETPASS=1" create_makefile("io/console") {|conf| conf << "\n""VK_HEADER = #{vk_header}\n" } |