config0.m4 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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_column_table_name,[
  47. AC_DEFINE(SQLITE_ENABLE_COLUMN_METADATA, 1, [have sqlite3 with column metadata enabled])
  48. ])
  49. PHP_CHECK_LIBRARY(sqlite3,sqlite3_load_extension,
  50. [],
  51. [AC_DEFINE(SQLITE_OMIT_LOAD_EXTENSION, 1, [have sqlite3 with extension support])
  52. ])
  53. else
  54. AC_MSG_CHECKING([bundled sqlite3 library])
  55. AC_MSG_RESULT([yes])
  56. sqlite3_extra_sources="libsqlite/sqlite3.c"
  57. if test "$enable_maintainer_zts" = "yes"; then
  58. threadsafe_flags="-DSQLITE_THREADSAFE=1"
  59. else
  60. threadsafe_flags="-DSQLITE_THREADSAFE=0"
  61. fi
  62. if test "$ZEND_DEBUG" = "yes"; then
  63. debug_flags="-DSQLITE_DEBUG=1"
  64. fi
  65. other_flags="-DSQLITE_ENABLE_FTS3=1 -DSQLITE_CORE=1 -DSQLITE_ENABLE_COLUMN_METADATA=1"
  66. dnl As long as intl is not shared we can have ICU support
  67. if test "$PHP_INTL" = "yes" && test "$PHP_INTL_SHARED" != "yes"; then
  68. other_flags="$other_flags -DSQLITE_ENABLE_ICU=1"
  69. fi
  70. PHP_SQLITE3_CFLAGS="-I@ext_srcdir@/libsqlite $other_flags $threadsafe_flags $debug_flags"
  71. PHP_INSTALL_HEADERS([ext/sqlite3/libsqlite/sqlite3.h])
  72. fi
  73. AC_DEFINE(HAVE_SQLITE3,1,[ ])
  74. sqlite3_sources="sqlite3.c $sqlite3_extra_sources"
  75. PHP_NEW_EXTENSION(sqlite3, $sqlite3_sources, $ext_shared,,$PHP_SQLITE3_CFLAGS)
  76. PHP_ADD_BUILD_DIR([$ext_builddir/libsqlite])
  77. PHP_SUBST(SQLITE3_SHARED_LIBADD)
  78. fi