Source: inn2
Version: 2.7.4~20250809-1
Tags: patch upstream
User: [email protected]
Usertags: ftcbfs

Hi Marco,

I noticed that inn2 fails to cross build from source. It attempts to 
check for sqlite3, but in doing so uses AC_RUN_IFELSE without a cross 
compilation argument. Thus configure stops.

I looked into sqlite3 and it provides its version both as a macro and as 
a function. This separation exists intentionally such that you may at 
runtime check the version of the sqlite3 library rather than the one 
used at build time. Since this check happens at build time, I argue that 
the header version is as good as the runtime version. Using it enables 
us to use AC_COMPUTE_INT and that happens to be compatible with cross 
compilation. I thus propose the attached patch. Is that an acceptable 
way forward?

Helmut
--- inn2-2.7.4~20250809.orig/m4/sqlite3.m4
+++ inn2-2.7.4~20250809/m4/sqlite3.m4
@@ -46,15 +46,6 @@
 dnl INN_LIB_SQLITE3_SWITCH was called.
 AC_DEFUN([INN_LIB_SQLITE3_RESTORE], [INN_LIB_HELPER_RESTORE([SQLITE3])])
 
-dnl Ensures SQLite v3 meets our minimum version requirement.
-AC_DEFUN([_INN_LIB_SQLITE3_SOURCE], [[
-#include <sqlite3.h>
-
-int main(void) {
-    return sqlite3_libversion_number() < 3008002;
-}
-]])
-
 dnl Checks if SQLite v3 is present.  The single argument, if "true", says to
 dnl fail if the SQLite library could not be found.
 AC_DEFUN([_INN_LIB_SQLITE3_INTERNAL],
@@ -63,7 +54,9 @@
     [INN_LIB_HELPER_PATHS([SQLITE3])
      INN_LIB_SQLITE3_SWITCH
      LIBS="-lsqlite3 $LIBS"
-     AC_RUN_IFELSE([AC_LANG_SOURCE([_INN_LIB_SQLITE3_SOURCE])],
+     AC_COMPUTE_INT([_INN_LIB_SQLITE3_VERSION],[SQLITE_VERSION_NUMBER],[#include <sqlite3.h>])
+     dnl Ensures SQLite v3 meets our minimum version requirement.
+     AS_IF([test "$_INN_LIB_SQLITE3_VERSION" -ge 3008002],
         [inn_cv_have_sqlite3=yes],
         [inn_cv_have_sqlite3=no])
      INN_LIB_SQLITE3_RESTORE])

Reply via email to