]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
PR #679: add workaround for old compilers w/o stdint.h (i.e. VS2008 and earlier) 679/head
authorEric Hawicz <erh+git@nimenees.com>
Sun, 6 Aug 2023 02:11:30 +0000 (22:11 -0400)
committerEric Hawicz <erh+git@nimenees.com>
Sun, 6 Aug 2023 02:11:30 +0000 (22:11 -0400)
CMakeLists.txt
cmake/json_config.h.in
json_inttypes.h

index d353c0218286dc0e260ebb16d34baec6ee6cbfb5..983148ce9f014ed3ed5c242ffd4dea4ab9103d40 100644 (file)
@@ -143,11 +143,14 @@ check_include_file(sys/random.h     HAVE_SYS_RANDOM_H)
 check_include_file(sys/stat.h       HAVE_SYS_STAT_H)
 check_include_file(xlocale.h        HAVE_XLOCALE_H)
 
+# Set json-c specific vars to stamp into json_config.h
+# in a way that hopefully won't conflict with other
+# projects that use json-c.
 if (HAVE_INTTYPES_H)
-       # Set a json-c specific var to stamp into json_config.h
-       # in a way that hopefully won't conflict with other
-       # projects that use json-c.
-    set(JSON_C_HAVE_INTTYPES_H 1)
+       set(JSON_C_HAVE_INTTYPES_H 1)
+endif()
+if (HAVE_STDINT_H)
+       set(JSON_C_HAVE_STDINT_H 1)
 endif()
 
 check_symbol_exists(_isnan          "float.h" HAVE_DECL__ISNAN)
index f30d8a6398bfe37ddaa27741cf8ba85375c40f02..790fd7e338e8f6c6dc64e21abec7d43b400af39f 100644 (file)
@@ -1,2 +1,5 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #cmakedefine JSON_C_HAVE_INTTYPES_H @JSON_C_HAVE_INTTYPES_H@
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine JSON_C_HAVE_STDINT_H @JSON_C_HAVE_STDINT_H@
index a901a8ef3917d34962675c32c9cc238882d35cf8..a33a31f10725186d12c7db52383683c5b7f25135 100644 (file)
 #include <inttypes.h>
 
 #else
+#ifdef JSON_C_HAVE_STDINT_H
 #include <stdint.h>
+#else
+/* Really only valid for old MS compilers, VS2008 and earlier: */
+typedef __int32 int32_t;
+typedef unsigned __int32 uint32_t;
+typedef __int64 int64_t;
+typedef unsigned __int64 uint64_t;
+#endif
 
 #define PRId64 "I64d"
 #define SCNd64 "I64d"