config.m4 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. dnl config.m4 for extension pdo_sqlite
  2. dnl vim:et:sw=2:ts=2:
  3. PHP_ARG_WITH(pdo-sqlite, for sqlite 3 support for PDO,
  4. [ --without-pdo-sqlite[=DIR]
  5. PDO: sqlite 3 support. DIR is the sqlite base
  6. install directory [BUNDLED]], $PHP_PDO)
  7. if test "$PHP_PDO_SQLITE" != "no"; then
  8. if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then
  9. AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.])
  10. fi
  11. ifdef([PHP_CHECK_PDO_INCLUDES],
  12. [
  13. PHP_CHECK_PDO_INCLUDES
  14. ],[
  15. AC_MSG_CHECKING([for PDO includes])
  16. if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
  17. pdo_cv_inc_path=$abs_srcdir/ext
  18. elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
  19. pdo_cv_inc_path=$abs_srcdir/ext
  20. elif test -f $phpincludedir/ext/pdo/php_pdo_driver.h; then
  21. pdo_cv_inc_path=$phpincludedir/ext
  22. else
  23. AC_MSG_ERROR([Cannot find php_pdo_driver.h.])
  24. fi
  25. AC_MSG_RESULT($pdo_cv_inc_path)
  26. ])
  27. php_pdo_sqlite_sources_core="pdo_sqlite.c sqlite_driver.c sqlite_statement.c"
  28. if test "$PHP_PDO_SQLITE" != "yes"; then
  29. SEARCH_PATH="$PHP_PDO_SQLITE /usr/local /usr" # you might want to change this
  30. SEARCH_FOR="/include/sqlite3.h" # you most likely want to change this
  31. if test -r $PHP_PDO_SQLITE/$SEARCH_FOR; then # path given as parameter
  32. PDO_SQLITE_DIR=$PHP_PDO_SQLITE
  33. else # search default path list
  34. AC_MSG_CHECKING([for sqlite3 files in default path])
  35. for i in $SEARCH_PATH ; do
  36. if test -r $i/$SEARCH_FOR; then
  37. PDO_SQLITE_DIR=$i
  38. AC_MSG_RESULT(found in $i)
  39. fi
  40. done
  41. fi
  42. if test -z "$PDO_SQLITE_DIR"; then
  43. AC_MSG_RESULT([not found])
  44. AC_MSG_ERROR([Please reinstall the sqlite3 distribution])
  45. fi
  46. PHP_ADD_INCLUDE($PDO_SQLITE_DIR/include)
  47. LIBNAME=sqlite3
  48. LIBSYMBOL=sqlite3_open
  49. PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
  50. [
  51. PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $PDO_SQLITE_DIR/$PHP_LIBDIR, PDO_SQLITE_SHARED_LIBADD)
  52. AC_DEFINE(HAVE_PDO_SQLITELIB,1,[ ])
  53. ],[
  54. AC_MSG_ERROR([wrong sqlite lib version or lib not found])
  55. ],[
  56. -L$PDO_SQLITE_DIR/$PHP_LIBDIR -lm
  57. ])
  58. PHP_CHECK_LIBRARY(sqlite3,sqlite3_key,[
  59. AC_DEFINE(HAVE_SQLITE3_KEY,1, [have commercial sqlite3 with crypto support])
  60. ])
  61. PHP_CHECK_LIBRARY(sqlite3,sqlite3_close_v2,[
  62. AC_DEFINE(HAVE_SQLITE3_CLOSE_V2, 1, [have sqlite3_close_v2])
  63. ])
  64. PHP_SUBST(PDO_SQLITE_SHARED_LIBADD)
  65. PHP_NEW_EXTENSION(pdo_sqlite, $php_pdo_sqlite_sources_core, $ext_shared,,-I$pdo_cv_inc_path)
  66. else
  67. # use bundled libs
  68. if test "$enable_maintainer_zts" = "yes"; then
  69. threadsafe_flags="-DSQLITE_THREADSAFE=1"
  70. else
  71. threadsafe_flags="-DSQLITE_THREADSAFE=0"
  72. fi
  73. AC_DEFINE(HAVE_SQLITE3_CLOSE_V2, 1, [have sqlite3_close_v2])
  74. other_flags="-DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_CORE=1 -DSQLITE_ENABLE_COLUMN_METADATA=1"
  75. dnl As long as intl is not shared we can have ICU support
  76. if test "$PHP_INTL" = "yes" && test "$PHP_INTL_SHARED" != "yes"; then
  77. other_flags="$other_flags -DSQLITE_ENABLE_ICU=1"
  78. fi
  79. if test "$PHP_SQLITE3" != "yes"; then
  80. PHP_ADD_SOURCES(PHP_EXT_DIR(sqlite3), libsqlite/sqlite3.c)
  81. fi
  82. PHP_NEW_EXTENSION(pdo_sqlite,
  83. $php_pdo_sqlite_sources_core,
  84. $ext_shared,,-DPDO_SQLITE_BUNDLED=1 $other_flags $threadsafe_flags -I$pdo_cv_inc_path)
  85. PHP_SUBST(PDO_SQLITE_SHARED_LIBADD)
  86. PHP_ADD_EXTENSION_DEP(pdo_sqlite, sqlite3)
  87. PHP_ADD_INCLUDE($abs_srcdir/ext/sqlite3/libsqlite)
  88. AC_CHECK_FUNCS(usleep nanosleep)
  89. AC_CHECK_HEADERS(time.h)
  90. fi
  91. dnl Solaris fix
  92. PHP_CHECK_LIBRARY(rt, fdatasync, [PHP_ADD_LIBRARY(rt,, PDO_SQLITE_SHARED_LIBADD)])
  93. ifdef([PHP_ADD_EXTENSION_DEP],
  94. [
  95. PHP_ADD_EXTENSION_DEP(pdo_sqlite, pdo)
  96. ])
  97. fi