From 5f1faf1416b1e229a423311609ee34da79e60425 Mon Sep 17 00:00:00 2001 From: "W.C.A. Wijngaards" Date: Thu, 22 Aug 2024 12:26:08 +0200 Subject: [PATCH] For cross platform build, patch up simdzone to test bswap declarations. --- .github/workflows/analysis_ports.yml | 67 +++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/.github/workflows/analysis_ports.yml b/.github/workflows/analysis_ports.yml index bae4b2c4..073c82ce 100644 --- a/.github/workflows/analysis_ports.yml +++ b/.github/workflows/analysis_ports.yml @@ -45,7 +45,7 @@ jobs: cross_platform_os: "netbsd" cross_platform_arch: "x86-64" cross_platform_version: "10.0" - cross_platform_config: "--enable-checking --disable-flto --with-libevent=no CFLAGS=-D__NO_INLINE__" + cross_platform_config: "--enable-checking --disable-flto --with-libevent=no" steps: - uses: actions/checkout@v4 @@ -70,6 +70,71 @@ jobs: if test "$CROSS_PLATFORM_OS" = "openbsd"; then sudo pkg_add autoconf-2.71 libtool libevent; export AUTOCONF_VERSION="2.71"; fi if test "$CROSS_PLATFORM_OS" = "netbsd"; then sudo pkgin -y install autoconf libtool; fi echo "::group::configure" + echo "patch up simdzone for test" +cat < header file.])) ++AC_CHECK_HEADERS([endian.h sys/endian.h],,, [AC_INCLUDES_DEFAULT]) ++AC_CHECK_DECLS([bswap16,bswap32,bswap64], [], [], [ ++AC_INCLUDES_DEFAULT ++#ifdef HAVE_ENDIAN_H ++#include ++#endif ++#ifdef HAVE_SYS_ENDIAN_H ++#include ++#endif ++]) + + AC_ARG_ENABLE(westmere, AS_HELP_STRING([--disable-westmere],[Disable Westmere (SSE4.2) kernel])) + case "$enable_westmere" in +diff --git a/src/generic/endian.h b/src/generic/endian.h +index 7c9fdb3..f14bdb7 100644 +--- a/src/generic/endian.h ++++ b/src/generic/endian.h +@@ -122,6 +122,7 @@ + # endif + #endif + ++#if !HAVE_DECL_BSWAP16 + static really_inline uint16_t bswap16(uint16_t x) + { + // Copied from src/common/lib/libc/gen/bswap16.c in NetBSD +@@ -129,7 +130,9 @@ static really_inline uint16_t bswap16(uint16_t x) + // Public domain. + return ((x << 8) & 0xff00) | ((x >> 8) & 0x00ff); + } ++#endif + ++#if !HAVE_DECL_BSWAP32 + static really_inline uint32_t bswap32(uint32_t x) + { + // Copied from src/common/lib/libc/gen/bswap32.c in NetBSD +@@ -140,7 +143,9 @@ static really_inline uint32_t bswap32(uint32_t x) + ( (x >> 8) & 0x0000ff00 ) | + ( (x >> 24) & 0x000000ff ); + } ++#endif + ++#if !HAVE_DECL_BSWAP64 + static really_inline uint64_t bswap64(uint64_t x) + { + // Copied from src/common/lib/libc/gen/bswap64.c in NetBSD +@@ -155,6 +160,7 @@ static really_inline uint64_t bswap64(uint64_t x) + ( (x >> 40) & 0x000000000000ff00ull ) | + ( (x >> 56) & 0x00000000000000ffull ); + } ++#endif + + # if BYTE_ORDER == LITTLE_ENDIAN + # define htobe(bits, x) bswap ## bits((x)) +EOF autoconf && autoheader (cd simdzone && autoconf && autoheader) libtoolize -c -i || glibtoolize -c -i