diff options
Diffstat (limited to 'ext/json/parser/extconf.rb')
| -rw-r--r-- | ext/json/parser/extconf.rb | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/ext/json/parser/extconf.rb b/ext/json/parser/extconf.rb index 4a10dd2ed6..a9d740c755 100644 --- a/ext/json/parser/extconf.rb +++ b/ext/json/parser/extconf.rb @@ -1,10 +1,21 @@ +# frozen_string_literal: true require 'mkmf' -require 'rbconfig' -if RUBY_VERSION < "1.9" - have_header("re.h") -else - have_header("ruby/re.h") - have_header("ruby/encoding.h") +$defs << "-DJSON_DEBUG" if ENV.fetch("JSON_DEBUG", "0") != "0" +have_func("rb_enc_interned_str", "ruby/encoding.h") # RUBY_VERSION >= 3.0 +have_func("rb_str_to_interned_str", "ruby.h") # RUBY_VERSION >= 3.0 +have_func("rb_hash_new_capa", "ruby.h") # RUBY_VERSION >= 3.2 +have_func("rb_hash_bulk_insert", "ruby.h") # Missing on TruffleRuby +have_func("ruby_xfree_sized", "ruby.h") # RUBY_VERSION >= 4.1 + +if RUBY_ENGINE == "ruby" + have_const("RUBY_TYPED_EMBEDDABLE", "ruby.h") # RUBY_VERSION >= 3.3 end + +append_cflags("-std=c99") + +if enable_config('parser-use-simd', default=!ENV["JSON_DISABLE_SIMD"]) + load __dir__ + "/../simd/conf.rb" +end + create_makefile 'json/ext/parser' |
