summaryrefslogtreecommitdiff
path: root/ext/pdo_sqlite
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2018-10-06 12:36:55 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2018-10-06 12:36:55 +0200
commit6083a387a81dbbd66d6316a3a12a63f06d5f7109 (patch)
tree4576666b095bba91d6a78afe7f3d8cc67d442b20 /ext/pdo_sqlite
parent61330b0faf5dfbed79cba012744dabce9d20cc8f (diff)
downloadphp-git-6083a387a81dbbd66d6316a3a12a63f06d5f7109.tar.gz
Unbundle libsqlite3
Since there is no need to patch libsqlite3 for our purposes, and since libsqlite3 ≥ 3.3.9 (which is our current requirement) is widely available on distros, there is no reason anymore to bundle the library. Besides removing the bundled libsqlite, and adapting the configuration respectively, we also fix the use of the SQLITE_ENABLE_COLUMN_METADATA compile time constant to detect whether sqlite3_column_table_name() is available by a working feature detection (otherwise bug_42589.phpt would fail). We also skip bug73068.phpt for libsqlite 3.11.0 to 3.14.1 which have a bug (<https://sqlite.org/src/info/ef360601>). We also completely drop support for the obscure pdo_sqlite_external extension (which could have been enabled on Windows only by passing `--pdo-sqlite-external` to configure), since it is not needed anymore. Furthermore, we remove references to the bundled libsqlite from Makefile.gcov, CONTRIBUTING.md and README.REDIST.BINS.
Diffstat (limited to 'ext/pdo_sqlite')
-rw-r--r--ext/pdo_sqlite/config.m4106
-rw-r--r--ext/pdo_sqlite/config.w3221
-rw-r--r--ext/pdo_sqlite/sqlite_statement.c2
3 files changed, 45 insertions, 84 deletions
diff --git a/ext/pdo_sqlite/config.m4 b/ext/pdo_sqlite/config.m4
index b5aa342eaf..cb3e7d5afc 100644
--- a/ext/pdo_sqlite/config.m4
+++ b/ext/pdo_sqlite/config.m4
@@ -31,78 +31,50 @@ if test "$PHP_PDO_SQLITE" != "no"; then
php_pdo_sqlite_sources_core="pdo_sqlite.c sqlite_driver.c sqlite_statement.c"
- if test "$PHP_PDO_SQLITE" != "yes"; then
- SEARCH_PATH="$PHP_PDO_SQLITE /usr/local /usr" # you might want to change this
- SEARCH_FOR="/include/sqlite3.h" # you most likely want to change this
- if test -r $PHP_PDO_SQLITE/$SEARCH_FOR; then # path given as parameter
- PDO_SQLITE_DIR=$PHP_PDO_SQLITE
- else # search default path list
- AC_MSG_CHECKING([for sqlite3 files in default path])
- for i in $SEARCH_PATH ; do
- if test -r $i/$SEARCH_FOR; then
- PDO_SQLITE_DIR=$i
- AC_MSG_RESULT(found in $i)
- fi
- done
- fi
- if test -z "$PDO_SQLITE_DIR"; then
- AC_MSG_RESULT([not found])
- AC_MSG_ERROR([Please reinstall the sqlite3 distribution])
- fi
-
- PHP_ADD_INCLUDE($PDO_SQLITE_DIR/include)
-
- LIBNAME=sqlite3
- LIBSYMBOL=sqlite3_open
-
- PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
- [
- PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $PDO_SQLITE_DIR/$PHP_LIBDIR, PDO_SQLITE_SHARED_LIBADD)
- AC_DEFINE(HAVE_PDO_SQLITELIB,1,[ ])
- ],[
- AC_MSG_ERROR([wrong sqlite lib version or lib not found])
- ],[
- -L$PDO_SQLITE_DIR/$PHP_LIBDIR -lm
- ])
- PHP_CHECK_LIBRARY(sqlite3,sqlite3_key,[
- AC_DEFINE(HAVE_SQLITE3_KEY,1, [have commercial sqlite3 with crypto support])
- ])
- PHP_CHECK_LIBRARY(sqlite3,sqlite3_close_v2,[
- AC_DEFINE(HAVE_SQLITE3_CLOSE_V2, 1, [have sqlite3_close_v2])
- ])
-
- PHP_SUBST(PDO_SQLITE_SHARED_LIBADD)
- PHP_NEW_EXTENSION(pdo_sqlite, $php_pdo_sqlite_sources_core, $ext_shared,,-I$pdo_cv_inc_path)
- else
- # use bundled libs
- if test "$enable_maintainer_zts" = "yes"; then
- threadsafe_flags="-DSQLITE_THREADSAFE=1"
- else
- threadsafe_flags="-DSQLITE_THREADSAFE=0"
- fi
-
- AC_DEFINE(HAVE_SQLITE3_CLOSE_V2, 1, [have sqlite3_close_v2])
- 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"
-
- dnl As long as intl is not shared we can have ICU support
- if test "$PHP_INTL" = "yes" && test "$PHP_INTL_SHARED" != "yes"; then
- other_flags="$other_flags -DSQLITE_ENABLE_ICU=1"
+ SEARCH_PATH="$PHP_PDO_SQLITE /usr/local /usr" # you might want to change this
+ SEARCH_FOR="/include/sqlite3.h" # you most likely want to change this
+ if test -r $PHP_PDO_SQLITE/$SEARCH_FOR; then # path given as parameter
+ PDO_SQLITE_DIR=$PHP_PDO_SQLITE
+ else # search default path list
+ AC_MSG_CHECKING([for sqlite3 files in default path])
+ for i in $SEARCH_PATH ; do
+ if test -r $i/$SEARCH_FOR; then
+ PDO_SQLITE_DIR=$i
+ AC_MSG_RESULT(found in $i)
fi
+ done
+ fi
+ if test -z "$PDO_SQLITE_DIR"; then
+ AC_MSG_RESULT([not found])
+ AC_MSG_ERROR([Please reinstall the sqlite3 distribution])
+ fi
- if test "$PHP_SQLITE3" != "yes"; then
- PHP_ADD_SOURCES(PHP_EXT_DIR(sqlite3), libsqlite/sqlite3.c)
- fi
+ PHP_ADD_INCLUDE($PDO_SQLITE_DIR/include)
- PHP_NEW_EXTENSION(pdo_sqlite,
- $php_pdo_sqlite_sources_core,
- $ext_shared,,-DPDO_SQLITE_BUNDLED=1 $other_flags $threadsafe_flags -I$pdo_cv_inc_path)
+ LIBNAME=sqlite3
+ LIBSYMBOL=sqlite3_open
- PHP_SUBST(PDO_SQLITE_SHARED_LIBADD)
- PHP_ADD_EXTENSION_DEP(pdo_sqlite, sqlite3)
- PHP_ADD_INCLUDE($abs_srcdir/ext/sqlite3/libsqlite)
+ PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
+ [
+ PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $PDO_SQLITE_DIR/$PHP_LIBDIR, PDO_SQLITE_SHARED_LIBADD)
+ AC_DEFINE(HAVE_PDO_SQLITELIB,1,[ ])
+ ],[
+ AC_MSG_ERROR([wrong sqlite lib version or lib not found])
+ ],[
+ -L$PDO_SQLITE_DIR/$PHP_LIBDIR -lm
+ ])
+ PHP_CHECK_LIBRARY(sqlite3,sqlite3_key,[
+ AC_DEFINE(HAVE_SQLITE3_KEY,1, [have commercial sqlite3 with crypto support])
+ ])
+ PHP_CHECK_LIBRARY(sqlite3,sqlite3_close_v2,[
+ AC_DEFINE(HAVE_SQLITE3_CLOSE_V2, 1, [have sqlite3_close_v2])
+ ])
+ PHP_CHECK_LIBRARY(sqlite3,sqlite3_column_table_name,[
+ AC_DEFINE(HAVE_SQLITE3_COLUMN_TABLE_NAME, 1, [have sqlite3_column_table_name])
+ ])
- AC_CHECK_FUNCS(usleep nanosleep)
- fi
+ PHP_SUBST(PDO_SQLITE_SHARED_LIBADD)
+ PHP_NEW_EXTENSION(pdo_sqlite, $php_pdo_sqlite_sources_core, $ext_shared,,-I$pdo_cv_inc_path)
dnl Solaris fix
PHP_CHECK_LIBRARY(rt, fdatasync, [PHP_ADD_LIBRARY(rt,, PDO_SQLITE_SHARED_LIBADD)])
diff --git a/ext/pdo_sqlite/config.w32 b/ext/pdo_sqlite/config.w32
index 79079dc18b..a1dec83703 100644
--- a/ext/pdo_sqlite/config.w32
+++ b/ext/pdo_sqlite/config.w32
@@ -3,23 +3,12 @@
ARG_WITH("pdo-sqlite", "for pdo_sqlite support", "no");
if (PHP_PDO_SQLITE != "no") {
- EXTENSION("pdo_sqlite", "pdo_sqlite.c sqlite_driver.c sqlite_statement.c", null, "/DSQLITE_THREADSAFE=" + (PHP_ZTS == "yes" ? "1" : "0") + " /D SQLITE_ENABLE_FTS3=1 /D SQLITE_ENABLE_FTS4=1 /D SQLITE_ENABLE_FTS5=1 /D SQLITE_ENABLE_JSON1=1 /D SQLITE_ENABLE_COLUMN_METADATA=1 /D SQLITE_CORE=1 /I" + configure_module_dirname + "/../sqlite3/libsqlite /I" + configure_module_dirname);
-
- ADD_EXTENSION_DEP('pdo_sqlite', 'pdo');
- // If pdo_sqlite is static, and sqlite3 is also static, then we don't add a second copy of the sqlite3 libs
- if (PHP_PDO_SQLITE_SHARED || PHP_SQLITE3_SHARED || PHP_SQLITE3 == 'no') {
- ADD_SOURCES(configure_module_dirname + "/../sqlite3/libsqlite", "sqlite3.c", "pdo_sqlite");
- }
-}
+ if (SETUP_SQLITE3("pdo_sqlite", PHP_PDO_SQLITE, PHP_PDO_SQLITE_SHARED)) {
+ EXTENSION("pdo_sqlite", "pdo_sqlite.c sqlite_driver.c sqlite_statement.c");
-ARG_WITH("pdo-sqlite-external", "for pdo_sqlite support from an external dll", "no");
-if (PHP_PDO_SQLITE_EXTERNAL != "no") {
- if (CHECK_HEADER_ADD_INCLUDE("sqlite3.h", "CFLAGS_PDO_SQLITE_EXTERNAL", PHP_PDO_SQLITE_EXTERNAL + ";" + PHP_PHP_BUILD + "\\include\\sqlite3") &&
- CHECK_LIB("sqlite3-import.lib", "pdo_sqlite_external", PHP_PDO_SQLITE_EXTERNAL + ";" + PHP_PHP_BUILD + "\\lib")
- && ADD_EXTENSION_DEP('pdo_sqlite_external', 'pdo') ) {
- EXTENSION("pdo_sqlite_external", "pdo_sqlite.c sqlite_driver.c sqlite_statement.c", null, "/I" + configure_module_dirname, null, "ext\\pdo_sqlite_external");
+ ADD_EXTENSION_DEP('pdo_sqlite', 'pdo');
+ AC_DEFINE("HAVE_SQLITE3_COLUMN_TABLE_NAME", 1, "have sqlite3_column_table_name");
} else {
- WARNING("pdo-sqlite-external support can't be enabled, libraries or headers are missing")
- PHP_PDO_SQLITE_EXTERNAL = "no"
+ WARNING("pdo_sqlite not enabled; libraries and/or headers not found");
}
}
diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c
index 4a9d2462bf..ff813134c6 100644
--- a/ext/pdo_sqlite/sqlite_statement.c
+++ b/ext/pdo_sqlite/sqlite_statement.c
@@ -331,7 +331,7 @@ static int pdo_sqlite_stmt_col_meta(pdo_stmt_t *stmt, zend_long colno, zval *ret
add_assoc_string(return_value, "sqlite:decl_type", (char *)str);
}
-#ifdef SQLITE_ENABLE_COLUMN_METADATA
+#ifdef HAVE_SQLITE3_COLUMN_TABLE_NAME
str = sqlite3_column_table_name(S->stmt, colno);
if (str) {
add_assoc_string(return_value, "table", (char *)str);