]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Add endian test to autoconf and convert crypt to use it.
authorElizabeth Jennifer Myers <redacted>
Tue, 25 Jan 2011 02:03:00 +0000 (21:03 -0500)
committerElizabeth Jennifer Myers <redacted>
Tue, 25 Jan 2011 02:03:00 +0000 (21:03 -0500)
libratbox/configure.ac
libratbox/include/libratbox_config.h.in
libratbox/src/crypt.c

index b2b33f34f8deebad96174aac0bf3569e38e513d7..d50095c5e03b30b2b349ae540c344ee55d1bb7aa 100644 (file)
@@ -40,6 +40,7 @@ AM_MAINTAINER_MODE
 AC_ISC_POSIX
 AC_C_INLINE
 AC_C_CONST
+AC_C_BIGENDIAN
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
 AC_PATH_PROG(AUTOMAKE, automake)
index 1055efd5e989fcfc0b8a8938c92e68133b26f775..4e585c143b63ca364cc547ac92fec5ecbbd72375 100644 (file)
@@ -1,5 +1,8 @@
 /* include/libratbox_config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
 /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
    systems. This function is required for `alloca.c' support on those systems.
    */
 /* Define this to disable debugging support. */
 #undef NDEBUG
 
-/* Define if your system needs crypt. */
-#undef NEED_CRYPT
-
 /* Define to 1 if you wish to disable the block allocator. */
 #undef NOBALLOC
 
 /* This is a Windows system */
 #undef WINDOWS
 
+/* 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 1 if on MINIX. */
 #undef _MINIX
 
index 7bb27c2d925cc5ec533db47a5be53be413dcc9d2..3741e0b6d06c431d952d83616b41ecb5114ce282 100644 (file)
@@ -779,7 +779,7 @@ static void   MD5Init (MD5_CTX *);
 static void   MD5Update (MD5_CTX *, const void *, unsigned int);
 static void   MD5Final (unsigned char [16], MD5_CTX *);
 
-#if (BYTE_ORDER == LITTLE_ENDIAN)
+#ifndef WORDS_BIGENDIAN
 #define Encode memcpy
 #define Decode memcpy
 #else 
@@ -1196,7 +1196,7 @@ struct sha256_ctx
        char buffer[128];       /* NB: always correctly aligned for uint32_t.  */
 };
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
 #      define SHA256_SWAP(n) \
                (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
 #else
@@ -1738,7 +1738,7 @@ struct sha512_ctx
 };
 
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifndef WORDS_BIGENDIAN
 #      define SHA512_SWAP(n)                   \
                (((n) << 56)                    \
                | (((n) & 0xff00) << 40)        \