From 049d3d092c34cc8706db3689354e16da90e8fad5 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 25 Sep 2023 10:51:44 +0200 Subject: [PATCH] Use autoconf to look for the right endian.h header. Signed-off-by: Alexander Larsson --- configure.ac | 2 +- libcomposefs/lcfs-fsverity.c | 2 +- libcomposefs/lcfs-internal.h | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 2ac8ef31..1e81fc54 100644 --- a/configure.ac +++ b/configure.ac @@ -45,7 +45,7 @@ PKG_CHECK_MODULES(LCFS_DEP_CRYPTO, libcrypto,[ ]) AM_CONDITIONAL(USE_OPENSSL, test $with_openssl != no) -AC_CHECK_HEADERS([sys/capability.h]) +AC_CHECK_HEADERS([sys/capability.h endian.h sys/endian.h machine/endian.h]) AC_DEFUN([CC_CHECK_FLAG_APPEND], [ AC_CACHE_CHECK([if $CC supports flag $3 in envvar $2], diff --git a/libcomposefs/lcfs-fsverity.c b/libcomposefs/lcfs-fsverity.c index 8faab3e7..5e7a6cb1 100644 --- a/libcomposefs/lcfs-fsverity.c +++ b/libcomposefs/lcfs-fsverity.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -298,6 +297,7 @@ static void sha256_sum_close(Sha256sum *sha256, uint8_t *digest) #endif /* SHA256 fallback implementation */ +#include "lcfs-internal.h" /* for endian.h */ #include "lcfs-fsverity.h" struct fsverity_descriptor { diff --git a/libcomposefs/lcfs-internal.h b/libcomposefs/lcfs-internal.h index dd84ce55..8afe7f5b 100644 --- a/libcomposefs/lcfs-internal.h +++ b/libcomposefs/lcfs-internal.h @@ -17,7 +17,17 @@ #ifndef _LCFS_INTERNAL_H #define _LCFS_INTERNAL_H +#ifdef HAVE_MACHINE_ENDIAN_H +#include +#endif + +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif + +#ifdef HAVE_ENDIAN_H #include +#endif #include "lcfs-writer.h" #include "lcfs-fsverity.h"