R600: Add ISA documents to the CompilerWriterInfo page
[oota-llvm.git] / cmake / config-ix.cmake
index f077ecaf579fcc8c9e3fa2cd1c9ec9851b14b789..ae914d244f8e289b2ae4989f3f21dfcd9b5a854f 100755 (executable)
@@ -4,6 +4,7 @@ if( WIN32 AND NOT CYGWIN )
 endif()
 
 include(CheckIncludeFile)
+include(CheckIncludeFileCXX)
 include(CheckLibraryExists)
 include(CheckSymbolExists)
 include(CheckFunctionExists)
@@ -37,6 +38,7 @@ endfunction()
 check_include_file(argz.h HAVE_ARGZ_H)
 check_include_file(assert.h HAVE_ASSERT_H)
 check_include_file(ctype.h HAVE_CTYPE_H)
+check_include_file_cxx(cxxabi.h HAVE_CXXABI_H)
 check_include_file(dirent.h HAVE_DIRENT_H)
 check_include_file(dl.h HAVE_DL_H)
 check_include_file(dld.h HAVE_DLD_H)
@@ -79,7 +81,11 @@ check_include_file(unistd.h HAVE_UNISTD_H)
 check_include_file(utime.h HAVE_UTIME_H)
 check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H)
 check_include_file(windows.h HAVE_WINDOWS_H)
+check_include_file(zlib.h HAVE_ZLIB_H)
 check_include_file(fenv.h HAVE_FENV_H)
+check_symbol_exists(FE_ALL_EXCEPT "fenv.h" HAVE_DECL_FE_ALL_EXCEPT)
+check_symbol_exists(FE_INEXACT "fenv.h" HAVE_DECL_FE_INEXACT)
+
 check_include_file(mach/mach.h HAVE_MACH_MACH_H)
 check_include_file(mach-o/dyld.h HAVE_MACH_O_DYLD_H)
 
@@ -101,6 +107,11 @@ if( NOT PURE_WINDOWS )
   endif()
   check_library_exists(dl dlopen "" HAVE_LIBDL)
   check_library_exists(rt clock_gettime "" HAVE_LIBRT)
+  if (LLVM_ENABLE_ZLIB)
+    check_library_exists(z compress2 "" HAVE_LIBZ)
+  else()
+    set(HAVE_LIBZ 0)
+  endif()
 endif()
 
 # function checks
@@ -119,12 +130,14 @@ check_symbol_exists(isnan math.h HAVE_ISNAN_IN_MATH_H)
 check_symbol_exists(ceilf math.h HAVE_CEILF)
 check_symbol_exists(floorf math.h HAVE_FLOORF)
 check_symbol_exists(fmodf math.h HAVE_FMODF)
-check_symbol_exists(log "math.h cmath" HAVE_LOG)
-check_symbol_exists(log2 "math.h cmath" HAVE_LOG2)
-check_symbol_exists(log10 "math.h cmath" HAVE_LOG10)
-check_symbol_exists(exp "math.h cmath" HAVE_EXP)
-check_symbol_exists(exp2 "math.h cmath" HAVE_EXP2)
-check_symbol_exists(exp10 "math.h cmath" HAVE_EXP10)
+check_symbol_exists(log math.h HAVE_LOG)
+check_symbol_exists(log2 math.h HAVE_LOG2)
+check_symbol_exists(log10 math.h HAVE_LOG10)
+check_symbol_exists(exp math.h HAVE_EXP)
+check_symbol_exists(exp2 math.h HAVE_EXP2)
+check_symbol_exists(exp10 math.h HAVE_EXP10)
+check_symbol_exists(futimens sys/stat.h HAVE_FUTIMENS)
+check_symbol_exists(futimes sys/time.h HAVE_FUTIMES)
 if( HAVE_SETJMP_H )
   check_symbol_exists(longjmp setjmp.h HAVE_LONGJMP)
   check_symbol_exists(setjmp setjmp.h HAVE_SETJMP)
@@ -240,7 +253,8 @@ check_type_exists(error_t errno.h HAVE_ERROR_T)
 function(llvm_find_program name)
   string(TOUPPER ${name} NAME)
   string(REGEX REPLACE "\\." "_" NAME ${NAME})
-  find_program(LLVM_PATH_${NAME} ${name})
+
+  find_program(LLVM_PATH_${NAME} NAMES ${ARGV})
   mark_as_advanced(LLVM_PATH_${NAME})
   if(LLVM_PATH_${NAME})
     set(HAVE_${NAME} 1 CACHE INTERNAL "Is ${name} available ?")
