From: Michael Kruse Date: Tue, 21 Jul 2015 12:09:41 +0000 (+0000) Subject: Add a test for stdint.h like ISL's configure does X-Git-Tag: studio-1.4~2010 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9e44f2f1cc173390febd5ef0e56bd48833f2af27;p=platform%2Fupstream%2Fllvm.git Add a test for stdint.h like ISL's configure does Reviewers: grosser llvm-svn: 242772 --- diff --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt index 704da24..ce35e08 100644 --- a/polly/lib/CMakeLists.txt +++ b/polly/lib/CMakeLists.txt @@ -58,6 +58,21 @@ function (check_c_source_compiles_numeric _prog _var) endif () endfunction () +# Check for the existance of a type +function (check_c_type_exists _type _files _variable) + set(_includes "") + foreach (file_name ${_files}) + set(_includes "${_includes}#include<${file_name}>\n") + endforeach() + check_c_source_compiles(" + ${_includes} + ${_type} typeVar; + int main() { + return 0; + } + " ${_variable}) +endfunction () + check_c_source_compiles(" int func(void) __attribute__((__warn_unused_result__)); @@ -139,6 +154,23 @@ if (NOT HAVE_DECL_SNPRINTF AND NOT HAVE_DECL__SNPRINTF) message(FATAL_ERROR "No snprintf implementation found") endif () + +check_c_type_exists(uint8_t "" HAVE_UINT8T) +check_c_type_exists(uint8_t "stdint.h" HAVE_STDINT_H) +check_c_type_exists(uint8_t "inttypes.h" HAVE_INTTYPES_H) +check_c_type_exists(uint8_t "sys/types.h" HAVE_SYS_INTTYPES_H) +if (HAVE_UINT8T) + set(INCLUDE_STDINT_H "") +elseif (HAVE_STDINT_H) + set(INCLUDE_STDINT_H "#include ") +elseif (HAVE_INTTYPES_H) + set(INCLUDE_STDINT_H "#include ") +elseif (HAVE_SYS_INTTYPES_H) + set(INCLUDE_STDINT_H "#include ") +else () + message(FATAL_ERROR "No stdint.h or compatible found") +endif () + # Write configure result # configure_file(... COPYONLY) avoids that the time stamp changes if the file is identical file(WRITE "${ISL_BINARY_DIR}/gitversion.h.tmp" @@ -146,8 +178,14 @@ file(WRITE "${ISL_BINARY_DIR}/gitversion.h.tmp" configure_file("${ISL_BINARY_DIR}/gitversion.h.tmp" "${ISL_BINARY_DIR}/gitversion.h" COPYONLY) +file(WRITE "${ISL_BINARY_DIR}/include/isl/stdint.h.tmp" + "${INCLUDE_STDINT_H}") +configure_file("${ISL_BINARY_DIR}/include/isl/stdint.h.tmp" + "${ISL_BINARY_DIR}/include/isl/stdint.h" COPYONLY) + configure_file("External/isl_config.h.cmake" "${ISL_BINARY_DIR}/isl_config.h") + # ISL files to compile set (ISL_FILES External/isl/basis_reduction_tab.c