ruby/ext/json/generator/extconf.rb
Jean Boussier 8fefa5537c [ruby/json] Integrate with Ruby 4.1 ruby_sized_xfree
Ensure that buffer sizes have been properly tracked when running
in debug mode, and appease the GC slightly when running in release
mode.

Ref: https://bugs.ruby-lang.org/issues/21861

https://github.com/ruby/json/commit/90354007ea
2026-06-03 07:33:28 +00:00

20 lines
622 B
Ruby

require 'mkmf'
if RUBY_ENGINE == 'truffleruby'
# The pure-Ruby generator is faster on TruffleRuby, so skip compiling the generator extension
File.write('Makefile', dummy_makefile("").join)
else
append_cflags("-std=c99")
have_const("RUBY_TYPED_EMBEDDABLE", "ruby.h") # RUBY_VERSION >= 3.3
have_func("ruby_xfree_sized", "ruby.h") # RUBY_VERSION >= 4.1
$defs << "-DJSON_GENERATOR"
$defs << "-DJSON_DEBUG" if ENV.fetch("JSON_DEBUG", "0") != "0"
if enable_config('generator-use-simd', default=!ENV["JSON_DISABLE_SIMD"])
load __dir__ + "/../simd/conf.rb"
end
create_makefile 'json/ext/generator'
end