summaryrefslogtreecommitdiff
path: root/ext/json/parser
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2025-06-29 12:04:34 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2025-06-30 12:56:50 +0900
commitbc334be4db8b933974e5ff3fef45333aec93ec74 (patch)
tree06a00c320699ea9cc6eef12b46c945c623e76b81 /ext/json/parser
parent50b6cd409aa9e05f72b79b2d47e17e0df2660166 (diff)
[ruby/json] Reduce duplication in extconf.rb
https://github.com/ruby/json/commit/3ae3eeb9d3
Diffstat (limited to 'ext/json/parser')
-rw-r--r--ext/json/parser/extconf.rb28
1 files changed, 2 insertions, 26 deletions
diff --git a/ext/json/parser/extconf.rb b/ext/json/parser/extconf.rb
index eca4d8c108..0b62fd6135 100644
--- a/ext/json/parser/extconf.rb
+++ b/ext/json/parser/extconf.rb
@@ -9,31 +9,7 @@ have_func("strnlen", "string.h") # Missing on Solaris 10
append_cflags("-std=c99")
if enable_config('parser-use-simd', default=!ENV["JSON_DISABLE_SIMD"])
- if RbConfig::CONFIG['host_cpu'] =~ /^(arm.*|aarch64.*)/
- # Try to compile a small program using NEON instructions
- if have_header('arm_neon.h')
- have_type('uint8x16_t', headers=['arm_neon.h']) && try_compile(<<~'SRC')
- #include <arm_neon.h>
- int main() {
- uint8x16_t test = vdupq_n_u8(32);
- return 0;
- }
- SRC
- $defs.push("-DJSON_ENABLE_SIMD")
- end
- end
-
- if have_header('x86intrin.h') && have_type('__m128i', headers=['x86intrin.h']) && try_compile(<<~'SRC')
- #include <x86intrin.h>
- int main() {
- __m128i test = _mm_set1_epi8(32);
- return 0;
- }
- SRC
- $defs.push("-DJSON_ENABLE_SIMD")
- end
-
- have_header('cpuid.h')
- end
+ require_relative "../simd/conf.rb"
+end
create_makefile 'json/ext/parser'