diff options
| author | Hans Wennborg <hans@chromium.org> | 2020-03-03 09:45:14 +0100 |
|---|---|---|
| committer | Hans Wennborg <hans@chromium.org> | 2020-03-03 14:31:05 +0100 |
| commit | 5f9211bc46fa1a8d1db3a2bc27c2b115cd617795 (patch) | |
| tree | 24cc9f1548a9fe44c228bb76c9e6f5d09a879e3c /llvm/cmake | |
| parent | 001c8aac80e3924c33a4cc644cca58401c72fe6b (diff) | |
| download | bcm5719-llvm-5f9211bc46fa1a8d1db3a2bc27c2b115cd617795.tar.gz bcm5719-llvm-5f9211bc46fa1a8d1db3a2bc27c2b115cd617795.zip | |
Revert abb00753 "build: reduce CMake handling for zlib" (PR44780)
and follow-ups:
a2ca1c2d "build: disable zlib by default on Windows"
2181bf40 "[CMake] Link against ZLIB::ZLIB"
1079c68a "Attempt to fix ZLIB CMake logic on Windows"
This changed the output of llvm-config --system-libs, and more
importantly it broke stand-alone builds. Instead of piling on more fix
attempts, let's revert this to reduce the risk of more breakages.
(cherry picked from commit 916be8fd6a0a0feea4cefcbeb0c22c65848d7a2e)
Diffstat (limited to 'llvm/cmake')
| -rw-r--r-- | llvm/cmake/config-ix.cmake | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index fc66dbfcbe7..f758366bc79 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -56,6 +56,7 @@ check_include_file(sys/types.h HAVE_SYS_TYPES_H) check_include_file(termios.h HAVE_TERMIOS_H) check_include_file(unistd.h HAVE_UNISTD_H) check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_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) @@ -117,6 +118,19 @@ endif() # Don't look for these libraries if we're using MSan, since uninstrumented third # party code may call MSan interceptors like strlen, leading to false positives. if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") + set(HAVE_LIBZ 0) + if(LLVM_ENABLE_ZLIB) + foreach(library z zlib_static zlib) + string(TOUPPER ${library} library_suffix) + check_library_exists(${library} compress2 "" HAVE_LIBZ_${library_suffix}) + if(HAVE_LIBZ_${library_suffix}) + set(HAVE_LIBZ 1) + set(ZLIB_LIBRARIES "${library}") + break() + endif() + endforeach() + endif() + # Don't look for these libraries on Windows. if (NOT PURE_WINDOWS) # Skip libedit if using ASan as it contains memory leaks. @@ -501,21 +515,10 @@ else( LLVM_ENABLE_THREADS ) message(STATUS "Threads disabled.") endif() -if(LLVM_ENABLE_ZLIB) - if(LLVM_ENABLE_ZLIB STREQUAL FORCE_ON) - find_package(ZLIB REQUIRED) - else() - find_package(ZLIB) - endif() - - if(ZLIB_FOUND) - set(LLVM_ENABLE_ZLIB "YES" CACHE STRING - "Use zlib for compression/decompression if available. Can be ON, OFF, or FORCE_ON" - FORCE) - else() - set(LLVM_ENABLE_ZLIB "NO" CACHE STRING - "Use zlib for compression/decompression if available. Can be ON, OFF, or FORCE_ON" - FORCE) +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() |

