diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG
index 87d3e33d5b5f8e12215c41ea0bdc1b58a7a7c294..21182eda643dfde53a8b798bbc8442f7032cab98 100644
--- a/sm5/CHANGELOG
+++ b/sm5/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.584 2006/10/27 21:49:41 chrfranke Exp $
+$Id: CHANGELOG,v 1.585 2006/10/29 20:35:35 chrfranke Exp $
 
 The most recent version of this file is:
 http://smartmontools.cvs.sourceforge.net/smartmontools/sm5/CHANGELOG?view=markup
@@ -33,6 +33,8 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
 
+  [CF] Fixed inclusion of PRI?64 macros from inttypes.h.
+
   [CF] Windows: Added WRITE LOG to support selective self tests.
 
   [CF] Fix selective self test log revision number if '-T permissive'
diff --git a/sm5/int64.h b/sm5/int64.h
index dc44a9ee1368a70c5d52ba715c25b036a755ac07..0ab1dd4a8a78c7d89aaed830d369ce039e3ab9bd 100644
--- a/sm5/int64.h
+++ b/sm5/int64.h
@@ -20,15 +20,18 @@
 #ifndef INT64_H_
 #define INT64_H_
 
-#define INT64_H_CVSID "$Id: int64.h,v 1.15 2006/10/27 20:24:27 chrfranke Exp $\n"
+#define INT64_H_CVSID "$Id: int64.h,v 1.16 2006/10/29 20:35:35 chrfranke Exp $\n"
 
-// 64 bit integer typedefs
+// 64 bit integer typedefs and format strings
 
 #ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
+// The ISO C99 standard specifies that in C++ implementations the PRI* macros
+// from <inttypes.h> should only be defined if explicitly requested
+#define __STDC_FORMAT_MACROS 1
+#include <inttypes.h> // PRId64, PRIu64, PRIx64 (also includes <stdint.h>)
 #else
 #ifdef HAVE_STDINT_H
-#include <stdint.h>
+#include <stdint.h> // int64_t, uint64_t (usually included above)
 #else
 #ifdef HAVE_SYS_INTTYPES_H
 #include <sys/inttypes.h>
@@ -56,24 +59,12 @@ typedef unsigned long long uint64_t;
 #endif // HAVE_STDINT_H
 #endif // HAVE_INTTYPES_H
 
-// 64 bit integer format strings
-
-#if defined(_WIN32)
+#ifdef _WIN32
 // for MSVCRT.DLL (used by both MSVC 6.0 and MinGW)
 #define PRId64 "I64d"
 #define PRIu64 "I64u"
 #define PRIx64 "I64x"
-#endif // _WIN32 && _MSC_VER
-
-#ifdef LINUX_X86_64
-// For Linux x86_64
-#undef PRId64
-#undef PRIu64
-#undef PRIx64
-#define PRId64 "ld"
-#define PRIu64 "lu"
-#define PRIx64 "lx"
-#endif
+#endif // _WIN32
 
 // If macros not defined in inttypes.h, fix here.  Default is GCC
 // style