2015-12-16 05:31:54 +00:00
|
|
|
# frozen_string_literal: false
|
2015-04-12 08:36:37 +00:00
|
|
|
require 'mkmf'
|
|
|
|
|
2015-04-18 06:19:52 +00:00
|
|
|
have_func("rb_enc_raise", "ruby.h")
|
2020-11-18 11:59:27 +01:00
|
|
|
have_func("rb_enc_interned_str", "ruby.h")
|
2015-04-18 06:19:52 +00:00
|
|
|
|
2020-09-09 15:24:22 +02:00
|
|
|
# checking if String#-@ (str_uminus) dedupes... '
|
|
|
|
begin
|
|
|
|
a = -(%w(t e s t).join)
|
|
|
|
b = -(%w(t e s t).join)
|
|
|
|
if a.equal?(b)
|
|
|
|
$CFLAGS << ' -DSTR_UMINUS_DEDUPE=1 '
|
|
|
|
else
|
|
|
|
$CFLAGS << ' -DSTR_UMINUS_DEDUPE=0 '
|
|
|
|
end
|
|
|
|
rescue NoMethodError
|
|
|
|
$CFLAGS << ' -DSTR_UMINUS_DEDUPE=0 '
|
|
|
|
end
|
|
|
|
|
|
|
|
# checking if String#-@ (str_uminus) directly interns frozen strings... '
|
|
|
|
begin
|
|
|
|
s = rand.to_s.freeze
|
|
|
|
if (-s).equal?(s) && (-s.dup).equal?(s)
|
|
|
|
$CFLAGS << ' -DSTR_UMINUS_DEDUPE_FROZEN=1 '
|
|
|
|
else
|
|
|
|
$CFLAGS << ' -DSTR_UMINUS_DEDUPE_FROZEN=0 '
|
|
|
|
end
|
|
|
|
rescue NoMethodError
|
|
|
|
$CFLAGS << ' -DSTR_UMINUS_DEDUPE_FROZEN=0 '
|
|
|
|
end
|
|
|
|
|
2015-04-12 08:36:37 +00:00
|
|
|
create_makefile 'json/ext/parser'
|