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