diff --git a/aes.h b/aes.h
index 87464cf48022ecaaebd8b938d71351bf180c3a8a..97d8deefe599c4089b6294e08cd3b6560b32b431 100644
--- a/aes.h
+++ b/aes.h
@@ -26,7 +26,7 @@
 #ifndef NETTLE_AES_H_INCLUDED
 #define NETTLE_AES_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Name mangling */
 #define aes_set_encrypt_key nettle_aes_set_encrypt_key
diff --git a/aesdata.c b/aesdata.c
index babb382fcfd65be13a756055bdbca9cc03fc92c2..0fc1b310baaed0b978b47aea5b2eda0accbb1537 100644
--- a/aesdata.c
+++ b/aesdata.c
@@ -3,11 +3,12 @@
 #endif
 
 #include <assert.h>
-#include <inttypes.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 
+#include "nettle-types.h"
+
 #if 1
 # define BYTE_FORMAT "0x%02x"
 # define BYTE_COLUMNS 8
diff --git a/arcfour.h b/arcfour.h
index 9499e981305cff1d5ead7d040ec79d6148b79643..66891f8a900c5196cf538de79549060d0b3d8a45 100644
--- a/arcfour.h
+++ b/arcfour.h
@@ -26,7 +26,7 @@
 #ifndef NETTLE_ARCFOUR_H_INCLUDED
 #define NETTLE_ARCFOUR_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Name mangling */
 #define arcfour_set_key nettle_arcfour_set_key
diff --git a/base16.h b/base16.h
index 2701725b659691baf8b15e22770632d88b0e97fb..2631fae41451576052f1bf64a325692c6ed7b305 100644
--- a/base16.h
+++ b/base16.h
@@ -27,7 +27,7 @@
 #ifndef NETTLE_BASE16_H_INCLUDED
 #define NETTLE_BASE16_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Name mangling */
 #define base16_encode_single nettle_base16_encode_single
diff --git a/base64.h b/base64.h
index 6ca0f1c85b2e97a1bf1f8f7ab02000f774e5c4e1..7da84c15b3afd0e030268c80c425fd5953b51e83 100644
--- a/base64.h
+++ b/base64.h
@@ -26,7 +26,7 @@
 #ifndef NETTLE_BASE64_H_INCLUDED
 #define NETTLE_BASE64_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Name mangling */
 #define base64_encode_init nettle_base64_encode_init
diff --git a/bignum.h b/bignum.h
index dce95126fb6677ee0840ff1822b1a9cfa5c4be0c..4ee0726ef3abc495723797294fe1c86f65d83fb9 100644
--- a/bignum.h
+++ b/bignum.h
@@ -29,7 +29,7 @@
 #include "nettle-meta.h"
 
 #include <gmp.h>
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Size needed for signed encoding, including extra sign byte if
  * necessary. */
diff --git a/blowfish.h b/blowfish.h
index 7f7ddcd67246318efc323b93d7d9e3528102d203..3d343c6d8ee2c4fe30041ec52c6ac5ecb7eb9bc4 100644
--- a/blowfish.h
+++ b/blowfish.h
@@ -26,7 +26,7 @@
 #ifndef NETTLE_BLOWFISH_H_INCLUDED
 #define NETTLE_BLOWFISH_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Name mangling */
 #define blowfish_set_key nettle_blowfish_set_key
diff --git a/cast128.h b/cast128.h
index 39102cbcaf057bce2797b82ddda61df09bf9373a..b9437655e80b1ba2bf2a75c1eab2fd9da6f1dc9e 100644
--- a/cast128.h
+++ b/cast128.h
@@ -32,7 +32,7 @@
 #ifndef NETTLE_CAST128_H_INCLUDED
 #define NETTLE_CAST128_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Name mangling */
 #define cast128_set_key nettle_cast128_set_key
