Add basic zlib support to LLVM. This would allow to use compression/uncompression...
[oota-llvm.git] / cmake / config-ix.cmake
index 7cad190c11a08c1e02b9e696e3027c76d951a3e5..c426f41f5c9f80eaf837203aaf0c1976bffe5873 100755 (executable)
@@ -79,6 +79,7 @@ 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)
@@ -104,6 +105,7 @@ if( NOT PURE_WINDOWS )
   endif()
   check_library_exists(dl dlopen "" HAVE_LIBDL)
   check_library_exists(rt clock_gettime "" HAVE_LIBRT)
+  check_library_exists(z compress2 "" HAVE_LIBZ)
 endif()
 
 # function checks
@@ -450,4 +452,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})