@@ -257,7 +271,7 @@ llvm_find_program(neato)
 llvm_find_program(fdp)
 llvm_find_program(dot)
 llvm_find_program(dotty)
-llvm_find_program(xdot.py)
+llvm_find_program(xdot xdot.py)
 llvm_find_program(Graphviz)
 
 if( LLVM_ENABLE_FFI )
@@ -329,12 +343,13 @@ if (CMAKE_COMPILER_IS_GNUCXX)
   endif()
 endif()
 
-include(GetHostTriple)
-get_host_triple(LLVM_HOST_TRIPLE)
-
 # By default, we target the host, but this can be overridden at CMake
 # invocation time.
-set(LLVM_HOSTTRIPLE "${LLVM_HOST_TRIPLE}")
+include(GetHostTriple)
+get_host_triple(LLVM_INFERRED_HOST_TRIPLE)
+
+set(LLVM_HOST_TRIPLE "${LLVM_INFERRED_HOST_TRIPLE}" CACHE STRING
+    "Host on which LLVM binaries will run")
 
 # Determine the native architecture.
 string(TOLOWER "${LLVM_TARGET_ARCH}" LLVM_NATIVE_ARCH)
@@ -354,6 +369,8 @@ elseif (LLVM_NATIVE_ARCH MATCHES "sparc")
   set(LLVM_NATIVE_ARCH Sparc)
 elseif (LLVM_NATIVE_ARCH MATCHES "powerpc")
   set(LLVM_NATIVE_ARCH PowerPC)
+elseif (LLVM_NATIVE_ARCH MATCHES "aarch64")
+  set(LLVM_NATIVE_ARCH AArch64)
 elseif (LLVM_NATIVE_ARCH MATCHES "arm")
   set(LLVM_NATIVE_ARCH ARM)
 elseif (LLVM_NATIVE_ARCH MATCHES "mips")
@@ -364,10 +381,20 @@ elseif (LLVM_NATIVE_ARCH MATCHES "msp430")
   set(LLVM_NATIVE_ARCH MSP430)
 elseif (LLVM_NATIVE_ARCH MATCHES "hexagon")
   set(LLVM_NATIVE_ARCH Hexagon)
+elseif (LLVM_NATIVE_ARCH MATCHES "s390x")
+  set(LLVM_NATIVE_ARCH SystemZ)
 else ()
   message(FATAL_ERROR "Unknown architecture ${LLVM_NATIVE_ARCH}")
 endif ()
 
+# If build targets includes "host", then replace with native architecture.
+list(FIND LLVM_TARGETS_TO_BUILD "host" idx)
+if( NOT idx LESS 0 )
+  list(REMOVE_AT LLVM_TARGETS_TO_BUILD ${idx})
+  list(APPEND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH})
+  list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD)
+endif()
+
 list(FIND LLVM_TARGETS_TO_BUILD ${LLVM_NATIVE_ARCH} NATIVE_ARCH_IDX)
 if (NATIVE_ARCH_IDX EQUAL -1)
   message(STATUS
@@ -400,7 +427,6 @@ endif( MINGW )
 
 if( MSVC )
   set(error_t int)
-  set(LTDL_SHLIBPATH_VAR "PATH")
   set(LTDL_SYSSEARCHPATH "")
   set(LTDL_DLOPEN_DEPLIBS 1)
   set(SHLIBEXT ".lib")
@@ -411,7 +437,6 @@ if( MSVC )
   set(stricmp "_stricmp")
   set(strdup "_strdup")
 else( MSVC )
-  set(LTDL_SHLIBPATH_VAR "LD_LIBRARY_PATH")
   set(LTDL_SYSSEARCHPATH "") # TODO
   set(LTDL_DLOPEN_DEPLIBS 0)  # TODO
 endif( MSVC )
@@ -447,4 +472,11 @@ else( LLVM_ENABLE_THREADS )
   message(STATUS "Threads disabled.")
 endif()
 
+if (LLVM_ENABLE_ZLIB )
+  # Check if zlib is available in the system.
+  if ( NOT HAVE_ZLIB_H OR NOT HAVE_LIBZ )
+    set(LLVM_ENABLE_ZLIB 0)
+  endif()
+endif()
+
 set(LLVM_PREFIX ${CMAKE_INSTALL_PREFIX})