From 347ab07c6245bbd65797b6712bebdb8f13a2b61c Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Wed, 16 Oct 2024 11:41:46 +0900 Subject: [PATCH] build: Don't remove --disable-endian-check. * configure.ac (WORDS_BIGENDIAN): Use the autoconf macro, instead of our own BIG_ENDIAN_HOST. (DISABLED_ENDIAN_CHECK): Keep --disable-endian-check supported. * g10/rmd160.c (transform): Use WORDS_BIGENDIAN. -- Fixes-commit: f8bf5e01f76620cc550253cc2575754872cf64aa Signed-off-by: NIIBE Yutaka --- configure.ac | 26 ++++++++++++++++++++++---- g10/rmd160.c | 2 +- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 36ff452d7..dea5cc8d8 100644 --- a/configure.ac +++ b/configure.ac @@ -544,6 +544,19 @@ AH_BOTTOM([ #endif +/* If the configure check for endianness has been disabled, get it from + OS macros. This is intended for making fat binary builds on OS X. */ +#ifdef DISABLED_ENDIAN_CHECK +# if defined(__BIG_ENDIAN__) +# define WORDS_BIGENDIAN 1 +# elif defined(__LITTLE_ENDIAN__) +# undef WORDS_BIGENDIAN +# else +# error "No endianness found" +# endif +#endif /*DISABLED_ENDIAN_CHECK*/ + + /* Hack used for W32: ldap.m4 also tests for the ASCII version of ldap_start_tls_s because that is the actual symbol used in the library. winldap.h redefines it to our commonly used value, @@ -1319,10 +1332,15 @@ AC_MSG_NOTICE([checking for system characteristics]) AC_C_CONST AC_C_INLINE AC_C_VOLATILE -AC_C_BIGENDIAN([AC_DEFINE(BIG_ENDIAN_HOST,1, - [Defined if the host has big endian byte ordering])], - [AC_DEFINE(LITTLE_ENDIAN_HOST,1, - [Defined if the host has little endian byte ordering])]) +AC_ARG_ENABLE(endian-check, + AS_HELP_STRING([--disable-endian-check], + [disable the endian check and trust the OS provided macros]), + endiancheck=$enableval,endiancheck=yes) +if test x"$endiancheck" = xyes ; then + AC_C_BIGENDIAN +else + AC_DEFINE(DISABLED_ENDIAN_CHECK,1,[configure did not test for endianness]) +fi AC_TYPE_SIZE_T AC_TYPE_MODE_T AC_CHECK_FUNCS([sigdescr_np]) diff --git a/g10/rmd160.c b/g10/rmd160.c index cf2779641..8d5ed63de 100644 --- a/g10/rmd160.c +++ b/g10/rmd160.c @@ -86,7 +86,7 @@ static void transform (rmd160_context_t *hd, const unsigned char *data) { u32 a,b,c,d,e,aa,bb,cc,dd,ee,t; -#ifdef BIG_ENDIAN_HOST +#ifdef WORDS_BIGENDIAN u32 x[16]; { int i;