summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--build/cmake/config.h.in8
-rw-r--r--configure.ac3
-rw-r--r--libarchive/archive_platform.h6
4 files changed, 18 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 99a52fb8..eedcd23e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1303,6 +1303,8 @@ ENDIF(HAVE_INTTYPES_H)
CHECK_SYMBOL_EXISTS(EFTYPE "errno.h" HAVE_EFTYPE)
CHECK_SYMBOL_EXISTS(EILSEQ "errno.h" HAVE_EILSEQ)
CHECK_SYMBOL_EXISTS(D_MD_ORDER "langinfo.h" HAVE_D_MD_ORDER)
+CHECK_SYMBOL_EXISTS(INT32_MAX "${headers}" HAVE_DECL_INT32_MAX)
+CHECK_SYMBOL_EXISTS(INT32_MIN "${headers}" HAVE_DECL_INT32_MIN)
CHECK_SYMBOL_EXISTS(INT64_MAX "${headers}" HAVE_DECL_INT64_MAX)
CHECK_SYMBOL_EXISTS(INT64_MIN "${headers}" HAVE_DECL_INT64_MIN)
CHECK_SYMBOL_EXISTS(INTMAX_MAX "${headers}" HAVE_DECL_INTMAX_MAX)
diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in
index 46f9d556..94fbb59f 100644
--- a/build/cmake/config.h.in
+++ b/build/cmake/config.h.in
@@ -362,6 +362,14 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the `cygwin_conv_path' function. */
#cmakedefine HAVE_CYGWIN_CONV_PATH 1
+/* Define to 1 if you have the declaration of `INT32_MAX', and to 0 if you
+ don't. */
+#cmakedefine HAVE_DECL_INT32_MAX 1
+
+/* Define to 1 if you have the declaration of `INT32_MIN', and to 0 if you
+ don't. */
+#cmakedefine HAVE_DECL_INT32_MIN 1
+
/* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_INT64_MAX 1
diff --git a/configure.ac b/configure.ac
index 5e05a6b3..d352991c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -539,7 +539,8 @@ AC_TYPE_INT16_T
AC_TYPE_UINT16_T
AC_TYPE_UINT8_T
-AC_CHECK_DECLS([SIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX])
+AC_CHECK_DECLS([SIZE_MAX, INT32_MAX, INT32_MIN])
+AC_CHECK_DECLS([INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX])
AC_CHECK_DECLS([INTMAX_MAX, INTMAX_MIN, UINTMAX_MAX])
AC_CHECK_DECL([SSIZE_MAX],
diff --git a/libarchive/archive_platform.h b/libarchive/archive_platform.h
index 64595aec..b06c3cd2 100644
--- a/libarchive/archive_platform.h
+++ b/libarchive/archive_platform.h
@@ -117,6 +117,12 @@
#if !HAVE_DECL_UINT32_MAX
#define UINT32_MAX (~(uint32_t)0)
#endif
+#if !HAVE_DECL_INT32_MAX
+#define INT32_MAX ((int32_t)(UINT32_MAX >> 1))
+#endif
+#if !HAVE_DECL_INT32_MIN
+#define INT32_MIN ((int32_t)(~INT32_MAX))
+#endif
#if !HAVE_DECL_UINT64_MAX
#define UINT64_MAX (~(uint64_t)0)
#endif