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 54 PHP_CHECK_LIBRARY(sqlite3,sqlite3_load_extension, 55 [], 56 [AC_DEFINE(SQLITE_OMIT_LOAD_EXTENSION, 1, [have sqlite3 with extension support]) 57 ]) 58 59 else 60 AC_MSG_CHECKING([bundled sqlite3 library]) 61 AC_MSG_RESULT([yes]) 62 63 sqlite3_extra_sources="libsqlite/sqlite3.c" 64 65 if test "$enable_maintainer_zts" = "yes"; then 66 threadsafe_flags="-DSQLITE_THREADSAFE=1" 67 else 68 threadsafe_flags="-DSQLITE_THREADSAFE=0" 69 fi 70 71 if test "$ZEND_DEBUG" = "yes"; then 72 debug_flags="-DSQLITE_DEBUG=1" 73 fi 74 75 other_flags="-DSQLITE_ENABLE_FTS3=1 -DSQLITE_CORE=1 -DSQLITE_ENABLE_COLUMN_METADATA=1" 76 77 dnl As long as intl is not shared we can have ICU support 78 if test "$PHP_INTL" = "yes" && test "$PHP_INTL_SHARED" != "yes"; then 79 other_flags="$other_flags -DSQLITE_ENABLE_ICU=1" 80 fi 81 82 PHP_SQLITE3_CFLAGS="-I@ext_srcdir@/libsqlite $other_flags $threadsafe_flags $debug_flags" 83 PHP_INSTALL_HEADERS([ext/sqlite3/libsqlite/sqlite3.h]) 84 fi 85 86 AC_DEFINE(HAVE_SQLITE3,1,[ ]) 87 88 sqlite3_sources="sqlite3.c $sqlite3_extra_sources" 89 90 PHP_NEW_EXTENSION(sqlite3, $sqlite3_sources, $ext_shared,,$PHP_SQLITE3_CFLAGS) 91 PHP_ADD_BUILD_DIR([$ext_builddir/libsqlite]) 92 PHP_SUBST(SQLITE3_SHARED_LIBADD) 93fi 94