diff --git a/cbc.h b/cbc.h
index 9428aa554f7102655f5b88a5ed85c7e58e654acf..c2043768e263337e6c44d39953f16c4ab42139cf 100644
--- a/cbc.h
+++ b/cbc.h
@@ -26,7 +26,7 @@
 #ifndef NETTLE_CBC_H_INCLUDED
 #define NETTLE_CBC_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Name mangling */
 #define cbc_encrypt nettle_cbc_encrypt
diff --git a/des.h b/des.h
index 25168d11a5d5e4653c667642f44560efe4a46cfb..a6d34cdc59912c858fb6b1973910f8a83bcddde2 100644
--- a/des.h
+++ b/des.h
@@ -35,7 +35,7 @@
 #ifndef NETTLE_DES_H_INCLUDED
 #define NETTLE_DES_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Namespace mangling */
 #define des_set_key nettle_des_set_key
diff --git a/dsa.h b/dsa.h
index d7aaecf5fce243970a3bcf5341277ca6012092d4..1f06136f2f56a3cc381f324af7a72a6162832e13 100644
--- a/dsa.h
+++ b/dsa.h
@@ -26,9 +26,10 @@
 #ifndef NETTLE_DSA_H_INCLUDED
 #define NETTLE_DSA_H_INCLUDED
 
-#include <inttypes.h>
 #include <gmp.h>
 
+#include "nettle-types.h"
+
 #include "sha.h"
 
 /* For nettle_random_func */
diff --git a/knuth-lfib.h b/knuth-lfib.h
index c8a1f93aac45a2b6740d4e84af32b1695d582df1..073c9df501a50dc6608175e41d3238ad9071dcb4 100644
--- a/knuth-lfib.h
+++ b/knuth-lfib.h
@@ -31,7 +31,7 @@
 #ifndef NETTLE_KNUTH_LFIB_H_INCLUDED
 #define NETTLE_KNUTH_LFIB_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Namespace mangling */
 #define knuth_lfib_init nettle_knuth_lfib_init
diff --git a/md2.h b/md2.h
index 68c73abe0d45f444d5a102a3fee24e3bf2c36a50..2fbfbbccd06f43cc03ff65782488c45cc624978f 100644
--- a/md2.h
+++ b/md2.h
@@ -26,7 +26,7 @@
 #ifndef NETTLE_MD2_H_INCLUDED
 #define NETTLE_MD2_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Name mangling */
 #define md2_init nettle_md2_init
diff --git a/md4.h b/md4.h
index 0328820086823baaf82d1e0a921c27e3cddece48..7ccf8c33dea345e1c6a7b610c00c0d9a56909e83 100644
--- a/md4.h
+++ b/md4.h
@@ -26,7 +26,7 @@
 #ifndef NETTLE_MD4_H_INCLUDED
 #define NETTLE_MD4_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Name mangling */
 #define md4_init nettle_md4_init
diff --git a/md5.h b/md5.h
index 95e42c62b4a832de1a6adc1a6e6e3a2dab67beec..dc7c89a0372811561ec3ab49ee776ecef3dc2a3f 100644
--- a/md5.h
+++ b/md5.h
@@ -26,7 +26,7 @@
 #ifndef NETTLE_MD5_H_INCLUDED
 #define NETTLE_MD5_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Name mangling */
 #define md5_init nettle_md5_init
diff --git a/memxor.h b/memxor.h
index 25621b1954c1ab535afea925a36c9290495b45e6..fe214c3902922b83710706757deae38e266bdd59 100644
--- a/memxor.h
+++ b/memxor.h
@@ -5,8 +5,8 @@
 #ifndef NETTLE_MEMXOR_H_INCLUDED
 #define NETTLE_MEMXOR_H_INCLUDED
 
-#include <inttypes.h>
 #include <stdlib.h>
+#include "nettle-types.h"
 
 uint8_t *memxor(uint8_t *dst, const uint8_t *src, size_t n);
 
