]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
define printf format specifiers if not present
authorlinear cannon <dev@linear.network>
Sun, 19 Dec 2021 08:20:43 +0000 (00:20 -0800)
committerlinear cannon <dev@linear.network>
Sun, 19 Dec 2021 09:07:40 +0000 (01:07 -0800)
configure.ac
libarchive/archive_platform.h

index cb89c3ee81530e63e18f12aec2bbf04e8c0a1a34..526f313b901f1f6f6b62b68b64c557bfdd71e7fe 100644 (file)
@@ -633,6 +633,9 @@ AC_CHECK_TYPE([wchar_t],
                AC_CHECK_SIZEOF([wchar_t])],
                [])
 
+AX_COMPILE_CHECK_SIZEOF(int)
+AX_COMPILE_CHECK_SIZEOF(long)
+
 AC_HEADER_TIME
 
 # Checks for library functions.
index 9fef68fad8b97d0e5c6fe9029fb78b629504d14a..3426975de3497ee4f437bc07ca9e523497d3a700 100644 (file)
 #define        INTMAX_MIN ((intmax_t)(~INTMAX_MAX))
 #endif
 
+/* Some platforms lack the standard PRIxN/PRIdN definitions. */
+#if !HAVE_INTTYPES_H || !defined(PRIx32) || !defined(PRId32)
+#ifndef PRIx32
+#if SIZEOF_INT == 4
+#define PRIx32 "x"
+#elif SIZEOF_LONG == 4
+#define PRIx32 "lx"
+#else
+#error No suitable 32-bit unsigned integer type found for this platform
+#endif
+#endif // PRIx32
+#ifndef PRId32
+#if SIZEOF_INT == 4
+#define PRId32 "d"
+#elif SIZEOF_LONG == 4
+#define PRId32 "ld"
+#else
+#error No suitable 32-bit signed integer type found for this platform
+#endif
+#endif // PRId32
+#endif // !HAVE_INTTYPES_H || !defined(PRIx32) || !defined(PRId32)
+
 /*
  * If we can't restore metadata using a file descriptor, then
  * for compatibility's sake, close files before trying to restore metadata.