From 360ebe28af6ce90f622175efd980b9c8774d319f Mon Sep 17 00:00:00 2001 From: phk Date: Tue, 25 Nov 2008 12:02:10 +0000 Subject: [PATCH] Try to get the endianess optimization working, by including an assortment of possibly relevant headers and only go with the fast path if we have credible information that this is a big-endian platform. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@3439 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/configure.ac | 2 ++ varnish-cache/lib/libvarnish/vsha256.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/varnish-cache/configure.ac b/varnish-cache/configure.ac index b32f64bd..853a6fc6 100644 --- a/varnish-cache/configure.ac +++ b/varnish-cache/configure.ac @@ -70,11 +70,13 @@ AC_SUBST(LIBM) AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_HEADER_TIME +AC_CHECK_HEADERS([sys/endian.h]) AC_CHECK_HEADERS([sys/filio.h]) AC_CHECK_HEADERS([sys/mount.h]) AC_CHECK_HEADERS([sys/socket.h]) AC_CHECK_HEADERS([sys/statvfs.h]) AC_CHECK_HEADERS([sys/vfs.h]) +AC_CHECK_HEADERS([endian.h]) AC_CHECK_HEADERS([netinet/in.h]) AC_CHECK_HEADERS([pthread_np.h]) AC_CHECK_HEADERS([stddef.h]) diff --git a/varnish-cache/lib/libvarnish/vsha256.c b/varnish-cache/lib/libvarnish/vsha256.c index 99d5f281..72bd2142 100644 --- a/varnish-cache/lib/libvarnish/vsha256.c +++ b/varnish-cache/lib/libvarnish/vsha256.c @@ -26,10 +26,22 @@ * From: $FreeBSD: head/lib/libmd/sha256c.c 154479 2006-01-17 15:35:57Z phk $ */ -#include +#include "config.h" +#include #include +#ifdef HAVE_ENDIAN_H +#include +#define BYTE_ORDER __BYTE_ORDER +#define BIG_ENDIAN __BIG_ENDIAN +#endif +#ifdef HAVE_SYS_ENDIAN_H +#include +#define BYTE_ORDER _BYTE_ORDER +#define BIG_ENDIAN _BIG_ENDIAN +#endif + #include "vsha256.h" #if defined(BYTE_ORDER) && BYTE_ORDER == BIG_ENDIAN -- 2.39.5