mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-18 17:31:57 +08:00
liblzma: Use KWIML to get fixed-size integer types
This commit is contained in:
@@ -7,7 +7,6 @@ include(CheckTypeSize)
|
|||||||
include(TestBigEndian)
|
include(TestBigEndian)
|
||||||
|
|
||||||
CHECK_INCLUDE_FILE(byteswap.h HAVE_BYTESWAP_H)
|
CHECK_INCLUDE_FILE(byteswap.h HAVE_BYTESWAP_H)
|
||||||
CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)
|
|
||||||
CHECK_INCLUDE_FILE(limits.h HAVE_LIMITS_H)
|
CHECK_INCLUDE_FILE(limits.h HAVE_LIMITS_H)
|
||||||
CHECK_INCLUDE_FILE(memory.h HAVE_MEMORY_H)
|
CHECK_INCLUDE_FILE(memory.h HAVE_MEMORY_H)
|
||||||
CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
|
CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
|
||||||
@@ -60,38 +59,6 @@ set(HAVE_MF_BT4 1)
|
|||||||
set(HAVE_MF_HC3 1)
|
set(HAVE_MF_HC3 1)
|
||||||
set(HAVE_MF_HC4 1)
|
set(HAVE_MF_HC4 1)
|
||||||
|
|
||||||
CHECK_TYPE_SIZE(int16_t INT16_T)
|
|
||||||
CHECK_TYPE_SIZE(int32_t INT32_T)
|
|
||||||
CHECK_TYPE_SIZE(int64_t INT64_T)
|
|
||||||
CHECK_TYPE_SIZE(uint8_t UINT8_T)
|
|
||||||
CHECK_TYPE_SIZE(uint16_t UINT16_T)
|
|
||||||
CHECK_TYPE_SIZE(uint32_t UINT32_T)
|
|
||||||
CHECK_TYPE_SIZE(uint64_t UINT64_T)
|
|
||||||
|
|
||||||
CHECK_TYPE_SIZE("short" SIZE_OF_SHORT)
|
|
||||||
CHECK_TYPE_SIZE("int" SIZE_OF_INT)
|
|
||||||
CHECK_TYPE_SIZE("long" SIZE_OF_LONG)
|
|
||||||
CHECK_TYPE_SIZE("long long" SIZE_OF_LONG_LONG)
|
|
||||||
|
|
||||||
CHECK_TYPE_SIZE("unsigned short" SIZE_OF_UNSIGNED_SHORT)
|
|
||||||
CHECK_TYPE_SIZE("unsigned" SIZE_OF_UNSIGNED)
|
|
||||||
CHECK_TYPE_SIZE("unsigned long" SIZE_OF_UNSIGNED_LONG)
|
|
||||||
CHECK_TYPE_SIZE("unsigned long long" SIZE_OF_UNSIGNED_LONG_LONG)
|
|
||||||
CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)
|
|
||||||
|
|
||||||
CHECK_TYPE_SIZE("__int64" __INT64)
|
|
||||||
CHECK_TYPE_SIZE("unsigned __int64" UNSIGNED___INT64)
|
|
||||||
|
|
||||||
CHECK_TYPE_SIZE(uintptr_t UINTPTR_T)
|
|
||||||
IF(NOT HAVE_UINTPTR_T)
|
|
||||||
IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
|
|
||||||
SET(uintptr_t "uint64_t")
|
|
||||||
ELSE()
|
|
||||||
SET(uintptr_t "uint32_t")
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
|
|
||||||
SET(LZMA_SRCS
|
SET(LZMA_SRCS
|
||||||
common/sysdefs.h
|
common/sysdefs.h
|
||||||
common/tuklib_integer.h
|
common/tuklib_integer.h
|
||||||
|
@@ -3,169 +3,36 @@
|
|||||||
* Ensure we have C99-style int64_t, etc, all defined.
|
* Ensure we have C99-style int64_t, etc, all defined.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* First, we need to know if the system has already defined them. */
|
#include <cm3p/kwiml/int.h>
|
||||||
#cmakedefine HAVE_INT16_T
|
|
||||||
#cmakedefine HAVE_INT32_T
|
|
||||||
#cmakedefine HAVE_INT64_T
|
|
||||||
|
|
||||||
#cmakedefine HAVE_UINT8_T
|
#ifndef KWIML_INT_HAVE_INT64_T
|
||||||
#cmakedefine HAVE_UINT16_T
|
# define int64_t KWIML_INT_int64_t
|
||||||
#cmakedefine HAVE_UINT32_T
|
|
||||||
#cmakedefine HAVE_UINT64_T
|
|
||||||
|
|
||||||
/* We might have the types we want under other spellings. */
|
|
||||||
#cmakedefine HAVE___INT64
|
|
||||||
#cmakedefine HAVE_U_INT64_T
|
|
||||||
#cmakedefine HAVE_UNSIGNED___INT64
|
|
||||||
|
|
||||||
/* The sizes of various standard integer types. */
|
|
||||||
@SIZE_OF_SHORT_CODE@
|
|
||||||
@SIZE_OF_INT_CODE@
|
|
||||||
@SIZE_OF_LONG_CODE@
|
|
||||||
@SIZE_OF_LONG_LONG_CODE@
|
|
||||||
@SIZE_OF_UNSIGNED_SHORT_CODE@
|
|
||||||
@SIZE_OF_UNSIGNED_CODE@
|
|
||||||
@SIZE_OF_UNSIGNED_LONG_CODE@
|
|
||||||
@SIZE_OF_UNSIGNED_LONG_LONG_CODE@
|
|
||||||
@SIZEOF_SIZE_T_CODE@
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If we lack int64_t, define it to the first of __int64, int, long, and long long
|
|
||||||
* that exists and is the right size.
|
|
||||||
*/
|
|
||||||
#if !defined(HAVE_INT64_T) && defined(HAVE___INT64)
|
|
||||||
typedef __int64 int64_t;
|
|
||||||
#define HAVE_INT64_T
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef KWIML_INT_HAVE_INT32_T
|
||||||
#if !defined(HAVE_INT64_T) && SIZE_OF_INT == 8
|
# define int32_t KWIML_INT_int32_t
|
||||||
typedef int int64_t;
|
|
||||||
#define HAVE_INT64_T
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef KWIML_INT_HAVE_INT16_T
|
||||||
#if !defined(HAVE_INT64_T) && SIZE_OF_LONG == 8
|
# define int16_t KWIML_INT_int16_t
|
||||||
typedef long int64_t;
|
|
||||||
#define HAVE_INT64_T
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef KWIML_INT_HAVE_INT8_T
|
||||||
#if !defined(HAVE_INT64_T) && SIZE_OF_LONG_LONG == 8
|
# define int8_t KWIML_INT_int8_t
|
||||||
typedef long long int64_t;
|
|
||||||
#define HAVE_INT64_T
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef KWIML_INT_HAVE_UINT64_T
|
||||||
#if !defined(HAVE_INT64_T)
|
# define uint64_t KWIML_INT_uint64_t
|
||||||
#error No 64-bit integer type was found.
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef KWIML_INT_HAVE_UINT32_T
|
||||||
/*
|
# define uint32_t KWIML_INT_uint32_t
|
||||||
* Similarly for int32_t
|
|
||||||
*/
|
|
||||||
#if !defined(HAVE_INT32_T) && SIZE_OF_INT == 4
|
|
||||||
typedef int int32_t;
|
|
||||||
#define HAVE_INT32_T
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef KWIML_INT_HAVE_UINT16_T
|
||||||
#if !defined(HAVE_INT32_T) && SIZE_OF_LONG == 4
|
# define uint16_t KWIML_INT_uint16_t
|
||||||
typedef long int32_t;
|
|
||||||
#define HAVE_INT32_T
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef KWIML_INT_HAVE_UINT8_T
|
||||||
#if !defined(HAVE_INT32_T)
|
# define uint8_t KWIML_INT_uint8_t
|
||||||
#error No 32-bit integer type was found.
|
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef KWIML_INT_HAVE_UINTPTR_T
|
||||||
/*
|
# define uintptr_t KWIML_INT_uintptr_t
|
||||||
* Similarly for int16_t
|
|
||||||
*/
|
|
||||||
#if !defined(HAVE_INT16_T) && SIZE_OF_INT == 2
|
|
||||||
typedef int int16_t;
|
|
||||||
#define HAVE_INT16_T
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_INT16_T) && SIZE_OF_SHORT == 2
|
|
||||||
typedef short int16_t;
|
|
||||||
#define HAVE_INT16_T
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_INT16_T)
|
|
||||||
#error No 16-bit integer type was found.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Similarly for uint64_t
|
|
||||||
*/
|
|
||||||
#if !defined(HAVE_UINT64_T) && defined(HAVE_UNSIGNED___INT64)
|
|
||||||
typedef unsigned __int64 uint64_t;
|
|
||||||
#define HAVE_UINT64_T
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED == 8
|
|
||||||
typedef unsigned uint64_t;
|
|
||||||
#define HAVE_UINT64_T
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG == 8
|
|
||||||
typedef unsigned long uint64_t;
|
|
||||||
#define HAVE_UINT64_T
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG_LONG == 8
|
|
||||||
typedef unsigned long long uint64_t;
|
|
||||||
#define HAVE_UINT64_T
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_UINT64_T)
|
|
||||||
#error No 64-bit unsigned integer type was found.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Similarly for uint32_t
|
|
||||||
*/
|
|
||||||
#if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED == 4
|
|
||||||
typedef unsigned uint32_t;
|
|
||||||
#define HAVE_UINT32_T
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED_LONG == 4
|
|
||||||
typedef unsigned long uint32_t;
|
|
||||||
#define HAVE_UINT32_T
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_UINT32_T)
|
|
||||||
#error No 32-bit unsigned integer type was found.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Similarly for uint16_t
|
|
||||||
*/
|
|
||||||
#if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED == 2
|
|
||||||
typedef unsigned uint16_t;
|
|
||||||
#define HAVE_UINT16_T
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED_SHORT == 2
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
#define HAVE_UINT16_T
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_UINT16_T)
|
|
||||||
#error No 16-bit unsigned integer type was found.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Similarly for uint8_t
|
|
||||||
*/
|
|
||||||
#if !defined(HAVE_UINT8_T)
|
|
||||||
typedef unsigned char uint8_t;
|
|
||||||
#define HAVE_UINT8_T
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(HAVE_UINT16_T)
|
|
||||||
#error No 8-bit unsigned integer type was found.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#cmakedefine uintptr_t @uintptr_t@
|
|
||||||
|
|
||||||
#cmakedefine WORDS_BIGENDIAN 1
|
#cmakedefine WORDS_BIGENDIAN 1
|
||||||
|
|
||||||
#cmakedefine HAVE_BYTESWAP_H 1
|
#cmakedefine HAVE_BYTESWAP_H 1
|
||||||
@@ -205,7 +72,9 @@ typedef unsigned char uint8_t;
|
|||||||
#define HAVE_MF_HC4 1
|
#define HAVE_MF_HC4 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||||
#cmakedefine HAVE_INTTYPES_H 1
|
#ifdef KWIML_INT_HAVE_INTTYPES_H
|
||||||
|
# define HAVE_INTTYPES_H 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define to 1 if you have the <limits.h> header file. */
|
/* Define to 1 if you have the <limits.h> header file. */
|
||||||
#cmakedefine HAVE_LIMITS_H 1
|
#cmakedefine HAVE_LIMITS_H 1
|
||||||
@@ -217,7 +86,9 @@ typedef unsigned char uint8_t;
|
|||||||
#cmakedefine HAVE_STDBOOL_H 1
|
#cmakedefine HAVE_STDBOOL_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdint.h> header file. */
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
#cmakedefine HAVE_STDINT_H 1
|
#ifdef KWIML_INT_HAVE_STDINT_H
|
||||||
|
# define HAVE_STDINT_H 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Define to 1 if you have the <strings.h> header file. */
|
/* Define to 1 if you have the <strings.h> header file. */
|
||||||
#cmakedefine HAVE_STRINGS_H 1
|
#cmakedefine HAVE_STRINGS_H 1
|
||||||
|
Reference in New Issue
Block a user