// $Id: config.w32,v 1.6.2.1.2.3 2007/03/22 01:00:23 wez Exp $
// vim:ft=javascript

ARG_WITH("pdo-sqlite", "for pdo_sqlite support", "no");

if (PHP_PDO_SQLITE != "no") {

	php_pdo_sqlite_version = file_get_contents(configure_module_dirname + "\\sqlite\\VERSION").replace(new RegExp("[\r\n]+", "g"));
	php_pdo_sqlite_version.match(/(\d+)\.(\d+)\.(\d+)/);
	// this only works for single digit numbers
	php_pdo_sqlite_lib_version = RegExp.$1 + "000" + RegExp.$2 + "000" + RegExp.$3;

	copy_and_subst(configure_module_dirname + "\\sqlite\\src\\sqlite.h.in",
		configure_module_dirname + "\\sqlite3.h", new Array(
		"--VERS--", php_pdo_sqlite_version,
		"--VERSION-NUMBER--", php_pdo_sqlite_lib_version
		));

	FSO.CopyFile(configure_module_dirname + "\\sqlite\\src\\sqlite_config.w32.h",
	   	configure_module_dirname + "\\sqlite\\src\\config.h");
		
	EXTENSION("pdo_sqlite", "pdo_sqlite.c sqlite_driver.c sqlite_statement.c", null, "/DSQLITE_OMIT_CURSOR /I" + configure_module_dirname + "/sqlite/src /I" + configure_module_dirname);
	ADD_SOURCES(configure_module_dirname + "/sqlite/src",
		"attach.c auth.c btree.c build.c callback.c date.c delete.c expr.c func.c hash.c insert.c \
		 legacy.c main.c os.c os_unix.c os_win.c pager.c pragma.c prepare.c printf.c random.c \
		 select.c table.c tokenize.c trigger.c update.c utf.c util.c vacuum.c vdbeapi.c analyze.c complete.c \
		 vdbeaux.c vdbe.c vdbemem.c vdbefifo.c where.c parse.c opcodes.c alter.c vtab.c loadext.c", "pdo_sqlite");
	
	ADD_EXTENSION_DEP('pdo_sqlite', 'pdo');
}

ARG_WITH("pdo-sqlite-external", "for pdo_sqlite support from an external dll", "no");
if (PHP_PDO_SQLITE_EXTERNAL != "no") {
	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");
	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_external', 'pdo');
}
