curl-rustls.m4: set linker flags to allow rustls build on macos

Assisted-by: Viktor Szakats
Closes #15175
This commit is contained in:
Stefan Eissing 2024-10-07 15:58:26 +02:00 committed by Daniel Stenberg
parent 960521d210
commit aa43b42461
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View 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