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