From f26621c4efd20b06aa559f1c85e3b2e9bca52228 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 8 Jan 2021 11:01:38 -0500 Subject: [PATCH] Check for little endian in extconf.rb --- ext/liquid_c/extconf.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/liquid_c/extconf.rb b/ext/liquid_c/extconf.rb index 6d823c9b..b860a7bc 100644 --- a/ext/liquid_c/extconf.rb +++ b/ext/liquid_c/extconf.rb @@ -1,5 +1,11 @@ # frozen_string_literal: true require 'mkmf' + +# if system endianness == network endianness (big endian) +if [1].pack('I') == [1].pack('N') + raise 'System incompatible with liquid-c, only little endian systems supported' +end + $CFLAGS << ' -std=c11 -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers' append_cflags('-fvisibility=hidden') # In Ruby 2.6 and earlier, the Ruby headers did not have struct timespec defined