sqlite3.m4 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. AC_DEFUN([AM_PATH_SQLITE3],
  2. [
  3. AC_ARG_WITH([sqlite3-prefix],
  4. [ --with-sqlite3-prefix=PREFIX Prefix where SQLite3 installed (optional)],
  5. [sqlite3_prefix=$withval],
  6. [sqlite3_prefix=""])
  7. if test "x$sqlite3_prefix" = "x"; then
  8. sqlite3_prefix="/usr"
  9. fi
  10. LIBS_save=$LIBS
  11. CPPFLAGS_save=$CPPFLAGS
  12. PKG_CONFIG="$sqlite3_prefix/bin/pkg-config"
  13. if test -x $PKG_CONFIG; then
  14. AC_MSG_CHECKING([checking availability of sqlite3 using pkg-config])
  15. $PKG_CONFIG --exists sqlite3
  16. if test "$?" = "0"; then
  17. # Use pkg-config to detect LIBS and CFLAGS
  18. SQLITE3_LIBS=`$PKG_CONFIG --libs sqlite3`
  19. SQLITE3_CFLAGS=`$PKG_CONFIG --cflags sqlite3`
  20. LIBS="$SQLITE3_LIBS $LIBS"
  21. CPPFLAGS="$SQLITE3_CFLAGS $CPPFLAGS"
  22. have_sqlite3=yes
  23. AC_MSG_RESULT([yes])
  24. else
  25. AC_MSG_RESULT([no])
  26. fi
  27. fi
  28. if test "x$have_sqlite3" != "xyes"; then
  29. sqlite3_prefix_lib=$sqlite3_prefix/lib
  30. sqlite3_prefix_include=$sqlite3_prefix/include
  31. LIBS="-L$sqlite3_prefix_lib $LIBS"
  32. CPPFLAGS="-I$sqlite3_prefix_include $CPPFLAGS"
  33. AC_CHECK_LIB([sqlite3], [sqlite3_open], [have_sqlite3=yes])
  34. if test "x$have_sqlite3" = "xyes"; then
  35. SQLITE3_LIBS="-L$sqlite3_prefix_lib -lsqlite3"
  36. SQLITE3_CPPFLAGS="-I$sqlite3_prefix_include"
  37. fi
  38. fi
  39. if test "x$have_sqlite3" = "xyes"; then
  40. AC_CHECK_FUNCS([sqlite3_open_v2])
  41. AC_DEFINE([HAVE_SQLITE3], [1], [Define to 1 if you have sqlite3.])
  42. AC_SUBST(SQLITE3_LIBS)
  43. AC_SUBST(SQLITE3_CPPFLAGS)
  44. fi
  45. LIBS=$LIBS_save
  46. CPPFLAGS=$CPPFLAGS_save
  47. ])