From 6ab7e1990bd548059f08c471d20537bca13c67b6 Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Tue, 19 Sep 2023 20:36:39 -0500 Subject: [PATCH] cmake, configure: also link with CoreServices When linking with CoreFoundation, also link with CoreServices which is apparently required to avoid an NSInvalidArgumentException in software linking with libcurl on macOS Sonoma 14 and later. Fixes #11893 Closes #11894 --- CMakeLists.txt | 13 +++++++++---- m4/curl-sectransp.m4 | 2 +- m4/curl-sysconfig.m4 | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 876e1294b5..1a2e08d7fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -302,7 +302,7 @@ if(ENABLE_IPV6 AND NOT WIN32) endif() if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND NOT ENABLE_ARES) - set(use_core_foundation ON) + set(use_core_foundation_and_core_services ON) find_library(SYSTEMCONFIGURATION_FRAMEWORK "SystemConfiguration") if(NOT SYSTEMCONFIGURATION_FRAMEWORK) @@ -445,7 +445,7 @@ if(CURL_WINDOWS_SSPI) endif() if(CURL_USE_SECTRANSP) - set(use_core_foundation ON) + set(use_core_foundation_and_core_services ON) find_library(SECURITY_FRAMEWORK "Security") if(NOT SECURITY_FRAMEWORK) @@ -457,13 +457,18 @@ if(CURL_USE_SECTRANSP) list(APPEND CURL_LIBS "-framework Security") endif() -if(use_core_foundation) +if(use_core_foundation_and_core_services) find_library(COREFOUNDATION_FRAMEWORK "CoreFoundation") + find_library(CORESERVICES_FRAMEWORK "CoreServices") + if(NOT COREFOUNDATION_FRAMEWORK) message(FATAL_ERROR "CoreFoundation framework not found") endif() + if(NOT CORESERVICES_FRAMEWORK) + message(FATAL_ERROR "CoreServices framework not found") + endif() - list(APPEND CURL_LIBS "-framework CoreFoundation") + list(APPEND CURL_LIBS "-framework CoreFoundation -framework CoreServices") endif() if(CURL_USE_OPENSSL) diff --git a/m4/curl-sectransp.m4 b/m4/curl-sectransp.m4 index fc0ad9eb0c..77b37bed9d 100644 --- a/m4/curl-sectransp.m4 +++ b/m4/curl-sectransp.m4 @@ -33,7 +33,7 @@ if test "x$OPT_SECURETRANSPORT" != xno; then ssl_msg="Secure Transport" test secure-transport != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes SECURETRANSPORT_ENABLED=1 - LDFLAGS="$LDFLAGS -framework CoreFoundation -framework Security" + LDFLAGS="$LDFLAGS -framework CoreFoundation -framework CoreServices -framework Security" else AC_MSG_RESULT(no) fi diff --git a/m4/curl-sysconfig.m4 b/m4/curl-sysconfig.m4 index cb787de7e9..9b287bc762 100644 --- a/m4/curl-sysconfig.m4 +++ b/m4/curl-sysconfig.m4 @@ -23,7 +23,7 @@ #*************************************************************************** AC_DEFUN([CURL_DARWIN_SYSTEMCONFIGURATION], [ -AC_MSG_CHECKING([whether to link macOS CoreFoundation and SystemConfiguration framework]) +AC_MSG_CHECKING([whether to link macOS CoreFoundation, CoreServices, and SystemConfiguration frameworks]) case $host_os in darwin*) AC_COMPILE_IFELSE([ @@ -43,7 +43,7 @@ case $host_os in ]) if test "x$build_for_macos" != xno; then AC_MSG_RESULT(yes) - LDFLAGS="$LDFLAGS -framework CoreFoundation -framework SystemConfiguration" + LDFLAGS="$LDFLAGS -framework CoreFoundation -framework CoreServices -framework SystemConfiguration" else AC_MSG_RESULT(no) fi -- 2.47.2