From 73e921b86299a9c0066f34e22ccf90f1b69b4589 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sun, 30 Dec 2012 13:10:47 +1100 Subject: [PATCH] Check endianness of build with autotools to enable md5 support on more platforms. --- configure.ac | 2 ++ lrzip_private.h | 15 ++++++++++++++- md5.c | 3 ++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 0bdb0f0..a96422f 100644 --- a/configure.ac +++ b/configure.ac @@ -109,6 +109,8 @@ fi AC_C_INLINE +AC_C_BIGENDIAN + AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR([Could not find pthread library - please install libpthread])) AC_CHECK_LIB(m, sqrt, , diff --git a/lrzip_private.h b/lrzip_private.h index 1b17e8b..2b8b241 100644 --- a/lrzip_private.h +++ b/lrzip_private.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2006-2011 Con Kolivas + Copyright (C) 2006-2012 Con Kolivas Copyright (C) 2011 Peter Hyman Copyright (C) 1998-2003 Andrew Tridgell @@ -60,6 +60,19 @@ extern "C" void *alloca (size_t); #endif +#ifdef HAVE_ENDIAN_H +# include +#elif HAVE_SYS_ENDIAN_H +# include +#endif +#ifndef __BYTE_ORDER +# ifdef WORDS_BIGENDIAN +# define __BYTE_ORDER __BIG_ENDIAN +# else +# define __BYTE_ORDER __LITTLE_ENDIAN +# endif +#endif + #ifndef MD5_DIGEST_SIZE # define MD5_DIGEST_SIZE 16 #endif diff --git a/md5.c b/md5.c index 72d4fcd..2906063 100644 --- a/md5.c +++ b/md5.c @@ -1,5 +1,5 @@ /* - Copyright (C) 2011 Con Kolivas + Copyright (C) 2012 Con Kolivas Copyright (C) 1995-2011 Ulrich Drepper. Functions to compute MD5 message digest of files or memory blocks. @@ -30,6 +30,7 @@ #include +#include "lrzip_private.h" #include "md5.h" #if USE_UNLOCKED_IO