]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
m4: fix rustls pkg-config codepath
authorMatt Jolly <kangie@gentoo.org>
Wed, 27 Mar 2024 12:52:26 +0000 (22:52 +1000)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 30 Mar 2024 21:42:05 +0000 (22:42 +0100)
The previous pkg-config code would successfully detect rustls but did
not set all appropriate variables and call the right macros to properly
configure cURL.

Reported-by: kpcyrd on github
Fixes #13200
Closes #13202

m4/curl-rustls.m4

index 7c55230ef7ee8f2b18e849a25eaff84d83af4169..574496ed41eafe1aec7563ad530c7294fab90c53 100644 (file)
@@ -100,9 +100,6 @@ if test "x$OPT_RUSTLS" != xno; then
           AC_MSG_ERROR([--with-rustls was specified but could not find rustls.]),
           -lpthread -ldl -lm)
 
-        USE_RUSTLS="yes"
-        ssl_msg="rustls"
-
         LIB_RUSTLS="$PREFIX_RUSTLS/lib$libsuff"
         if test "$PREFIX_RUSTLS" != "/usr" ; then
           SSL_LDFLAGS="-L$LIB_RUSTLS"
@@ -142,6 +139,10 @@ if test "x$OPT_RUSTLS" != xno; then
       LIBS="$SSL_LIBS $LIBS"
       USE_RUSTLS="yes"
       ssl_msg="rustls"
+      AC_DEFINE(USE_RUSTLS, 1, [if rustls is enabled])
+      AC_SUBST(USE_RUSTLS, [1])
+      RUSTLS_ENABLED=1
+      test rustls != "$DEFAULT_SSL_BACKEND" || VALID_DEFAULT_SSL_BACKEND=yes
     else
       AC_MSG_ERROR([pkg-config: Could not find rustls])
     fi
@@ -174,5 +175,15 @@ if test "x$OPT_RUSTLS" != xno; then
   fi
 
   test -z "$ssl_msg" || ssl_backends="${ssl_backends:+$ssl_backends, }$ssl_msg"
+
+  if test X"$OPT_RUSTLS" != Xno &&
+    test "$RUSTLS_ENABLED" != "1"; then
+    AC_MSG_NOTICE([OPT_RUSTLS: $OPT_RUSTLS])
+    AC_MSG_NOTICE([RUSTLS_ENABLED: $RUSTLS_ENABLED])
+    AC_MSG_ERROR([--with-rustls was given but Rustls could not be detected])
+  fi
 fi
 ])
+
+
+RUSTLS_ENABLED