1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

libarchive: Avoid configure-time checks for integer range constants

This commit is contained in:
Brad King
2020-06-01 15:45:43 -04:00
parent a7e66cac16
commit 22c5b0c244
4 changed files with 15 additions and 101 deletions

View File

@@ -260,18 +260,6 @@ if(WIN32)
# curl and expat: stdlib.h, stdarg.h, string.h, float.h
set(STDC_HEADERS 1)
# FIXME: Teach libarchive to use #if instead of configure-time checks.
set(HAVE_DECL_INT32_MAX 1)
set(HAVE_DECL_INT32_MIN 1)
set(HAVE_DECL_INT64_MAX 1)
set(HAVE_DECL_INT64_MIN 1)
set(HAVE_DECL_INTMAX_MAX 1)
set(HAVE_DECL_INTMAX_MIN 1)
set(HAVE_DECL_SIZE_MAX 1)
set(HAVE_DECL_UINT32_MAX 1)
set(HAVE_DECL_UINT64_MAX 1)
set(HAVE_DECL_UINTMAX_MAX 1)
# libarchive looks for external hash implementations.
set(ARCHIVE_CRYPTO_MD5_LIBC 0)
set(ARCHIVE_CRYPTO_MD5_LIBMD 0)

View File

@@ -1488,27 +1488,9 @@ ENDIF(HAVE_STRERROR_R)
#
# Check defines
#
SET(headers "limits.h")
IF(HAVE_STDINT_H)
LIST(APPEND headers "stdint.h")
ENDIF(HAVE_STDINT_H)
IF(HAVE_INTTYPES_H)
LIST(APPEND headers "inttypes.h")
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)
CHECK_SYMBOL_EXISTS(INTMAX_MIN "${headers}" HAVE_DECL_INTMAX_MIN)
CHECK_SYMBOL_EXISTS(UINT32_MAX "${headers}" HAVE_DECL_UINT32_MAX)
CHECK_SYMBOL_EXISTS(UINT64_MAX "${headers}" HAVE_DECL_UINT64_MAX)
CHECK_SYMBOL_EXISTS(UINTMAX_MAX "${headers}" HAVE_DECL_UINTMAX_MAX)
CHECK_SYMBOL_EXISTS(SIZE_MAX "${headers}" HAVE_DECL_SIZE_MAX)
CHECK_SYMBOL_EXISTS(SSIZE_MAX "limits.h" HAVE_DECL_SSIZE_MAX)
#
# Check struct members

View File

@@ -415,58 +415,14 @@ typedef unsigned char uint8_t;
don't. */
#cmakedefine HAVE_DECL_ACL_USER 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
/* Define to 1 if you have the declaration of `INT64_MIN', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_INT64_MIN 1
/* Define to 1 if you have the declaration of `INTMAX_MAX', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_INTMAX_MAX 1
/* Define to 1 if you have the declaration of `INTMAX_MIN', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_INTMAX_MIN 1
/* Define to 1 if you have the declaration of `SETACL', and to 0 if you don't.
*/
#cmakedefine HAVE_DECL_SETACL 1
/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_SIZE_MAX 1
/* Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_SSIZE_MAX 1
/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_STRERROR_R 1
/* Define to 1 if you have the declaration of `UINT32_MAX', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_UINT32_MAX 1
/* Define to 1 if you have the declaration of `UINT64_MAX', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_UINT64_MAX 1
/* Define to 1 if you have the declaration of `UINTMAX_MAX', and to 0 if you
don't. */
#cmakedefine HAVE_DECL_UINTMAX_MAX 1
/* Define to 1 if you have the declaration of `XATTR_NOFOLLOW', and to 0 if
you don't. */
#cmakedefine HAVE_DECL_XATTR_NOFOLLOW 1

View File

@@ -107,56 +107,44 @@
/* Borland warns about its own constants! */
#if defined(__BORLANDC__)
# if HAVE_DECL_UINT64_MAX
# undef UINT64_MAX
# undef HAVE_DECL_UINT64_MAX
# endif
# if HAVE_DECL_UINT64_MIN
# undef UINT64_MIN
# undef HAVE_DECL_UINT64_MIN
# endif
# if HAVE_DECL_INT64_MAX
# undef INT64_MAX
# undef HAVE_DECL_INT64_MAX
# endif
# if HAVE_DECL_INT64_MIN
# undef INT64_MIN
# undef HAVE_DECL_INT64_MIN
# endif
# undef UINT64_MAX
# undef UINT64_MIN
# undef INT64_MAX
# undef INT64_MIN
#endif
/* Some platforms lack the standard *_MAX definitions. */
#if !HAVE_DECL_SIZE_MAX
#ifndef SIZE_MAX
#define SIZE_MAX (~(size_t)0)
#endif
#if !HAVE_DECL_SSIZE_MAX
#ifndef SSIZE_MAX
#define SSIZE_MAX ((ssize_t)(SIZE_MAX >> 1))
#endif
#if !HAVE_DECL_UINT32_MAX
#ifndef UINT32_MAX
#define UINT32_MAX (~(uint32_t)0)
#endif
#if !HAVE_DECL_INT32_MAX
#ifndef INT32_MAX
#define INT32_MAX ((int32_t)(UINT32_MAX >> 1))
#endif
#if !HAVE_DECL_INT32_MIN
#ifndef INT32_MIN
#define INT32_MIN ((int32_t)(~INT32_MAX))
#endif
#if !HAVE_DECL_UINT64_MAX
#ifndef UINT64_MAX
#define UINT64_MAX (~(uint64_t)0)
#endif
#if !HAVE_DECL_INT64_MAX
#ifndef INT64_MAX
#define INT64_MAX ((int64_t)(UINT64_MAX >> 1))
#endif
#if !HAVE_DECL_INT64_MIN
#ifndef INT64_MIN
#define INT64_MIN ((int64_t)(~INT64_MAX))
#endif
#if !HAVE_DECL_UINTMAX_MAX
#ifndef UINTMAX_MAX
#define UINTMAX_MAX (~(uintmax_t)0)
#endif
#if !HAVE_DECL_INTMAX_MAX
#ifndef INTMAX_MAX
#define INTMAX_MAX ((intmax_t)(UINTMAX_MAX >> 1))
#endif
#if !HAVE_DECL_INTMAX_MIN
#ifndef INTMAX_MIN
#define INTMAX_MIN ((intmax_t)(~INTMAX_MAX))
#endif