summaryrefslogtreecommitdiff
path: root/ext/etc/extconf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/etc/extconf.rb')
-rw-r--r--ext/etc/extconf.rb20
1 files changed, 14 insertions, 6 deletions
diff --git a/ext/etc/extconf.rb b/ext/etc/extconf.rb
index b6ae7700da..2e28d58037 100644
--- a/ext/etc/extconf.rb
+++ b/ext/etc/extconf.rb
@@ -43,14 +43,22 @@ have_struct_member('struct group', 'gr_passwd', 'grp.h')
# for https://github.com/ruby/etc
srcdir = File.expand_path("..", __FILE__)
-if !File.exist?("#{srcdir}/depend")
- %x[#{RbConfig.ruby} #{srcdir}/mkconstants.rb -o #{srcdir}/constdefs.h]
+constdefs = "#{srcdir}/constdefs.h"
+if !File.exist?(constdefs)
+ ruby = RbConfig.ruby
+ if File.file?(ruby)
+ ruby = [ruby]
+ else
+ require "shellwords"
+ ruby = Shellwords.split(ruby)
+ end
+ system(*ruby, "#{srcdir}/mkconstants.rb", "-o", constdefs)
end
-decl = [
- "void rb_deprecate_constant(VALUE, const char *);",
-]
-have_func('rb_deprecate_constant(Qnil, "None")', [decl])
+# TODO: remove when dropping 2.7 support, as exported since 3.0
+have_func('rb_deprecate_constant(Qnil, "None")')
+
+have_func("rb_io_descriptor")
$distcleanfiles << "constdefs.h"