Index: clang/CMakeLists.txt =================================================================== --- clang/CMakeLists.txt +++ clang/CMakeLists.txt @@ -110,6 +110,10 @@ option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF) option(LLVM_ENABLE_LIBXML2 "Use libxml2 if available." ON) + if(LLVM_ENABLE_ZLIB) + find_package(ZLIB) + endif() + include(AddLLVM) include(TableGen) include(HandleLLVMOptions) Index: clang/test/CMakeLists.txt =================================================================== --- clang/test/CMakeLists.txt +++ clang/test/CMakeLists.txt @@ -9,15 +9,6 @@ string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) -if(CLANG_BUILT_STANDALONE) - # Set HAVE_LIBZ according to recorded LLVM_ENABLE_ZLIB value. This - # value is forced to 0 if zlib was not found, so it is fine to use it - # instead of HAVE_LIBZ (not recorded). - if(LLVM_ENABLE_ZLIB) - set(HAVE_LIBZ 1) - endif() -endif() - llvm_canonicalize_cmake_booleans( CLANG_BUILD_EXAMPLES CLANG_ENABLE_ARCMT @@ -25,7 +16,7 @@ CLANG_SPAWN_CC1 ENABLE_BACKTRACES ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER - HAVE_LIBZ + LLVM_ENABLE_ZLIB LLVM_ENABLE_PER_TARGET_RUNTIME_DIR LLVM_ENABLE_PLUGINS LLVM_ENABLE_THREADS) Index: clang/test/lit.site.cfg.py.in =================================================================== --- clang/test/lit.site.cfg.py.in +++ clang/test/lit.site.cfg.py.in @@ -16,7 +16,7 @@ config.target_triple = "@TARGET_TRIPLE@" config.host_cxx = "@CMAKE_CXX_COMPILER@" config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" -config.have_zlib = @HAVE_LIBZ@ +config.have_zlib = @LLVM_ENABLE_ZLIB@ config.clang_arcmt = @CLANG_ENABLE_ARCMT@ config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@" config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@ Index: compiler-rt/cmake/config-ix.cmake =================================================================== --- compiler-rt/cmake/config-ix.cmake +++ compiler-rt/cmake/config-ix.cmake @@ -124,17 +124,16 @@ check_library_exists(execinfo backtrace "" COMPILER_RT_HAS_LIBEXECINFO) # Look for terminfo library, used in unittests that depend on LLVMSupport. -if(LLVM_ENABLE_TERMINFO) - foreach(library terminfo tinfo curses ncurses ncursesw) - string(TOUPPER ${library} library_suffix) - check_library_exists( - ${library} setupterm "" COMPILER_RT_HAS_TERMINFO_${library_suffix}) - if(COMPILER_RT_HAS_TERMINFO_${library_suffix}) - set(COMPILER_RT_HAS_TERMINFO TRUE) - set(COMPILER_RT_TERMINFO_LIB "${library}") - break() - endif() - endforeach() +if(LLVM_ENABLE_TERMINFO STREQUAL FORCE_ON) + set(MAYBE_REQUIRED REQUIRED) +else() + set(MAYBE_REQUIRED) +endif() +find_library(COMPILER_RT_TERMINFO_LIB NAMES terminfo tinfo curses ncurses ncursesw ${MAYBE_REQUIRED}) +if(COMPILER_RT_TERMINFO_LIB) + set(LLVM_ENABLE_TERMINFO 1) +else() + set(LLVM_ENABLE_TERMINFO 0) endif() if (ANDROID AND COMPILER_RT_HAS_LIBDL) Index: compiler-rt/lib/xray/tests/CMakeLists.txt =================================================================== --- compiler-rt/lib/xray/tests/CMakeLists.txt +++ compiler-rt/lib/xray/tests/CMakeLists.txt @@ -55,7 +55,7 @@ if (NOT APPLE) # Needed by LLVMSupport. append_list_if( - COMPILER_RT_HAS_TERMINFO + LLVM_ENABLE_TERMINFO -l${COMPILER_RT_TERMINFO_LIB} XRAY_UNITTEST_LINK_FLAGS) if (COMPILER_RT_STANDALONE_BUILD) Index: compiler-rt/test/lit.common.configured.in =================================================================== --- compiler-rt/test/lit.common.configured.in +++ compiler-rt/test/lit.common.configured.in @@ -50,7 +50,7 @@ else: set_default("target_suffix", "-%s" % config.target_arch) -set_default("have_zlib", "@HAVE_LIBZ@") +set_default("have_zlib", "@LLVM_ENABLE_ZLIB@") set_default("libcxx_used", "@LLVM_LIBCXX_USED@") # LLVM tools dir can be passed in lit parameters, so try to Index: lld/CMakeLists.txt =================================================================== --- lld/CMakeLists.txt +++ lld/CMakeLists.txt @@ -51,6 +51,10 @@ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin) find_program(LLVM_TABLEGEN_EXE "llvm-tblgen" ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH) + if(LLVM_ENABLE_ZLIB) + find_package(ZLIB) + endif() + include(AddLLVM) include(TableGen) include(HandleLLVMOptions) Index: lld/test/CMakeLists.txt =================================================================== --- lld/test/CMakeLists.txt +++ lld/test/CMakeLists.txt @@ -4,17 +4,8 @@ set(LLVM_TOOLS_DIR "${LLVM_TOOLS_BINARY_DIR}/%(build_config)s") set(LLVM_LIBS_DIR "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/%(build_config)s") -if(LLD_BUILT_STANDALONE) - # Set HAVE_LIBZ according to recorded LLVM_ENABLE_ZLIB value. This - # value is forced to 0 if zlib was not found, so it is fine to use it - # instead of HAVE_LIBZ (not recorded). - if(LLVM_ENABLE_ZLIB) - set(HAVE_LIBZ 1) - endif() -endif() - llvm_canonicalize_cmake_booleans( - HAVE_LIBZ + LLVM_ENABLE_ZLIB LLVM_LIBXML2_ENABLED ) Index: lld/test/lit.site.cfg.py.in =================================================================== --- lld/test/lit.site.cfg.py.in +++ lld/test/lit.site.cfg.py.in @@ -14,7 +14,7 @@ config.lld_tools_dir = "@LLVM_RUNTIME_OUTPUT_INTDIR@" config.target_triple = "@TARGET_TRIPLE@" config.python_executable = "@PYTHON_EXECUTABLE@" -config.have_zlib = @HAVE_LIBZ@ +config.have_zlib = @LLVM_ENABLE_ZLIB@ config.sizeof_void_p = @CMAKE_SIZEOF_VOID_P@ # Support substitution of the tools and libs dirs with user parameters. This is Index: lldb/cmake/modules/LLDBStandalone.cmake =================================================================== --- lldb/cmake/modules/LLDBStandalone.cmake +++ lldb/cmake/modules/LLDBStandalone.cmake @@ -73,6 +73,7 @@ # We append the directory in which LLVMConfig.cmake lives. We expect LLVM's # CMake modules to be in that directory as well. list(APPEND CMAKE_MODULE_PATH "${LLVM_DIR}") + include(AddLLVM) include(TableGen) include(HandleLLVMOptions) Index: lldb/source/Core/CMakeLists.txt =================================================================== --- lldb/source/Core/CMakeLists.txt +++ lldb/source/Core/CMakeLists.txt @@ -11,8 +11,8 @@ if (LLDB_ENABLE_CURSES) list(APPEND LLDB_CURSES_LIBS ${CURSES_LIBRARIES} ${PANEL_LIBRARIES}) - if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO) - list(APPEND LLDB_CURSES_LIBS ${TERMINFO_LIBS}) + if(LLVM_ENABLE_TERMINFO) + list(APPEND LLDB_CURSES_LIBS ${TERMINFO_LIB}) endif() if (LLVM_BUILD_STATIC) list(APPEND LLDB_CURSES_LIBS gpm) Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -50,7 +50,7 @@ #include #endif -#if defined(HAVE_LIBZ) +#if LLVM_ENABLE_ZLIB #include #endif @@ -582,7 +582,7 @@ } #endif -#if defined(HAVE_LIBZ) +#if LLVM_ENABLE_ZLIB if (decompressed_bytes == 0 && decompressed_bufsize != ULONG_MAX && decompressed_buffer != nullptr && m_compression_type == CompressionType::ZlibDeflate) { Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -1045,7 +1045,7 @@ } #endif -#if defined(HAVE_LIBZ) +#if LLVM_ENABLE_ZLIB if (avail_type == CompressionType::None) { for (auto compression : supported_compressions) { if (compression == "zlib-deflate") { Index: llvm/cmake/config-ix.cmake =================================================================== --- llvm/cmake/config-ix.cmake +++ llvm/cmake/config-ix.cmake @@ -9,6 +9,7 @@ include(CheckFunctionExists) include(CheckStructHasMember) include(CheckCCompilerFlag) +include(CMakePushCheckState) include(CheckCompilerVersion) include(HandleLLVMStdlib) @@ -56,7 +57,6 @@ 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) @@ -115,22 +115,30 @@ set(LLVM_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT}) endif() +if(LLVM_ENABLE_ZLIB) + if(LLVM_ENABLE_ZLIB STREQUAL FORCE_ON) + find_package(ZLIB REQUIRED) + elseif(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") + find_package(ZLIB) + endif() + if(ZLIB_FOUND) + # Check if zlib we found is usable; for example, we may have found a 32-bit + # library on a 64-bit system which would result in a link-time failure. + cmake_push_check_state() + set(CMAKE_REQUIRED_INCLUDES ${ZLIB_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARY}) + check_symbol_exists(compress2 zlib.h HAVE_ZLIB) + cmake_pop_check_state() + if(LLVM_ENABLE_ZLIB STREQUAL FORCE_ON AND NOT HAVE_ZLIB) + message(FATAL_ERROR "Failed to configure zlib") + endif() + endif() + set(LLVM_ENABLE_ZLIB "${HAVE_ZLIB}") +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. @@ -139,19 +147,16 @@ else() set(HAVE_LIBEDIT 0) endif() - if(LLVM_ENABLE_TERMINFO) - set(HAVE_TERMINFO 0) - foreach(library terminfo tinfo curses ncurses ncursesw) - string(TOUPPER ${library} library_suffix) - check_library_exists(${library} setupterm "" HAVE_TERMINFO_${library_suffix}) - if(HAVE_TERMINFO_${library_suffix}) - set(HAVE_TERMINFO 1) - set(TERMINFO_LIBS "${library}") - break() - endif() - endforeach() + if(LLVM_ENABLE_TERMINFO STREQUAL FORCE_ON) + set(MAYBE_REQUIRED REQUIRED) + else() + set(MAYBE_REQUIRED) + endif() + find_library(TERMINFO_LIB NAMES terminfo tinfo curses ncurses ncursesw ${MAYBE_REQUIRED}) + if(TERMINFO_LIB) + set(LLVM_ENABLE_TERMINFO 1) else() - set(HAVE_TERMINFO 0) + set(LLVM_ENABLE_TERMINFO 0) endif() find_library(ICONV_LIBRARY_PATH NAMES iconv libiconv libiconv-2 c) @@ -515,13 +520,6 @@ 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() - if (LLVM_ENABLE_DOXYGEN) message(STATUS "Doxygen enabled.") find_package(Doxygen REQUIRED) Index: llvm/cmake/modules/LLVMConfig.cmake.in =================================================================== --- llvm/cmake/modules/LLVMConfig.cmake.in +++ llvm/cmake/modules/LLVMConfig.cmake.in @@ -50,6 +50,9 @@ set(LLVM_ENABLE_UNWIND_TABLES @LLVM_ENABLE_UNWIND_TABLES@) set(LLVM_ENABLE_ZLIB @LLVM_ENABLE_ZLIB@) +if(LLVM_ENABLE_ZLIB) + find_package(ZLIB) +endif() set(LLVM_LIBXML2_ENABLED @LLVM_LIBXML2_ENABLED@) Index: llvm/include/llvm/Config/config.h.cmake =================================================================== --- llvm/include/llvm/Config/config.h.cmake +++ llvm/include/llvm/Config/config.h.cmake @@ -109,9 +109,6 @@ /* Define to 1 if you have the `pthread_setname_np' function. */ #cmakedefine HAVE_PTHREAD_SETNAME_NP ${HAVE_PTHREAD_SETNAME_NP} -/* Define to 1 if you have the `z' library (-lz). */ -#cmakedefine HAVE_LIBZ ${HAVE_LIBZ} - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LINK_H ${HAVE_LINK_H} @@ -212,7 +209,7 @@ #cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H} /* Define if the setupterm() function is supported this platform. */ -#cmakedefine HAVE_TERMINFO ${HAVE_TERMINFO} +#cmakedefine LLVM_ENABLE_TERMINFO ${LLVM_ENABLE_TERMINFO} /* Define if the xar_open() function is supported this platform. */ #cmakedefine HAVE_LIBXAR ${HAVE_LIBXAR} @@ -226,9 +223,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_VALGRIND_VALGRIND_H ${HAVE_VALGRIND_VALGRIND_H} -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_ZLIB_H ${HAVE_ZLIB_H} - /* Have host's _alloca */ #cmakedefine HAVE__ALLOCA ${HAVE__ALLOCA} Index: llvm/lib/Support/CMakeLists.txt =================================================================== --- llvm/lib/Support/CMakeLists.txt +++ llvm/lib/Support/CMakeLists.txt @@ -1,7 +1,16 @@ -set(system_libs) -if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ ) - set(system_libs ${system_libs} ${ZLIB_LIBRARIES}) +if(LLVM_ENABLE_ZLIB) + set(imported_libs ZLIB::ZLIB) endif() + +function(get_system_libname libpath libname) + get_filename_component(libpath ${libpath} NAME) + string(REPLACE ";" "|" PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}") + string(REPLACE ";" "|" SUFFIXES "${CMAKE_FIND_LIBRARY_SUFFIXES}") + STRING(REGEX REPLACE "^(${PREFIXES})" "" libpath ${libpath}) + STRING(REGEX REPLACE "(${SUFFIXES})$" "" libpath ${libpath}) + set(${libname} "${libpath}" PARENT_SCOPE) +endfunction() + if( MSVC OR MINGW ) # libuuid required for FOLDERID_Profile usage in lib/Support/Windows/Path.inc. # advapi32 required for CryptAcquireContextW in lib/Support/Windows/Path.inc. @@ -21,10 +30,8 @@ STRING(REGEX REPLACE "^lib" "" Backtrace_LIBFILE ${Backtrace_LIBFILE}) set(system_libs ${system_libs} ${Backtrace_LIBFILE}) endif() - if(LLVM_ENABLE_TERMINFO) - if(HAVE_TERMINFO) - set(system_libs ${system_libs} ${TERMINFO_LIBS}) - endif() + if( LLVM_ENABLE_TERMINFO ) + set(imported_libs ${imported_libs} "${TERMINFO_LIB}") endif() if( LLVM_ENABLE_THREADS AND HAVE_LIBATOMIC ) set(system_libs ${system_libs} atomic) @@ -186,10 +193,30 @@ ${LLVM_MAIN_INCLUDE_DIR}/llvm/ADT ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support ${Backtrace_INCLUDE_DIRS} - LINK_LIBS ${system_libs} ${delayload_flags} ${Z3_LINK_FILES} + LINK_LIBS ${system_libs} ${imported_libs} ${delayload_flags} ${Z3_LINK_FILES} ) -set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${system_libs}") +set(llvm_system_libs ${system_libs}) + +if(LLVM_ENABLE_ZLIB) + # CMAKE_BUILD_TYPE is only meaningful to single-configuration generators. + if(CMAKE_BUILD_TYPE) + string(TOUPPER ${CMAKE_BUILD_TYPE} build_type) + get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION_${build_type}) + endif() + if(NOT zlib_library) + get_property(zlib_library TARGET ZLIB::ZLIB PROPERTY LOCATION) + endif() + get_system_libname(${zlib_library} zlib_library) + set(llvm_system_libs ${llvm_system_libs} "${zlib_library}") +endif() + +if(LLVM_ENABLE_TERMINFO) + get_system_libname(${TERMINFO_LIB} terminfo_library) + set(llvm_system_libs ${llvm_system_libs} "${terminfo_library}") +endif() + +set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${llvm_system_libs}") if(LLVM_WITH_Z3) target_include_directories(LLVMSupport SYSTEM Index: llvm/lib/Support/CRC.cpp =================================================================== --- llvm/lib/Support/CRC.cpp +++ llvm/lib/Support/CRC.cpp @@ -25,7 +25,7 @@ using namespace llvm; -#if LLVM_ENABLE_ZLIB == 0 || !HAVE_ZLIB_H +#if !LLVM_ENABLE_ZLIB static const uint32_t CRCTable[256] = { 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, Index: llvm/lib/Support/Compression.cpp =================================================================== --- llvm/lib/Support/Compression.cpp +++ llvm/lib/Support/Compression.cpp @@ -17,13 +17,13 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/Error.h" #include "llvm/Support/ErrorHandling.h" -#if LLVM_ENABLE_ZLIB == 1 && HAVE_ZLIB_H +#if LLVM_ENABLE_ZLIB #include #endif using namespace llvm; -#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ +#if LLVM_ENABLE_ZLIB static Error createError(StringRef Err) { return make_error(Err, inconvertibleErrorCode()); } Index: llvm/lib/Support/Unix/Process.inc =================================================================== --- llvm/lib/Support/Unix/Process.inc +++ llvm/lib/Support/Unix/Process.inc @@ -315,7 +315,7 @@ return getColumns(2); } -#ifdef HAVE_TERMINFO +#ifdef LLVM_ENABLE_TERMINFO // We manually declare these extern functions because finding the correct // headers from various terminfo, curses, or other sources is harder than // writing their specs down. @@ -325,12 +325,12 @@ extern "C" int tigetnum(char *capname); #endif -#ifdef HAVE_TERMINFO +#ifdef LLVM_ENABLE_TERMINFO static ManagedStatic TermColorMutex; #endif static bool terminalHasColors(int fd) { -#ifdef HAVE_TERMINFO +#ifdef LLVM_ENABLE_TERMINFO // First, acquire a global lock because these C routines are thread hostile. std::lock_guard G(*TermColorMutex); Index: llvm/test/CMakeLists.txt =================================================================== --- llvm/test/CMakeLists.txt +++ llvm/test/CMakeLists.txt @@ -1,12 +1,12 @@ llvm_canonicalize_cmake_booleans( BUILD_SHARED_LIBS HAVE_LIBXAR - HAVE_LIBZ HAVE_OCAMLOPT HAVE_OCAML_OUNIT LLVM_ENABLE_DIA_SDK LLVM_ENABLE_FFI LLVM_ENABLE_THREADS + LLVM_ENABLE_ZLIB LLVM_INCLUDE_GO_TESTS LLVM_LIBXML2_ENABLED LLVM_LINK_LLVM_DYLIB Index: llvm/test/lit.site.cfg.py.in =================================================================== --- llvm/test/lit.site.cfg.py.in +++ llvm/test/lit.site.cfg.py.in @@ -33,7 +33,7 @@ config.host_ldflags = '@HOST_LDFLAGS@' config.llvm_use_intel_jitevents = @LLVM_USE_INTEL_JITEVENTS@ config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@" -config.have_zlib = @HAVE_LIBZ@ +config.have_zlib = @LLVM_ENABLE_ZLIB@ config.have_libxar = @HAVE_LIBXAR@ config.have_dia_sdk = @LLVM_ENABLE_DIA_SDK@ config.enable_ffi = @LLVM_ENABLE_FFI@ Index: llvm/unittests/Support/CompressionTest.cpp =================================================================== --- llvm/unittests/Support/CompressionTest.cpp +++ llvm/unittests/Support/CompressionTest.cpp @@ -21,7 +21,7 @@ namespace { -#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ +#if LLVM_ENABLE_ZLIB void TestZlibCompression(StringRef Input, int Level) { SmallString<32> Compressed; Index: llvm/utils/gn/secondary/clang/test/BUILD.gn =================================================================== --- llvm/utils/gn/secondary/clang/test/BUILD.gn +++ llvm/utils/gn/secondary/clang/test/BUILD.gn @@ -74,9 +74,9 @@ } if (llvm_enable_zlib) { - extra_values += [ "HAVE_LIBZ=1" ] + extra_values += [ "LLVM_ENABLE_ZLIB=1" ] } else { - extra_values += [ "HAVE_LIBZ=0" ] # Must be 0. + extra_values += [ "LLVM_ENABLE_ZLIB=0" ] # Must be 0. } if (host_cpu == "x64") { Index: llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn =================================================================== --- llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn +++ llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn @@ -85,8 +85,8 @@ } if (llvm_enable_zlib) { - values += [ "HAVE_LIBZ=1" ] + values += [ "LLVM_ENABLE_ZLIB=1" ] } else { - values += [ "HAVE_LIBZ=0" ] + values += [ "LLVM_ENABLE_ZLIB=0" ] } } Index: llvm/utils/gn/secondary/lld/test/BUILD.gn =================================================================== --- llvm/utils/gn/secondary/lld/test/BUILD.gn +++ llvm/utils/gn/secondary/lld/test/BUILD.gn @@ -49,9 +49,9 @@ } if (llvm_enable_zlib) { - extra_values += [ "HAVE_LIBZ=1" ] + extra_values += [ "LLVM_ENABLE_ZLIB=1" ] } else { - extra_values += [ "HAVE_LIBZ=0" ] # Must be 0. + extra_values += [ "LLVM_ENABLE_ZLIB=0" ] # Must be 0. } if (current_cpu == "x64" || current_cpu == "arm64" || Index: llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn =================================================================== --- llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn +++ llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn @@ -294,9 +294,9 @@ } if (llvm_enable_terminfo) { - values += [ "HAVE_TERMINFO=1" ] + values += [ "LLVM_ENABLE_TERMINFO=1" ] } else { - values += [ "HAVE_TERMINFO=" ] + values += [ "LLVM_ENABLE_TERMINFO=" ] } if (llvm_enable_dia_sdk) { Index: llvm/utils/gn/secondary/llvm/test/BUILD.gn =================================================================== --- llvm/utils/gn/secondary/llvm/test/BUILD.gn +++ llvm/utils/gn/secondary/llvm/test/BUILD.gn @@ -166,9 +166,9 @@ } if (llvm_enable_zlib) { - extra_values += [ "HAVE_LIBZ=1" ] + extra_values += [ "LLVM_ENABLE_ZLIB=1" ] } else { - extra_values += [ "HAVE_LIBZ=0" ] # Must be 0. + extra_values += [ "LLVM_ENABLE_ZLIB=0" ] # Must be 0. } }