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 72 PHP_SUBST(PDO_SQLITE_SHARED_LIBADD) 73 PHP_NEW_EXTENSION(pdo_sqlite, $php_pdo_sqlite_sources_core, $ext_shared,,-I$pdo_cv_inc_path) 74 else 75 # use bundled libs 76 if test "$enable_maintainer_zts" = "yes"; then 77 threadsafe_flags="-DSQLITE_THREADSAFE=1" 78 else 79 threadsafe_flags="-DSQLITE_THREADSAFE=0" 80 fi 81 82 other_flags="-DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_CORE=1 -DSQLITE_ENABLE_COLUMN_METADATA=1" 83 84 dnl As long as intl is not shared we can have ICU support 85 if test "$PHP_INTL" = "yes" && test "$PHP_INTL_SHARED" != "yes"; then 86 other_flags="$other_flags -DSQLITE_ENABLE_ICU=1" 87 fi 88 89 if test "$PHP_SQLITE3" != "yes"; then 90 PHP_ADD_SOURCES(PHP_EXT_DIR(sqlite3), libsqlite/sqlite3.c) 91 fi 92 93 PHP_NEW_EXTENSION(pdo_sqlite, 94 $php_pdo_sqlite_sources_core, 95 $ext_shared,,-DPDO_SQLITE_BUNDLED=1 $other_flags $threadsafe_flags -I$pdo_cv_inc_path) 96 97 PHP_SUBST(PDO_SQLITE_SHARED_LIBADD) 98 PHP_ADD_EXTENSION_DEP(pdo_sqlite, sqlite3) 99 PHP_ADD_INCLUDE($abs_srcdir/ext/sqlite3/libsqlite) 100 101 AC_CHECK_FUNCS(usleep nanosleep) 102 AC_CHECK_HEADERS(time.h) 103 fi 104 105 dnl Solaris fix 106 PHP_CHECK_LIBRARY(rt, fdatasync, [PHP_ADD_LIBRARY(rt,, PDO_SQLITE_SHARED_LIBADD)]) 107 108 ifdef([PHP_ADD_EXTENSION_DEP], 109 [ 110 PHP_ADD_EXTENSION_DEP(pdo_sqlite, pdo) 111 ]) 112fi 113