Hi Wez,

The attached patch makes it possible to build either php_sqlite.dll without the PDO dependency, or php_pdo_sqlite2.dll with the PDO dependency. If ext/sqlite is built as static it 'just works' (forcing a shared build only if PDO is enabled as shared) but with the same distinctions, i.e. if there's PDO in there it has PDO support, otherwise it doesn't.

I'm hoping it'll mean you can consider enabling built-in sqlite by default again, even if PDO isn't quite ready for that yet?

I removed the check for php_pdo_driver.h because ext/pdo doesn't check for it itself, making the sqlite check fairly pointless as the whole build breaks further down the line if the configure line contains --enable-pdo when that file's missing.

A small note, in case you didn't notice me banging my head against a brick wall on irc earlier - the config.w32 for ext/pdo_sqlite works exclusively with pecl/pdo_sqlite at present, whereas the config.w32 files for ext/pdo and ext/sqlite both use the version in the PHP extensions directory. Probably everyone else in the world is sensible enough to update their PECL sources at the same time as their PHP sources, but I'm not, and there's nothing to tell you during compilation that the PECL version is actually being used. It was only when I finally got it to build (by altering some function signature) and found the module wouldn't load due to a PDO API version mismatch, that I figured out wtf was going down.

I'll look into this 'not telling us anything' business when I get some time.

I also found - yeah this was a long session - that if the extension you're trying to build doesn't exist in your local copy of the PECL directory the configure line's simply ignored, even if that extension happens to use the sources in the PHP ext dir. This is a separate issue but also needs rectifying, and ditto.

The main question I have at present is whether extensions should generally be trying to build from the PECL sources, or from the PHP extension directory? It should really be either one or the other, particularly for PDO and its drivers but also for anything else with a dependency on another extension...

- Steph



Index: ext/sqlite/CREDITS
===================================================================
RCS file: /repository/php-src/ext/sqlite/CREDITS,v
retrieving revision 1.7
diff -u -r1.7 CREDITS
--- ext/sqlite/CREDITS  29 Apr 2004 22:57:23 -0000      1.7
+++ ext/sqlite/CREDITS  30 Apr 2006 11:39:39 -0000
@@ -1,2 +1,2 @@
-SQLite
+SQLite 2.x
Wez Furlong, Tal Peer, Marcus Boerger, Ilia Alshanetsky
Index: ext/sqlite/config.w32
===================================================================
RCS file: /repository/php-src/ext/sqlite/config.w32,v
retrieving revision 1.8.2.1
diff -u -r1.8.2.1 config.w32
--- ext/sqlite/config.w32       24 Sep 2005 15:13:13 -0000      1.8.2.1
+++ ext/sqlite/config.w32       30 Apr 2006 11:47:28 -0000
@@ -1,7 +1,7 @@
// $Id: config.w32,v 1.8.2.1 2005/09/24 15:13:13 edink Exp $
// vim:ft=javascript

-ARG_WITH("sqlite", "SQLite support", "no");
+ARG_WITH("sqlite", "SQLite 2.x support", "yes");

if (PHP_SQLITE != "no") {
        copy_and_subst(configure_module_dirname + 
"\\libsqlite\\src\\sqlite.h.in",
@@ -13,18 +13,24 @@
        FSO.CopyFile(configure_module_dirname + 
"\\libsqlite\\src\\sqlite_config.w32.h",
                configure_module_dirname + "\\libsqlite\\src\\config.h");

-       if (FSO.FileExists(configure_module_dirname + 
"\\..\\pdo\\php_pdo_driver.h")) {
-               PHP_SQLITE2_PDO_CFLAGS = " /DPHP_SQLITE2_HAVE_PDO=1 /I " + 
configure_module_dirname + "\\..";
-               ADD_EXTENSION_DEP('sqlite', 'pdo')
+       if (PHP_PDO != "no") {
+
+               if (PHP_PDO_SHARED) {
+                       PHP_SQLITE_SHARED = "shared";
+               }
+
+               dllname="php_pdo_sqlite2.dll";
+               PHP_SQLITE2_PDO_CFLAGS = " /D PHP_SQLITE2_HAVE_PDO=1 /I " + 
configure_module_dirname + "\\..";
+               ADD_EXTENSION_DEP("sqlite", "pdo")
        } else {
-               PHP_SQLITE2_PDO_CFLAGS = "";
+               dllname="php_sqlite.dll";
+               PHP_SQLITE2_PDO_CFLAGS="";
        }
-       
+
        EXTENSION("sqlite", "sqlite.c sess_sqlite.c pdo_sqlite2.c", null,
                "/D PHP_SQLITE_EXPORTS /I " + configure_module_dirname + 
"/libsqlite/src" +
-               PHP_SQLITE2_PDO_CFLAGS);
-               
-       
+               PHP_SQLITE2_PDO_CFLAGS, dllname);
+
        ADD_SOURCES(configure_module_dirname + "/libsqlite/src", "opcodes.c 
parse.c encode.c \
                auth.c btree.c build.c delete.c expr.c func.c hash.c insert.c \
                main.c os.c pager.c printf.c random.c select.c table.c 
tokenize.c \
@@ -35,5 +41,5 @@
        if (!PHP_SQLITE_SHARED) {
                ADD_DEF_FILE(configure_module_dirname + "\\php_sqlite.def");
        }
-       ADD_EXTENSION_DEP('sqlite', 'spl')
+       ADD_EXTENSION_DEP("sqlite", "spl")
}

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to