xref: /PHP-5.6/ext/pdo_dblib/config.w32 (revision a58bd002)
1// $Id$
2// vim:ft=javascript
3
4ARG_WITH("pdo-dblib", "freetds dblib (Sybase, MS-SQL) support for PDO", "no");
5
6if (PHP_PDO_DBLIB != "no") {
7	/* if they pointed us to a freetds dir, pick that up,
8	 * otherwise we'll poke around and look for MSSQL libs */
9
10	if (CHECK_LIB("sybdb.lib", "pdo_dblib", PHP_PDO_DBLIB) &&
11			CHECK_HEADER_ADD_INCLUDE("sybfront.h", "CFLAGS_PDO_DBLIB",
12				PHP_PDO_DBLIB, null, null, true))
13	{
14		EXTENSION("pdo_dblib", "pdo_dblib.c dblib_driver.c dblib_stmt.c");
15		ADD_FLAG('CFLAGS_PDO_DBLIB', "/D PDO_DBLIB_FLAVOUR=\\\"freetds\\\"");
16		ADD_EXTENSION_DEP('pdo_dblib', 'pdo');
17	} else {
18		WARNING("pdo_dblib not enabled, libraries or headers not found")
19	}
20}
21
22ARG_WITH("pdo-mssql", "Native MS-SQL support for PDO", "no");
23
24if (PHP_PDO_MSSQL != "no") {
25	/* if they pointed us to a freetds dir, pick that up,
26	 * otherwise we'll poke around and look for MSSQL libs */
27
28	pdo_mssql_locations = new Array(
29		PHP_PDO_MSSQL,
30		"\\Program Files\\Microsoft SQL Server\\80",
31		"\\MSSQL8",
32		"\\MSSQL7",
33		PHP_PHP_BUILD + "\\MSSQL80"
34	);
35	PDO_DBLIB_FLAVOUR = 0;
36
37	if (CHECK_LIB("sybdb.lib", "pdo_mssql", PHP_PDO_MSSQL) &&
38			CHECK_HEADER_ADD_INCLUDE("sybfront.h", "CFLAGS_PDO_MSSQL",
39			PHP_PDO_MSSQL, null, null, true)) {
40		/* smells like FreeTDS (or maybe native sybase dblib) */
41		PDO_DBLIB_FLAVOUR = "freetds";
42	} else {
43
44		for (i = 0; i < pdo_mssql_locations.length; i++) {
45			if (CHECK_LIB("ntwdblib.lib", "pdo_mssql",
46					pdo_mssql_locations[i] + "\\DevTools\\Lib") &&
47					CHECK_HEADER_ADD_INCLUDE("sqlfront.h", "CFLAGS_PDO_MSSQL",
48					pdo_mssql_locations[i] + "\\DevTools\\Include",
49					null, null, true)) {
50				if (pdo_mssql_locations[i] == 'yes') {
51					PDO_DBLIB_FLAVOUR = 70;
52				} else {
53					pdo_mssql_locations[i].match(new RegExp("(\\d)"));
54					PDO_DBLIB_FLAVOUR = RegExp.$1 + 0;
55				}
56				break;
57			}
58		}
59	}
60
61	if (PDO_DBLIB_FLAVOUR != 0) {
62		EXTENSION("pdo_mssql", "pdo_dblib.c dblib_driver.c dblib_stmt.c", null, null, null, "ext\\pdo_mssql");
63		if (PDO_DBLIB_FLAVOUR != "freetds") {
64			ADD_FLAG("CFLAGS_PDO_MSSQL", "/DPHP_DBLIB_IS_MSSQL=1 /DDBNTWIN32=1 /DMSSQL" + PDO_DBLIB_FLAVOUR + "0=1 /DMSSQL_VERSION=\\\"" + PDO_DBLIB_FLAVOUR + ".0\\\"");
65			ADD_FLAG("CFLAGS_PDO_MSSQL", "/DPDO_DBLIB_IS_MSSQL=" + PDO_DBLIB_FLAVOUR);
66			PDO_DBLIB_FLAVOUR = "MSSQL_" + PDO_DBLIB_FLAVOUR;
67		}
68		ADD_FLAG('CFLAGS_PDO_MSSQL', "/D PDO_DBLIB_FLAVOUR=\\\"" + PDO_DBLIB_FLAVOUR + "\\\"");
69		ADD_EXTENSION_DEP('pdo_mssql', 'pdo');
70	} else {
71		WARNING("pdo_mssql not enabled, libraries or headers not found")
72	}
73}
74