]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Birdtest: U64_C() macro
authorPavel Tvrdík <pawel.tvrdik@gmail.cz>
Mon, 3 Aug 2015 11:46:45 +0000 (13:46 +0200)
committerPavel Tvrdík <pawel.tvrdik@gmail.cz>
Mon, 3 Aug 2015 12:41:20 +0000 (14:41 +0200)
configure.in
lib/sha512.c
sysdep/autoconf.h.in
sysdep/config.h

index c81709e61bf4fec0d099306845814002b92d1e1a..5618b3a238ab128edce65b4e0b29fa80dbc06280 100644 (file)
@@ -247,6 +247,10 @@ AC_TRY_COMPILE([#include <sys/types.h>
 AC_C_BIGENDIAN([AC_DEFINE(CPU_BIG_ENDIAN)], [AC_DEFINE(CPU_LITTLE_ENDIAN)],
                 [AC_MSG_ERROR([Cannot determine CPU endianity.])])
 
+AC_CHECK_SIZEOF(unsigned int)
+AC_CHECK_SIZEOF(unsigned long)
+AC_CHECK_SIZEOF(unsigned long long)
+
 BIRD_CHECK_INTEGERS
 BIRD_CHECK_STRUCT_ALIGN
 BIRD_CHECK_TIME_T
index becb91b9a68a6170b82a76a1f9aab82fa48a9ba6..88343875569fb546a1c4bbd7a6864decb862e7db 100644 (file)
 #include "lib/sha512.h"
 #include "lib/unaligned.h"
 
-#define U64_C(c) (c ## UL) /* Maybe is system dependent */
+#if SIZEOF_UNSIGNED_INT == 8
+  #define U64_C(c) (c ## U)
+#elif SIZEOF_UNSIGNED_LONG == 8
+  #define U64_C(c) (c ## UL)
+#elif SIZEOF_UNSIGNED_LONG_LONG == 8
+  #define U64_C(c) (c ## ULL)
+#endif
 
 static uint sha512_transform(void *context, const byte *data, size_t nblks);
 
index a9e46e274c2f85488bf4f3b2f88295404ad139a6..2572984903419b232e9e22a072b36c8ba94ddade 100644 (file)
 /* We have stdint.h */
 #undef HAVE_STDINT_H
 
+/* The size of `unsigned int', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_INT
+
+/* The size of `unsigned long', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_LONG
+
+/* The size of `unsigned long long', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_LONG_LONG
+
 #define CONFIG_PATH ?
index 08c15fe9a7520a3e9b16cee5c0d9ef4a8588bc32..800118e9ea9b780beee8a810ec54910b5d4af9c5 100644 (file)
 /* Include OS configuration file as chosen in autoconf.h */
 #include SYSCONF_INCLUDE
 
+/* The AC_CHECK_SIZEOF() in configure fails for some machines.
+ * we provide some fallback values here */
+#ifndef SIZEOF_UNSIGNED_INT
+# define SIZEOF_UNSIGNED_INT 4
+#endif
+#ifndef SIZEOF_UNSIGNED_LONG
+# define SIZEOF_UNSIGNED_LONG 4
+#endif
+#ifndef SIZEOF_UNSIGNED_LONG_LONG
+# define SIZEOF_UNSIGNED_LONG_LONG 8
+#endif
+
 #ifndef MACROS_ONLY
 
 /*