From 4b74df3c1696f652f8d31d469c9447922009e190 Mon Sep 17 00:00:00 2001 From: Max Lv Date: Fri, 4 Jan 2013 15:04:45 +0800 Subject: [PATCH] update bigendian --- config.h.in | 24 ++++++++++++++++++++---- configure.ac | 21 ++++----------------- encrypt.c | 4 ++-- encrypt.h | 0 4 files changed, 26 insertions(+), 23 deletions(-) mode change 100755 => 100644 encrypt.c mode change 100755 => 100644 encrypt.h diff --git a/config.h.in b/config.h.in index 16b1e163..63ac7ac5 100644 --- a/config.h.in +++ b/config.h.in @@ -1,11 +1,14 @@ /* config.h.in. Generated from configure.ac by autoheader. */ -/* Define to 1 if system is big endian */ -#undef BIGENDIAN +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H @@ -61,8 +64,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H -/* Define to 1 if system is little endian */ -#undef LITTLEENDIAN +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR /* Name of package */ #undef PACKAGE @@ -91,6 +95,18 @@ /* Version number of package */ #undef VERSION +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus diff --git a/configure.ac b/configure.ac index 1e38aa0f..1510eb1c 100644 --- a/configure.ac +++ b/configure.ac @@ -10,30 +10,17 @@ AM_INIT_AUTOMAKE([foreign -Wall -Werror]) # Checks for programs. AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_LIBTOOL # Checks for libraries. AC_SEARCH_LIBS([MD5], [crypto], [ ], AC_MSG_ERROR([libcrypto not found.])) -AC_SEARCH_LIBS([ev_io_start], [ev], [ ], AC_MSG_ERROR([libev not found.])) +dnl AC_SEARCH_LIBS([ev_io_start], [ev], [ ], AC_MSG_ERROR([libev not found.])) # Checks for header files. AC_CHECK_HEADERS([arpa/inet.h fcntl.h langinfo.h locale.h netdb.h netinet/in.h stdlib.h string.h strings.h sys/socket.h unistd.h]) -[echo -n "checking for little or big endian... " ] -AC_TRY_RUN([ -#include -int main() -{ - uint16_t s = 1; - uint16_t* ptr = &s; - uint8_t n = *((uint8_t*)ptr); - return n; -} -] -, AC_DEFINE([BIGENDIAN], [1], [Define to 1 if system is big endian]) - [echo "big"] -, AC_DEFINE([LITTLEENDIAN], [1], [Define to 1 if system is little endian]) - [echo "little"] -) +AC_C_BIGENDIAN # Checks for typedefs, structures, and compiler characteristics. AC_C_INLINE diff --git a/encrypt.c b/encrypt.c old mode 100755 new mode 100644 index f7d0c122..3f0baa97 --- a/encrypt.c +++ b/encrypt.c @@ -6,9 +6,9 @@ #include "encrypt.h" -#ifdef BIGENDIAN +#ifdef WORDS_BIGENDIAN #include -#elif LITTLEENDIAN +#else #define htole64(x) (x) #endif diff --git a/encrypt.h b/encrypt.h old mode 100755 new mode 100644