From 0bbd78dfad9e64f129c6a29dd8e766b23ac0707a Mon Sep 17 00:00:00 2001 From: Leonardo Alminana Date: Wed, 21 Aug 2024 16:16:10 +0200 Subject: [PATCH] build: added cpu byte order detection (same as msgpack-c) Signed-off-by: Leonardo Alminana --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2018e4f52c9..e2e9fbf3b04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,6 +88,7 @@ elseif(FLB_SYSTEM_FREEBSD) set(WAMR_DISABLE_STACK_HW_BOUND_CHECK 1) endif() +INCLUDE(TestBigEndian) include(GNUInstallDirs) include(ExternalProject) include(cmake/FindJournald.cmake) @@ -772,6 +773,15 @@ if(FLB_HAVE_UNIX_SOCKET) FLB_DEFINITION(FLB_HAVE_UNIX_SOCKET) endif() +# byte order detection +test_big_endian(BIG_ENDIAN_SYSTEM_DETECTED) + +if (BIG_ENDIAN_SYSTEM_DETECTED) + FLB_DEFINITION(FLB_HAVE_BIG_ENDIAN_SYSTEM) +else() + FLB_DEFINITION(FLB_HAVE_LITTLE_ENDIAN_SYSTEM) +endif () + # Configuration file YAML format support if(FLB_CONFIG_YAML) find_package(PkgConfig)