blob: cf829b75dc5fd922eb3ad5c9bb884fe9118ae54d [file] [log] [blame]
NingSun0c89b3c2018-02-08 08:34:03 -08001AC_DEFUN([ACX_SQLITE3],[
2 AC_ARG_WITH(sqlite3,
3 AC_HELP_STRING([--with-sqlite3=PATH],[Specify prefix of path of SQLite3]),
4 [
5 SQLITE3_PATH="$withval"
6 AC_PATH_PROGS(SQLITE3, sqlite3, sqlite3, $withval/bin)
7
8 ],[
9 SQLITE3_PATH="/usr/local"
10 AC_PATH_PROGS(SQLITE3, sqlite3, sqlite3, $PATH)
11 ])
12
13
14 if ! test -x "$SQLITE3"; then
15 AC_MSG_ERROR([sqlite3 command not found])
16 fi
17
18 AC_MSG_CHECKING(what are the SQLite3 includes)
19 SQLITE3_INCLUDES="-I$SQLITE3_PATH/include"
20 AC_MSG_RESULT($SQLITE3_INCLUDES)
21
22 AC_MSG_CHECKING(what are the SQLite3 libs)
23 SQLITE3_LIBS="-L$SQLITE3_PATH/lib -lsqlite3"
24 AC_MSG_RESULT($SQLITE3_LIBS)
25
26 tmp_CPPFLAGS=$CPPFLAGS
27 tmp_LIBS=$LIBS
28
29 CPPFLAGS="$CPPFLAGS $SQLITE3_INCLUDES"
30 LIBS="$LIBS $SQLITE3_LIBS"
31
32 AC_CHECK_HEADERS(sqlite3.h,,[AC_MSG_ERROR([Can't find SQLite3 headers])])
33 AC_CHECK_LIB(sqlite3, sqlite3_prepare_v2, [], [AC_MSG_ERROR([Missing SQLite3 library v3.4.2 or greater])])
34
35 CPPFLAGS=$tmp_CPPFLAGS
36 LIBS=$tmp_LIBS
37
38 AC_SUBST(SQLITE3_INCLUDES)
39 AC_SUBST(SQLITE3_LIBS)
40])