From: Tim Kientzle Date: Sun, 24 Apr 2016 21:46:36 +0000 (-0700) Subject: Define INT32_MAX and INT32_MIN for older compilers X-Git-Tag: v3.2.0~2^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f637b08f8d2622b132050c34223c8b0f668eb21;p=thirdparty%2Flibarchive.git Define INT32_MAX and INT32_MIN for older compilers --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 99a52fb8d..eedcd23e3 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 46f9d5562..94fbb59f5 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 5e05a6b30..d352991cb 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 64595aec6..b06c3cd28 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