]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake, configure: also link with CoreServices
authorRyan Schmidt <git@ryandesign.com>
Wed, 20 Sep 2023 01:36:39 +0000 (20:36 -0500)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 20 Sep 2023 06:38:19 +0000 (08:38 +0200)
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
m4/curl-sectransp.m4
m4/curl-sysconfig.m4

index 876e1294b5fb57a782e79bb8b03f8bd1473ab8ad..1a2e08d7fdc243e2fdd931c21fd9f5b6e5e7427f 100644 (file)
@@ -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)
index fc0ad9eb0c19db71767c4c1c33b402b164851174..77b37bed9d72338683ba88752adc50196d418ac4 100644 (file)
@@ -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
index cb787de7e961fc9664db5fceaeaceca9914ccbf9..9b287bc76213cce8c6583cfb5c18bd13ea0380b2 100644 (file)
@@ -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