summaryrefslogtreecommitdiff
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
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.
-rwxr-xr-xconfigure14
-rw-r--r--configure.ac2
-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
7 files changed, 34 insertions, 28 deletions
diff --git a/configure b/configure
index 73bccd1..89592b5 100755
--- a/configure
+++ b/configure
@@ -2763,12 +2763,6 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
$as_echo "$MKDIR_P" >&6; }
-mkdir_p="$MKDIR_P"
-case $mkdir_p in
- [\\/$]* | ?:[\\/]*) ;;
- */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-
for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
@@ -2892,6 +2886,12 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+# For better backward compatibility. To be removed once Automake 1.9.x
+# dies out for good. For more background, see:
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00001.html>
+# <http://lists.gnu.org/archive/html/automake/2012-07/msg00014.html>
+mkdir_p='$(MKDIR_P)'
+
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
# Always define AMTAR for backward compatibility. Yes, it's still used
@@ -4921,7 +4921,7 @@ fi
done
-for ac_header in inttypes.h limits.h stddef.h stdint.h stdlib.h string.h wchar.h
+for ac_header in inttypes.h sys/inttypes.h limits.h stddef.h stdint.h stdlib.h string.h wchar.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
diff --git a/configure.ac b/configure.ac
index 614005a..5541361 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,7 +76,7 @@ AC_CHECK_DECLS([mpz_powm_sec], [], [], [
]])
# Checks for header files.
-AC_CHECK_HEADERS([inttypes.h limits.h stddef.h stdint.h stdlib.h string.h wchar.h])
+AC_CHECK_HEADERS([inttypes.h sys/inttypes.h limits.h stddef.h stdint.h stdlib.h string.h wchar.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
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)