[polly] r242772 - Add a test for stdint.h like ISL's configure does
Michael Kruse
llvm at meinersbur.de
Tue Jul 21 05:09:41 PDT 2015
Author: meinersbur
Date: Tue Jul 21 07:09:41 2015
New Revision: 242772
URL: http://llvm.org/viewvc/llvm-project?rev=242772&view=rev
Log:
Add a test for stdint.h like ISL's configure does
Reviewers: grosser
Modified:
polly/trunk/lib/CMakeLists.txt
Modified: polly/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CMakeLists.txt?rev=242772&r1=242771&r2=242772&view=diff
==============================================================================
--- polly/trunk/lib/CMakeLists.txt (original)
+++ polly/trunk/lib/CMakeLists.txt Tue Jul 21 07:09:41 2015
@@ -58,6 +58,21 @@ function (check_c_source_compiles_numeri
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_
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 <stdint.h>")
+elseif (HAVE_INTTYPES_H)
+ set(INCLUDE_STDINT_H "#include <inttypes.h>")
+elseif (HAVE_SYS_INTTYPES_H)
+ set(INCLUDE_STDINT_H "#include <sys/inttypes.h>")
+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
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
More information about the llvm-commits
mailing list