Added support for standard 64-bit integer type.

This commit is contained in:
Vincent Richard 2013-09-02 10:12:08 +02:00
parent 86f0e14ea5
commit 5084db331c
2 changed files with 21 additions and 4 deletions

View File

@ -17,6 +17,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.6 FATAL_ERROR)
INCLUDE(cmake/Utils.cmake)
INCLUDE(CheckIncludeFiles)
INCLUDE(CheckIncludeFileCxx)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckSymbolExists)
INCLUDE(CheckTypeSize)
@ -448,6 +449,8 @@ ELSE(BIGENDIAN EQUAL 0)
ENDIF(BIGENDIAN EQUAL 0)
CHECK_INCLUDE_FILE_CXX(cstdint VMIME_HAVE_CSTDINT)
CHECK_TYPE_SIZE("char" SIZEOF_CHAR)
CHECK_TYPE_SIZE("short" SIZEOF_SHORT)
CHECK_TYPE_SIZE("int" SIZEOF_INT)
@ -455,6 +458,11 @@ CHECK_TYPE_SIZE("long" SIZEOF_LONG)
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
CHECK_TYPE_SIZE("__int64" SIZEOF___INT64)
SET(CMAKE_EXTRA_INCLUDE_FILES cstdint)
CHECK_TYPE_SIZE("int64_t" SIZEOF_INT64_T)
SET(CMAKE_EXTRA_INCLUDE_FILES)
IF(SIZEOF_CHAR EQUAL 1)
SET(VMIME_8BIT_TYPE "char")
ELSE()
@ -493,6 +501,9 @@ ELSE()
ELSE()
IF(SIZEOF_LONG_LONG EQUAL 8)
SET(VMIME_64BIT_TYPE "long long")
ELSE()
IF(SIZEOF_INT64_T EQUAL 8)
SET(VMIME_64BIT_TYPE "int64_t")
ELSE()
IF(SIZEOF___INT64 EQUAL 8)
SET(VMIME_64BIT_TYPE "__int64")
@ -502,6 +513,7 @@ ELSE()
ENDIF()
ENDIF()
ENDIF()
ENDIF()
INCLUDE(cmake/TargetArch.cmake)
@ -895,7 +907,7 @@ ELSE()
SET(
CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -D_REENTRANT=1 -W -Wall -ansi -pedantic -Wpointer-arith -Wold-style-cast -Wconversion -Wcast-align"
"${CMAKE_CXX_FLAGS} -D_REENTRANT=1 -W -Wall -ansi -pedantic -Wpointer-arith -Wold-style-cast -Wconversion -Wcast-align -Wno-long-long"
CACHE STRING
"g++ Compiler Flags"
FORCE

View File

@ -28,6 +28,11 @@
#define VMIME_BYTE_ORDER_LITTLE_ENDIAN @VMIME_BYTE_ORDER_LITTLE_ENDIAN@
// Generic types
#cmakedefine01 VMIME_HAVE_CSTDINT
#if VMIME_HAVE_CSTDINT
# include <cstdint>
#endif
// -- 8-bit
typedef signed @VMIME_8BIT_TYPE@ vmime_int8;
typedef unsigned @VMIME_8BIT_TYPE@ vmime_uint8;