/ext/sqlite3/config0.m4

https://github.com/filp/php-src · m4 · 93 lines · 75 code · 18 blank · 0 comment · 0 complexity · c21db9f40c4cdf5a4d5dab9d40d9df62 MD5 · raw file

  1. dnl $Id$
  2. dnl config.m4 for extension sqlite3
  3. dnl vim:et:ts=2:sw=2
  4. PHP_ARG_WITH(sqlite3, whether to enable the SQLite3 extension,
  5. [ --without-sqlite3[=DIR] Do not include SQLite3 support. DIR is the prefix to
  6. SQLite3 installation directory.], yes)
  7. if test $PHP_SQLITE3 != "no"; then
  8. sqlite3_extra_sources=""
  9. PHP_SQLITE3_CFLAGS=""
  10. dnl when running phpize enable_maintainer_zts is not available
  11. if test -z "$enable_maintainer_zts"; then
  12. if test -f "$phpincludedir/main/php_config.h"; then
  13. ZTS=`grep '#define ZTS' $phpincludedir/main/php_config.h|$SED 's/#define ZTS//'`
  14. if test "$ZTS" -eq "1"; then
  15. enable_maintainer_zts="yes"
  16. fi
  17. fi
  18. fi
  19. if test $PHP_SQLITE3 != "yes"; then
  20. AC_MSG_CHECKING([for sqlite3 files in default path])
  21. for i in $PHP_SQLITE3 /usr/local /usr; do
  22. if test -r $i/include/sqlite3.h; then
  23. SQLITE3_DIR=$i
  24. AC_MSG_RESULT(found in $i)
  25. break
  26. fi
  27. done
  28. if test -z "$SQLITE3_DIR"; then
  29. AC_MSG_RESULT([not found])
  30. AC_MSG_ERROR([Please reinstall the sqlite distribution from http://www.sqlite.org])
  31. fi
  32. AC_MSG_CHECKING([for SQLite 3.3.9+])
  33. PHP_CHECK_LIBRARY(sqlite3, sqlite3_prepare_v2, [
  34. AC_MSG_RESULT(found)
  35. PHP_ADD_LIBRARY_WITH_PATH(sqlite3, $SQLITE3_DIR/$PHP_LIBDIR, SQLITE3_SHARED_LIBADD)
  36. PHP_ADD_INCLUDE($SQLITE3_DIR/include)
  37. ],[
  38. AC_MSG_RESULT([not found])
  39. AC_MSG_ERROR([Please install SQLite 3.3.9 first or check libsqlite3 is present])
  40. ],[
  41. -L$SQLITE3_DIR/$PHP_LIBDIR -lm
  42. ])
  43. PHP_CHECK_LIBRARY(sqlite3,sqlite3_key,[
  44. AC_DEFINE(HAVE_SQLITE3_KEY, 1, [have commercial sqlite3 with crypto support])
  45. ])
  46. PHP_CHECK_LIBRARY(sqlite3,sqlite3_load_extension,
  47. [],
  48. [AC_DEFINE(SQLITE_OMIT_LOAD_EXTENSION, 1, [have sqlite3 with extension support])
  49. ])
  50. else
  51. AC_MSG_CHECKING([bundled sqlite3 library])
  52. AC_MSG_RESULT([yes])
  53. sqlite3_extra_sources="libsqlite/sqlite3.c"
  54. if test "$enable_maintainer_zts" = "yes"; then
  55. threadsafe_flags="-DSQLITE_THREADSAFE=1"
  56. else
  57. threadsafe_flags="-DSQLITE_THREADSAFE=0"
  58. fi
  59. if test "$ZEND_DEBUG" = "yes"; then
  60. debug_flags="-DSQLITE_DEBUG=1"
  61. fi
  62. other_flags="-DSQLITE_ENABLE_FTS3=1 -DSQLITE_CORE=1 -DSQLITE_ENABLE_COLUMN_METADATA=1"
  63. dnl As long as intl is not shared we can have ICU support
  64. if test "$PHP_INTL" = "yes" && test "$PHP_INTL_SHARED" != "yes"; then
  65. other_flags="$other_flags -DSQLITE_ENABLE_ICU=1"
  66. fi
  67. PHP_SQLITE3_CFLAGS="-I@ext_srcdir@/libsqlite $other_flags $threadsafe_flags $debug_flags"
  68. PHP_INSTALL_HEADERS([ext/sqlite3/libsqlite/sqlite3.h])
  69. fi
  70. AC_DEFINE(HAVE_SQLITE3,1,[ ])
  71. sqlite3_sources="sqlite3.c $sqlite3_extra_sources"
  72. PHP_NEW_EXTENSION(sqlite3, $sqlite3_sources, $ext_shared,,$PHP_SQLITE3_CFLAGS)
  73. PHP_ADD_BUILD_DIR([$ext_builddir/libsqlite])
  74. PHP_SUBST(SQLITE3_SHARED_LIBADD)
  75. fi