[PATCH 1/8] meson: convert SQLite version detection to compile-time test

Daniel Golle <[email protected]> Fri, 10 Oct 2025 02:12:59 +0100
Newsgroups gmane.network.gnunet.devel
Message-ID <[email protected]>
--2EhRMYp5C+rgH7ZK
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 SQLite 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 66010eb18..8c3609afe 100644
--- a/meson.build
+++ b/meson.build
@@ -175,14 +175,17 @@ if not sqlite_dep.found()
     sqlite_dep =3D cc.find_library('sqlite3', required: true)
     sqlite_version_check =3D '''#include <sqlite3.h>
   int main(int argc, char **argv) {
-    return (SQLITE_VERSION_NUMBER >=3D 3035000) ? 0 : 1;
+    #if SQLITE_VERSION_NUMBER < 3035000
+      #error "SQLite version >=3D 3.35.0 required"
+    #endif
+    return 0;
   }
   '''
-    if cc.run(
+    if not cc.compiles(
         sqlite_version_check,
         name: 'sqlite version check',
         dependencies: sqlite_dep,
-    ).returncode() !=3D 0
+    )
         error('Sqlite version >=3D 3.35.0 requried')
     endif
 endif
--=20
2.51.0

--2EhRMYp5C+rgH7ZK
Content-Type: application/pgp-signature; name=signature.asc

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

iHUEABEIAB0WIQQ8WXOkSQLJP/KOu5qX7zeyq+FyywUCaOhdmwAKCRCX7zeyq+Fy
y98oAP42os9daFu6OoSWcFXkrBNeQpyBp/GrBWc+sJM/Rntn+wEAj3X11Ej2PMZt
3cSLp0ro+rMCD7YGDTK4MIwx6CRBVkI=
=Hnm/
-----END PGP SIGNATURE-----

--2EhRMYp5C+rgH7ZK--