From: Donald Sharp Date: Thu, 27 Apr 2017 01:46:10 +0000 (-0400) Subject: lib: Fix compilation of some be32* code X-Git-Tag: reindent-master-before~197^2~6 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=ba0cb3fe960d8653cbbc2358f4e392417af4d98a;p=mirror%2Ffrr.git lib: Fix compilation of some be32* code The be32dec and be32enc functions are available on some platforms and not others. Signed-off-by: Donald Sharp --- diff --git a/configure.ac b/configure.ac index f586e560ed..4f0dcdf859 100755 --- a/configure.ac +++ b/configure.ac @@ -1602,6 +1602,12 @@ AC_TRY_COMPILE([#include ], [ AC_MSG_RESULT(no) ]) +dnl -------------------------------------- +dnl checking for be32dec existence or not +dnl -------------------------------------- +AC_CHECK_DECLS([be32enc, be32dec], [], [], + [#include ]) + dnl -------------------------------------- dnl checking for clock_time monotonic struct and call dnl -------------------------------------- diff --git a/lib/sha256.c b/lib/sha256.c index 4a933875f8..a0c6eac420 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -27,7 +27,7 @@ #include #include "sha256.h" -#ifdef GNU_LINUX +#if !HAVE_DECL_BE32DEC static inline uint32_t be32dec(const void *pp) { @@ -36,7 +36,9 @@ be32dec(const void *pp) return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) + ((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24)); } +#endif +#if !HAVE_DECL_BE32ENC static inline void be32enc(void *pp, uint32_t x) {