[PATCH 2/8] meson: convert cURL version detection to compile-time test

Daniel Golle <[email protected]> Fri, 10 Oct 2025 02:13:08 +0100
Newsgroups gmane.network.gnunet.devel
Message-ID <[email protected]>
--pOj0IO18CPfn9slW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Use compile-time test instead of relying on testing the cURL version
at runtime. This is done to make cross-compilation possible again.
---
 meson.build | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index 8c3609afe..99ab1ba14 100644
--- a/meson.build
+++ b/meson.build
@@ -194,14 +194,17 @@ if not curl_dep.found()
     curl_dep =3D cc.find_library('curl', required: true)
     curl_version_check =3D '''#include <curl/curl.h>
   int main(int argc, char **argv) {
-    return (LIBCURL_VERSION_NUM >=3D 0x075500) ? 0 : 1;
+    #if LIBCURL_VERSION_NUM < 0x075500
+      #error "cURL version >=3D 7.85.0 required"
+    #endif
+    return 0;
     }
   '''
-    if cc.run(
+    if not cc.compiles(
         curl_version_check,
         name: 'cURL version check',
         dependencies: curl_dep,
-    ).returncode() !=3D 0
+    )
         error('cURL version >=3D7.85.0 required')
     endif
 endif
--=20
2.51.0

--pOj0IO18CPfn9slW
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----

iHUEABEIAB0WIQQ8WXOkSQLJP/KOu5qX7zeyq+FyywUCaOhdpAAKCRCX7zeyq+Fy
y+2BAQCGM5pfM6cACvytgTWnmQnFFmzErE0gycYvSAYRzQS/XwD+KF+JVORfpgsf
IKou5nMLIoyWtuOV3imFo9+1Kj043Ac=
=TWiS
-----END PGP SIGNATURE-----

--pOj0IO18CPfn9slW--