Skip to content

Commit 7786992

Browse files
committed
sqlite.m4: Re-add version check
Partially revert previous commit as it was no longer checking the expected version. We now correctly use AC_COMPUTE_INT instead of AC_RUN_IFELSE (not working for cross builds).
1 parent b6efc0b commit 7786992

File tree

2 files changed

+46
-19
lines changed

2 files changed

+46
-19
lines changed

m4/sqlite3.m4

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,27 +47,27 @@ dnl INN_LIB_SQLITE3_SWITCH was called.
4747
AC_DEFUN([INN_LIB_SQLITE3_RESTORE], [INN_LIB_HELPER_RESTORE([SQLITE3])])
4848

4949
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. Prefer probing with
51-
dnl pkg-config if available and the --with flags were not given.
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.
5253
AC_DEFUN([_INN_LIB_SQLITE3_INTERNAL],
53-
[INN_LIB_HELPER_PATHS([SQLITE3])
54-
AS_IF([test x"$SQLITE3_CPPFLAGS" = x && test x"$SQLITE3_LDFLAGS" = x],
55-
[PKG_PROG_PKG_CONFIG([], [PKG_CONFIG=false])
56-
AS_IF([test x"$PKG_CONFIG" = x], [PKG_CONFIG=false])
57-
PKG_CHECK_EXISTS([sqlite3],
58-
[PKG_CHECK_MODULES([SQLITE3], [sqlite3])
59-
SQLITE3_CPPFLAGS="$SQLITE3_CFLAGS"])])
60-
AS_IF([test x"$SQLITE3_LIBS" = x],
61-
[INN_LIB_SQLITE3_SWITCH
62-
LIBS=
63-
AC_SEARCH_LIBS([sqlite3_open_v2], [sqlite3],
64-
[SQLITE3_LIBS="$LIBS"],
65-
[AS_IF([test x"$1" = xtrue],
66-
[AC_MSG_ERROR([cannot find usable libsqlite3 library])])])
54+
[AC_CACHE_CHECK([for a sufficiently recent SQLite],
55+
[inn_cv_have_sqlite3],
56+
[INN_LIB_HELPER_PATHS([SQLITE3])
57+
INN_LIB_SQLITE3_SWITCH
58+
LIBS="-lsqlite3 $LIBS"
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])],
65+
[inn_cv_have_sqlite3=no])
6766
INN_LIB_SQLITE3_RESTORE])
68-
INN_LIB_SQLITE3_SWITCH
69-
AC_CHECK_HEADERS([sqlite3.h])
70-
INN_LIB_SQLITE3_RESTORE])
67+
AS_IF([test x"$inn_cv_have_sqlite3" = xyes],
68+
[SQLITE3_LIBS="-lsqlite3"],
69+
[AS_IF([test x"$1" = xtrue],
70+
[AC_MSG_ERROR([cannot find usable SQLite v3 library])])])])
7171

7272
dnl The main macro for packages with mandatory SQLite v3 support.
7373
AC_DEFUN([INN_LIB_SQLITE3],

support/getrra-c-util

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,33 @@ download() {
6060
-e '/test x"$CLANG" = xyes/,+1d' \
6161
${TEMP}
6262
sed -i -e '$d' ${TEMP}
63+
elif [ "$3" = "sqlite3.m4" ]; then
64+
sed -i -e '49 i \
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.\
69+
AC_DEFUN([_INN_LIB_SQLITE3_INTERNAL],\
70+
[AC_CACHE_CHECK([for a sufficiently recent SQLite],\
71+
[inn_cv_have_sqlite3],\
72+
[INN_LIB_HELPER_PATHS([SQLITE3])\
73+
INN_LIB_SQLITE3_SWITCH\
74+
LIBS="-lsqlite3 $LIBS"\
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])],\
81+
[inn_cv_have_sqlite3=no])\
82+
INN_LIB_SQLITE3_RESTORE])\
83+
AS_IF([test x"$inn_cv_have_sqlite3" = xyes],\
84+
[SQLITE3_LIBS="-lsqlite3"],\
85+
[AS_IF([test x"$1" = xtrue],\
86+
[AC_MSG_ERROR([cannot find usable SQLite v3 library])])])])\
87+
' \
88+
-e '49,71d' \
89+
${TEMP}
6390
fi
6491
elif [ "$2" = "include/inn" ] || [ "$2" = "include/portable" ] \
6592
|| [ "$2" = "include" ] || [ "$2" = "lib" ] || [ "$2" = "tests/lib" ] \

0 commit comments

Comments
 (0)