64-bit type detection.
This commit is contained in:
parent
b886cd4864
commit
fdeaec5e05
@ -447,31 +447,61 @@ ELSE(BIGENDIAN EQUAL 0)
|
||||
SET(VMIME_BYTE_ORDER_LITTLE_ENDIAN 0)
|
||||
ENDIF(BIGENDIAN EQUAL 0)
|
||||
|
||||
SET(VMIME_DEFAULT_8BIT_TYPE "char")
|
||||
SET(VMIME_DEFAULT_16BIT_TYPE "short")
|
||||
SET(VMIME_DEFAULT_32BIT_TYPE "int")
|
||||
|
||||
CHECK_TYPE_SIZE("char" SIZEOF_CHAR)
|
||||
CHECK_TYPE_SIZE("short" SIZEOF_SHORT)
|
||||
CHECK_TYPE_SIZE("int" SIZEOF_INT)
|
||||
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
|
||||
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
|
||||
CHECK_TYPE_SIZE("__int64" SIZEOF___INT64)
|
||||
|
||||
SET(
|
||||
VMIME_8BIT_TYPE
|
||||
${VMIME_DEFAULT_8BIT_TYPE}
|
||||
CACHE STRING
|
||||
"The C-language 8-bit type for your platform"
|
||||
)
|
||||
IF(SIZEOF_CHAR EQUAL 1)
|
||||
SET(VMIME_8BIT_TYPE "char")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Cannot determine 8-bit type")
|
||||
ENDIF()
|
||||
|
||||
SET(
|
||||
VMIME_16BIT_TYPE
|
||||
${VMIME_DEFAULT_16BIT_TYPE}
|
||||
CACHE STRING
|
||||
"The C-language 16-bit type for your platform"
|
||||
)
|
||||
IF(SIZEOF_INT EQUAL 2)
|
||||
SET(VMIME_16BIT_TYPE "int")
|
||||
ELSE()
|
||||
IF(SIZEOF_SHORT EQUAL 2)
|
||||
SET(VMIME_16BIT_TYPE "short")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Cannot determine 16-bit type")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET(
|
||||
VMIME_32BIT_TYPE
|
||||
${VMIME_DEFAULT_32BIT_TYPE}
|
||||
CACHE STRING
|
||||
"The C-language 32-bit type for your platform"
|
||||
)
|
||||
IF(SIZEOF_INT EQUAL 4)
|
||||
SET(VMIME_32BIT_TYPE "int")
|
||||
ELSE()
|
||||
IF(SIZEOF_LONG EQUAL 4)
|
||||
SET(VMIME_32BIT_TYPE "long")
|
||||
ELSE()
|
||||
IF(SIZEOF_LONG_LONG EQUAL 4)
|
||||
SET(VMIME_32BIT_TYPE "long long")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Cannot determine 32-bit type")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(SIZEOF_INT EQUAL 8)
|
||||
SET(VMIME_64BIT_TYPE "int")
|
||||
ELSE()
|
||||
IF(SIZEOF_LONG EQUAL 8)
|
||||
SET(VMIME_64BIT_TYPE "long")
|
||||
ELSE()
|
||||
IF(SIZEOF_LONG_LONG EQUAL 8)
|
||||
SET(VMIME_64BIT_TYPE "long long")
|
||||
ELSE()
|
||||
IF(SIZEOF___INT64 EQUAL 8)
|
||||
SET(VMIME_64BIT_TYPE "__int64")
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Cannot determine 64-bit type")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
||||
INCLUDE(cmake/TargetArch.cmake)
|
||||
|
11
SConstruct
11
SConstruct
@ -605,6 +605,14 @@ opts.AddVariables(
|
||||
map = { },
|
||||
ignorecase = 1
|
||||
),
|
||||
EnumVariable(
|
||||
'pf_64bit_type',
|
||||
'The C-language 64-bit type for your platform',
|
||||
'long',
|
||||
allowed_values = ('char', 'short', 'int', 'long', 'long long'),
|
||||
map = { },
|
||||
ignorecase = 1
|
||||
),
|
||||
EnumVariable(
|
||||
'build_tests',
|
||||
'Build unit tests (run with "scons run-tests")',
|
||||
@ -876,6 +884,9 @@ config_hpp.write('typedef unsigned ' + env['pf_16bit_type'] + ' vmime_uint16;\n'
|
||||
config_hpp.write('// -- 32-bit\n')
|
||||
config_hpp.write('typedef signed ' + env['pf_32bit_type'] + ' vmime_int32;\n')
|
||||
config_hpp.write('typedef unsigned ' + env['pf_32bit_type'] + ' vmime_uint32;\n')
|
||||
config_hpp.write('// -- 64-bit\n')
|
||||
config_hpp.write('typedef signed ' + env['pf_64bit_type'] + ' vmime_int64;\n')
|
||||
config_hpp.write('typedef unsigned ' + env['pf_64bit_type'] + ' vmime_uint64;\n')
|
||||
config_hpp.write('\n')
|
||||
config_hpp.write('#define VMIME_HAVE_SIZE_T 1\n')
|
||||
config_hpp.write('\n')
|
||||
|
@ -37,6 +37,9 @@ typedef unsigned @VMIME_16BIT_TYPE@ vmime_uint16;
|
||||
// -- 32-bit
|
||||
typedef signed @VMIME_32BIT_TYPE@ vmime_int32;
|
||||
typedef unsigned @VMIME_32BIT_TYPE@ vmime_uint32;
|
||||
// -- 64-bit
|
||||
typedef signed @VMIME_64BIT_TYPE@ vmime_int64;
|
||||
typedef unsigned @VMIME_64BIT_TYPE@ vmime_uint64;
|
||||
|
||||
#cmakedefine01 VMIME_HAVE_SIZE_T
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user