diff --git a/Modules/CheckTypeSize.c b/Modules/CheckTypeSize.c index f8142892b..07fe62bde 100644 --- a/Modules/CheckTypeSize.c +++ b/Modules/CheckTypeSize.c @@ -8,6 +8,10 @@ # include #endif /* HAVE_STDINT_H */ +#ifdef HAVE_STDDEF_H +# include +#endif /* HAVE_STDDEF_H */ + #ifdef __CLASSIC_C__ int main(){ int ac; diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 2f3f1077f..dcd9149aa 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -12,13 +12,12 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE) IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") SET(MACRO_CHECK_TYPE_SIZE_FLAGS "-DCHECK_TYPE_SIZE_TYPE=\"${TYPE}\" ${CMAKE_REQUIRED_FLAGS}") - IF(HAVE_SYS_TYPES_H) - SET(MACRO_CHECK_TYPE_SIZE_FLAGS - "${MACRO_CHECK_TYPE_SIZE_FLAGS} -DHAVE_SYS_TYPES_H") - ENDIF(HAVE_SYS_TYPES_H) - IF(HAVE_STDINT_H) - SET(MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -DHAVE_STDINT_H") - ENDIF(HAVE_STDINT_H) + FOREACH(def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H) + IF("${def}") + SET(MACRO_CHECK_TYPE_SIZE_FLAGS + "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}") + ENDIF("${def}") + ENDFOREACH(def) MESSAGE(STATUS "Check size of ${TYPE}") IF(CMAKE_REQUIRED_LIBRARIES) SET(CHECK_TYPE_SIZE_ADD_LIBRARIES