diff --git a/nettle-meta.h b/nettle-meta.h
index ebffd1cb9c83041126f8b908137617b44ff79429..9a74cb32585ab279791b83562e6c29d3d4afda10 100644
--- a/nettle-meta.h
+++ b/nettle-meta.h
@@ -26,7 +26,7 @@
 #ifndef NETTLE_META_H_INCLUDED
 #define NETTLE_META_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Randomness. Used by key generation and dsa signature creation. */
 typedef void (*nettle_random_func)(void *ctx,
diff --git a/pkcs1.h b/pkcs1.h
index 0db9121f032fe5d46a9ff5f9e95060ca29a9d226..29f06284f93c9960fdc9458555a111dcf0c6be1c 100644
--- a/pkcs1.h
+++ b/pkcs1.h
@@ -26,8 +26,8 @@
 #ifndef NETTLE_PKCS1_H_INCLUDED
 #define NETTLE_PKCS1_H_INCLUDED
 
-#include <inttypes.h>
 #include <gmp.h>
+#include "nettle-types.h"
 
 /* Name mangling */
 #define pkcs1_signature_prefix nettle_pkcs1_signature_prefix
diff --git a/realloc.h b/realloc.h
index 5e66130fb32fe041905201332f852fcd609fbda6..fcd4ca85c8dc07fe397f1d6f0ae6f3a11af7766f 100644
--- a/realloc.h
+++ b/realloc.h
@@ -25,7 +25,7 @@
 #ifndef NETTLE_REALLOC_H_INCLUDED
 #define NETTLE_REALLOC_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 typedef void *nettle_realloc_func(void *ctx, void *p, unsigned length);
 
diff --git a/rsa.h b/rsa.h
index 39b83b11ee6125aa5e4507c9845458208469aef6..a0df06f8611b67c02c713ea90e1991bb608237e9 100644
--- a/rsa.h
+++ b/rsa.h
@@ -26,8 +26,8 @@
 #ifndef NETTLE_RSA_H_INCLUDED
 #define NETTLE_RSA_H_INCLUDED
 
-#include <inttypes.h>
 #include <gmp.h>
+#include "nettle-types.h"
 
 #include "md5.h"
 #include "sha.h"
diff --git a/serpent.h b/serpent.h
index 79cad0ef64cb47768fc5a5d2ba7f33d09adbc3d4..4fb1d7d06e500dc8c603ee619e7ce4fd8cb7298c 100644
--- a/serpent.h
+++ b/serpent.h
@@ -31,7 +31,7 @@
 #ifndef NETTLE_SERPENT_H_INCLUDED
 #define NETTLE_SERPENT_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Name mangling */
 #define serpent_set_key nettle_serpent_set_key
diff --git a/sexp.h b/sexp.h
index 181cc57640b404805d43129c0c42a60eabb2453c..40d4fda30e581e8dae9744a530f4c2406143d5a0 100644
--- a/sexp.h
+++ b/sexp.h
@@ -26,8 +26,8 @@
 #ifndef NETTLE_SEXP_H_INCLUDED
 #define NETTLE_SEXP_H_INCLUDED
 
-#include <inttypes.h>
 #include <stdarg.h>
+#include "nettle-types.h"
 
 /* Name mangling */
 #define sexp_iterator_first nettle_sexp_iterator_first
diff --git a/sha.h b/sha.h
index 134de1d57b8fa60404a79a094c2dc1277df78738..81e1571e41ec9beb888bab8701ee13f49ef3c6a2 100644
--- a/sha.h
+++ b/sha.h
@@ -26,7 +26,7 @@
 #ifndef NETTLE_SHA_H_INCLUDED
 #define NETTLE_SHA_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Name mangling */
 #define sha1_init nettle_sha1_init
diff --git a/twofish.h b/twofish.h
index 3d007d7ab28a10b935782d88c46cd2faf1444de1..9a1e9bab75fc13af13d62f00cbe19f3086c6325a 100644
--- a/twofish.h
+++ b/twofish.h
@@ -32,7 +32,7 @@
 #ifndef NETTLE_TWOFISH_H_INCLUDED
 #define NETTLE_TWOFISH_H_INCLUDED
 
-#include <inttypes.h>
+#include "nettle-types.h"
 
 /* Name mangling */
 #define twofish_set_key nettle_twofish_set_key