Skip to content

Commit 72dfe46

Browse files
committed
sqlite3.m4: Fix cross compilation
sqlite3 version check uses AC_RUN_IFELSE without a cross compilation argument, which makes cross builds from source fail. Thanks to Helmut Grohne for the bug report on the Debian Bug Tracking System (bug 1119126). We now use AC_COMPUTE_INT as this macro works for cross builds, and check the version against SQLITE_VERSION_NUMBER.
1 parent 7fc0434 commit 72dfe46

File tree

2 files changed

+20
-26
lines changed

2 files changed

+20
-26
lines changed

m4/sqlite3.m4

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,22 @@ dnl Restore CPPFLAGS, LDFLAGS, and LIBS to their previous values before
4646
dnl INN_LIB_SQLITE3_SWITCH was called.
4747
AC_DEFUN([INN_LIB_SQLITE3_RESTORE], [INN_LIB_HELPER_RESTORE([SQLITE3])])
4848

49-
dnl Ensures SQLite v3 meets our minimum version requirement.
50-
AC_DEFUN([_INN_LIB_SQLITE3_SOURCE], [[
51-
#include <sqlite3.h>
52-
53-
int main(void) {
54-
return sqlite3_libversion_number() < 3008002;
55-
}
56-
]])
57-
58-
dnl Checks if SQLite v3 is present. The single argument, if "true", says to
59-
dnl fail if the SQLite library could not be found.
49+
dnl Checks if SQLite v3 is present. The single argument, if "true", says to
50+
dnl fail if the SQLite library could not be found. We do not use pkg-config
51+
dnl like the upstream version of this file as we have a specific check to
52+
dnl ensure that SQLite v3 meets our minimum version requirement.
6053
AC_DEFUN([_INN_LIB_SQLITE3_INTERNAL],
6154
[AC_CACHE_CHECK([for a sufficiently recent SQLite],
6255
[inn_cv_have_sqlite3],
6356
[INN_LIB_HELPER_PATHS([SQLITE3])
6457
INN_LIB_SQLITE3_SWITCH
6558
LIBS="-lsqlite3 $LIBS"
66-
AC_RUN_IFELSE([AC_LANG_SOURCE([_INN_LIB_SQLITE3_SOURCE])],
67-
[inn_cv_have_sqlite3=yes],
59+
AC_COMPUTE_INT([_INN_LIB_SQLITE3_VERSION], [SQLITE_VERSION_NUMBER],
60+
[#include <sqlite3.h>])
61+
AS_IF([test "x$_INN_LIB_SQLITE3_VERSION" != x],
62+
[AS_IF([test "$_INN_LIB_SQLITE3_VERSION" -ge 3008002],
63+
[inn_cv_have_sqlite3=yes],
64+
[inn_cv_have_sqlite3=no])],
6865
[inn_cv_have_sqlite3=no])
6966
INN_LIB_SQLITE3_RESTORE])
7067
AS_IF([test x"$inn_cv_have_sqlite3" = xyes],

support/getrra-c-util

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,25 +62,22 @@ download() {
6262
sed -i -e '$d' ${TEMP}
6363
elif [ "$3" = "sqlite3.m4" ]; then
6464
sed -i -e '49 i \
65-
dnl Ensures SQLite v3 meets our minimum version requirement.\
66-
AC_DEFUN([_INN_LIB_SQLITE3_SOURCE], [[\
67-
#include <sqlite3.h>\
68-
\
69-
int main(void) {\
70-
return sqlite3_libversion_number() < 3008002;\
71-
}\
72-
]])\
73-
\
74-
dnl Checks if SQLite v3 is present. The single argument, if "true", says to\
75-
dnl fail if the SQLite library could not be found.\
65+
dnl Checks if SQLite v3 is present. The single argument, if "true", says to\
66+
dnl fail if the SQLite library could not be found. We do not use pkg-config\
67+
dnl like the upstream version of this file as we have a specific check to\
68+
dnl ensure that SQLite v3 meets our minimum version requirement.\
7669
AC_DEFUN([_INN_LIB_SQLITE3_INTERNAL],\
7770
[AC_CACHE_CHECK([for a sufficiently recent SQLite],\
7871
[inn_cv_have_sqlite3],\
7972
[INN_LIB_HELPER_PATHS([SQLITE3])\
8073
INN_LIB_SQLITE3_SWITCH\
8174
LIBS="-lsqlite3 $LIBS"\
82-
AC_RUN_IFELSE([AC_LANG_SOURCE([_INN_LIB_SQLITE3_SOURCE])],\
83-
[inn_cv_have_sqlite3=yes],\
75+
AC_COMPUTE_INT([_INN_LIB_SQLITE3_VERSION], [SQLITE_VERSION_NUMBER],\
76+
[#include <sqlite3.h>])\
77+
AS_IF([test "x$_INN_LIB_SQLITE3_VERSION" != x],\
78+
[AS_IF([test "$_INN_LIB_SQLITE3_VERSION" -ge 3008002],\
79+
[inn_cv_have_sqlite3=yes],\
80+
[inn_cv_have_sqlite3=no])],\
8481
[inn_cv_have_sqlite3=no])\
8582
INN_LIB_SQLITE3_RESTORE])\
8683
AS_IF([test x"$inn_cv_have_sqlite3" = xyes],\

0 commit comments

Comments
 (0)