]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl-rustls.m4: set linker flags to allow rustls build on macos
authorStefan Eissing <stefan@eissing.org>
Mon, 7 Oct 2024 13:58:26 +0000 (15:58 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Sun, 13 Oct 2024 21:10:45 +0000 (23:10 +0200)
Assisted-by: Viktor Szakats
Closes #15175

m4/curl-rustls.m4

index fa0118ec7f31a4a2526f59d2260bbedc0dace70a..fdcbfcd5b16c946cb0e7f23ea68634774d8f3140 100644 (file)
@@ -34,13 +34,6 @@ if test "x$OPT_RUSTLS" != xno; then
   CLEANLDFLAGS="$LDFLAGS"
   CLEANCPPFLAGS="$CPPFLAGS"
 
-  case $host in
-    *-apple-*)
-      LDFLAGS="$LDFLAGS -framework Security"
-      ;;
-    *)
-      ;;
-  esac
   ## NEW CODE
 
   dnl use pkg-config unless we have been given a path
@@ -88,6 +81,14 @@ if test "x$OPT_RUSTLS" != xno; then
             CPPFLAGS="$CPPFLAGS $addcflags"
         fi
 
+        case $host in
+          *-apple-*)
+            RUSTLS_LDFLAGS="-framework Security -framework Foundation"
+            ;;
+          *)
+            RUSTLS_LDFLAGS="-lpthread -ldl -lm"
+            ;;
+        esac
         AC_CHECK_LIB(rustls, rustls_connection_read,
           [
           AC_DEFINE(USE_RUSTLS, 1, [if Rustls is enabled])
@@ -98,11 +99,11 @@ if test "x$OPT_RUSTLS" != xno; then
           test rustls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
           ],
           AC_MSG_ERROR([--with-rustls was specified but could not find Rustls.]),
-          -lpthread -ldl -lm)
+          $RUSTLS_LDFLAGS)
 
         LIB_RUSTLS="$PREFIX_RUSTLS/lib$libsuff"
         if test "$PREFIX_RUSTLS" != "/usr" ; then
-          SSL_LDFLAGS="-L$LIB_RUSTLS"
+          SSL_LDFLAGS="-L$LIB_RUSTLS $RUSTLS_LDFLAGS"
           SSL_CPPFLAGS="-I$PREFIX_RUSTLS/include"
         fi
       fi