From 19083e4f7570ff5a4c22fd24b3945c5606eb0c84 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 21 Apr 2021 12:23:14 +0200 Subject: [PATCH] build: remove deprecated AC_WORDS_BIGENDIAN Signed-off-by: David Lamparter --- configure.ac | 17 +++++++++-------- lib/sha256.c | 4 ---- lib/zebra.h | 24 +++++++++--------------- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/configure.ac b/configure.ac index 390f222bb0..d52df7335f 100755 --- a/configure.ac +++ b/configure.ac @@ -973,7 +973,7 @@ dnl ------------------------- dnl Check other header files. dnl ------------------------- AC_CHECK_HEADERS([stropts.h sys/ksym.h \ - linux/version.h asm/types.h]) + linux/version.h asm/types.h endian.h sys/endian.h]) ac_stdatomic_ok=false AC_DEFINE([FRR_AUTOCONF_ATOMIC], [1], [did autoconf checks for atomic funcs]) @@ -1266,11 +1266,6 @@ if test "$enable_realms" = "yes"; then esac fi -dnl ------------------------------- -dnl Endian-ness check -dnl ------------------------------- -AC_WORDS_BIGENDIAN - dnl --------------- dnl other functions dnl --------------- @@ -2203,8 +2198,14 @@ AC_TRY_COMPILE([#include ], [ dnl -------------------------------------- dnl checking for be32dec existence or not dnl -------------------------------------- -AC_CHECK_DECLS([be32enc, be32dec], [], [], - [#include ]) +AC_CHECK_DECLS([be32enc, be32dec], [], [], [ + #ifdef HAVE_SYS_ENDIAN_H + #include + #endif + #ifdef HAVE_ENDIAN_H + #include + #endif +]) dnl -------------------------------------- dnl checking for clock_time monotonic struct and call diff --git a/lib/sha256.c b/lib/sha256.c index 37ced5b402..a9b7a4aefc 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -35,8 +35,6 @@ static inline uint32_t be32dec(const void *pp) return ((uint32_t)(p[3]) + ((uint32_t)(p[2]) << 8) + ((uint32_t)(p[1]) << 16) + ((uint32_t)(p[0]) << 24)); } -#else -#include #endif #if !HAVE_DECL_BE32ENC @@ -49,8 +47,6 @@ static inline void be32enc(void *pp, uint32_t x) p[1] = (x >> 16) & 0xff; p[0] = (x >> 24) & 0xff; } -#else -#include #endif /* diff --git a/lib/zebra.h b/lib/zebra.h index 33364f1471..26c0fe05b5 100644 --- a/lib/zebra.h +++ b/lib/zebra.h @@ -68,6 +68,12 @@ #include #include #include +#ifdef HAVE_SYS_ENDIAN_H +#include +#endif +#ifdef HAVE_ENDIAN_H +#include +#endif /* machine dependent includes */ #ifdef HAVE_LINUX_VERSION_H @@ -280,22 +286,10 @@ struct in_pktinfo { #define HAVE_IP_HDRINCL_BSD_ORDER #endif -/* Define BYTE_ORDER, if not defined. Useful for compiler conditional - * code, rather than preprocessor conditional. - * Not all the world has this BSD define. - */ +/* autoconf macros for this are deprecated, just find endian.h */ #ifndef BYTE_ORDER -#define BIG_ENDIAN 4321 /* least-significant byte first (vax, pc) */ -#define LITTLE_ENDIAN 1234 /* most-significant byte first (IBM, net) */ -#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */ - -#if defined(WORDS_BIGENDIAN) -#define BYTE_ORDER BIG_ENDIAN -#else /* !WORDS_BIGENDIAN */ -#define BYTE_ORDER LITTLE_ENDIAN -#endif /* WORDS_BIGENDIAN */ - -#endif /* ndef BYTE_ORDER */ +#error please locate an endian.h file appropriate to your platform +#endif /* For old definition. */ #ifndef IN6_ARE_ADDR_EQUAL -- 2.39.5