summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDwayne Litzenberger <dlitz@dlitz.net>2013-02-21 00:18:52 -0800
committerDwayne Litzenberger <dlitz@dlitz.net>2013-04-21 20:41:18 -0700
commit076560be889ef220c8fb10dd68635468939345ab (patch)
tree54588441b24ea4a2f3f7200d335d897037d99821 /src
parent6dbfccadecc55c203dd76f9e504c94ba042ec12f (diff)
downloadpycrypto-076560be889ef220c8fb10dd68635468939345ab.tar.gz
Include inttypes.h or sys/inttypes.h based on what autoconf tells us
This should fix compilation on HP-UX 11.31. Thanks Adam Woodbeck for reporting this.
Diffstat (limited to 'src')
-rw-r--r--src/Blowfish.c6
-rw-r--r--src/RIPEMD160.c7
-rw-r--r--src/_counter.h6
-rw-r--r--src/config.h.in3
-rw-r--r--src/hash_SHA2.h24
5 files changed, 26 insertions, 20 deletions
diff --git a/src/Blowfish.c b/src/Blowfish.c
index fd90fd7..9985728 100644
--- a/src/Blowfish.c
+++ b/src/Blowfish.c
@@ -30,10 +30,12 @@
#include "config.h"
#if HAVE_STDINT_H
# include <stdint.h>
-#elif defined(__sun) || defined(__sun__)
+#elif HAVE_INTTYPES_H
+# include <inttypes.h>
+#elif HAVE_SYS_INTTYPES_H
# include <sys/inttypes.h>
#else
-# error "stdint.h not found"
+# error "stdint.h and inttypes.h not found"
#endif
#include <assert.h>
#include <string.h>
diff --git a/src/RIPEMD160.c b/src/RIPEMD160.c
index 9593fc8..b12773c 100644
--- a/src/RIPEMD160.c
+++ b/src/RIPEMD160.c
@@ -44,14 +44,15 @@
*/
#include "Python.h"
-
#include "config.h"
#if HAVE_STDINT_H
# include <stdint.h>
-#elif defined(__sun) || defined(__sun__)
+#elif HAVE_INTTYPES_H
+# include <inttypes.h>
+#elif HAVE_SYS_INTTYPES_H
# include <sys/inttypes.h>
#else
-# error "stdint.h not found"
+# error "stdint.h and inttypes.h not found"
#endif
#include <assert.h>
diff --git a/src/_counter.h b/src/_counter.h
index f671094..2817865 100644
--- a/src/_counter.h
+++ b/src/_counter.h
@@ -27,10 +27,12 @@
#include "config.h"
#if HAVE_STDINT_H
# include <stdint.h>
-#elif defined(__sun) || defined(__sun__)
+#elif HAVE_INTTYPES_H
+# include <inttypes.h>
+#elif HAVE_SYS_INTTYPES_H
# include <sys/inttypes.h>
#else
-# error "stdint.h not found"
+# error "stdint.h and inttypes.h not found"
#endif
typedef struct {
diff --git a/src/config.h.in b/src/config.h.in
index 514c060..d89930c 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -48,6 +48,9 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
+/* Define to 1 if you have the <sys/inttypes.h> header file. */
+#undef HAVE_SYS_INTTYPES_H
+
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
diff --git a/src/hash_SHA2.h b/src/hash_SHA2.h
index 02991bd..caa1e84 100644
--- a/src/hash_SHA2.h
+++ b/src/hash_SHA2.h
@@ -27,6 +27,16 @@
#define __HASH_SHA2_H
#include "Python.h"
+#include "config.h"
+#if HAVE_STDINT_H
+# include <stdint.h>
+#elif HAVE_INTTYPES_H
+# include <inttypes.h>
+#elif HAVE_SYS_INTTYPES_H
+# include <sys/inttypes.h>
+#else
+# error "stdint.h and inttypes.h not found"
+#endif
/* check if implementation set the correct macros */
#ifndef MODULE_NAME
@@ -69,22 +79,10 @@
#define ROTR(x, n) (((x)>>((n)&(WORD_SIZE_BITS-1)))|((x)<<(WORD_SIZE_BITS-((n)&(WORD_SIZE_BITS-1)))))
#define SHR(x, n) ((x)>>(n))
-/* determine fixed size types */
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
-#include <stdint.h>
-typedef uint8_t U8;
-typedef uint32_t U32;
-typedef uint64_t U64;
-#elif defined(_MSC_VER)
-typedef unsigned char U8;
-typedef unsigned __int64 U64;
-typedef unsigned int U32;
-#elif defined(__sun) || defined(__sun__)
-#include <sys/inttypes.h>
+/* define fixed size types */
typedef uint8_t U8;
typedef uint32_t U32;
typedef uint64_t U64;
-#endif
/* typedef a sha2_word_t type of appropriate size */
#if (WORD_SIZE_BITS == 64)