From 5deccc8875fb46daeba4b674f187ed81f93005da Mon Sep 17 00:00:00 2001
From: "Kirill A. Korinsky" <kirill@korins.ky>
Date: Wed, 17 Aug 2022 15:22:09 +0200
Subject: [PATCH] compatibility with xar on macOS 10.5

macOS 10.5 uses very old xar which has `xar_open` but misses
`xar_extract_tobuffersz`, update the check for `check_library_exists`.
---
 llvm/cmake/config-ix.cmake              | 2 +-
 llvm/include/llvm/Config/config.h.cmake | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 90e5d327c757..e329520de154 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -179,7 +179,7 @@ if (LLVM_ENABLE_ZLIB STREQUAL "FORCE_ON" AND NOT HAVE_LIBZ)
   message(FATAL_ERROR "Failed to configure zlib")
 endif()
 
-check_library_exists(xar xar_open "" HAVE_LIBXAR)
+check_library_exists(xar xar_extract_tobuffersz "" HAVE_LIBXAR)
 if(HAVE_LIBXAR)
   set(XAR_LIB xar)
 endif()
diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake
index 9a682481ccaf..c37bcafb6a0f 100644
--- a/llvm/include/llvm/Config/config.h.cmake
+++ b/llvm/include/llvm/Config/config.h.cmake
@@ -211,7 +211,7 @@
 /* Define if the setupterm() function is supported this platform. */
 #cmakedefine HAVE_TERMINFO ${HAVE_TERMINFO}
 
-/* Define if the xar_open() function is supported this platform. */
+/* Define if the xar_extract_tobuffersz() function is supported this platform. */
 #cmakedefine HAVE_LIBXAR ${HAVE_LIBXAR}
 
 /* Define to 1 if you have the <termios.h> header file. */
-- 
2.37.2

