]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: Fix compilation of some be32* code
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 27 Apr 2017 01:46:10 +0000 (21:46 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 27 Apr 2017 01:46:10 +0000 (21:46 -0400)
The be32dec and be32enc functions are available on some
platforms and not others.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
configure.ac
lib/sha256.c

index f586e560edbcaadf67992ed5cae16d99c6ca780c..4f0dcdf859bb1aa45a9335b7f27c3e310da1c377 100755 (executable)
@@ -1602,6 +1602,12 @@ AC_TRY_COMPILE([#include <netinet/in.h>], [
   AC_MSG_RESULT(no)
 ])
 
+dnl --------------------------------------
+dnl checking for be32dec existence or not
+dnl --------------------------------------
+AC_CHECK_DECLS([be32enc, be32dec], [], [],
+              [#include <sys/endian.h>])
+
 dnl --------------------------------------
 dnl checking for clock_time monotonic struct and call
 dnl --------------------------------------
index 4a933875f8d7ad09fc2c9668d11081ee2501a139..a0c6eac4200dc771f0d9aca23741ebeedf26eb3f 100644 (file)
@@ -27,7 +27,7 @@
 #include <zebra.h>
 #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)
 {