summaryrefslogtreecommitdiff
path: root/ext/pdo_dblib/config.w32
blob: 14cbb68f1ad6cb48a74b502c06a71c10b71c2988 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// $Id$
// vim:ft=javascript

ARG_WITH("pdo-dblib", "freetds dblib (Sybase, MS-SQL) support for PDO", "no");

if (PHP_PDO_DBLIB != "no") {
	/* if they pointed us to a freetds dir, pick that up,
	 * otherwise we'll poke around and look for MSSQL libs */

	if (CHECK_LIB("sybdb.lib", "pdo_dblib", PHP_PDO_DBLIB) &&
			CHECK_HEADER_ADD_INCLUDE("sybfront.h", "CFLAGS_PDO_DBLIB",
				PHP_PDO_DBLIB, null, null, true))
	{
		EXTENSION("pdo_dblib", "pdo_dblib.c dblib_driver.c dblib_stmt.c");
		ADD_FLAG('CFLAGS_PDO_DBLIB', "/D PDO_DBLIB_FLAVOUR=\\\"freetds\\\"");
		ADD_EXTENSION_DEP('pdo_dblib', 'pdo');
	} else {
		WARNING("pdo_dblib not enabled, libraries or headers not found")
	}
}

ARG_WITH("pdo-mssql", "Native MS-SQL support for PDO", "no");

if (PHP_PDO_MSSQL != "no") {
	/* if they pointed us to a freetds dir, pick that up,
	 * otherwise we'll poke around and look for MSSQL libs */

	pdo_mssql_locations = new Array(
		PHP_PDO_MSSQL,
		"\\Program Files\\Microsoft SQL Server\\80",
		"\\MSSQL8",
		"\\MSSQL7",
		PHP_PHP_BUILD + "\\MSSQL80"
	);
	PDO_DBLIB_FLAVOUR = 0;

	if (CHECK_LIB("sybdb.lib", "pdo_mssql", PHP_PDO_MSSQL) &&
			CHECK_HEADER_ADD_INCLUDE("sybfront.h", "CFLAGS_PDO_MSSQL",
			PHP_PDO_MSSQL, null, null, true)) {
		/* smells like FreeTDS (or maybe native sybase dblib) */
		PDO_DBLIB_FLAVOUR = "freetds";
	} else {
		
		for (i = 0; i < pdo_mssql_locations.length; i++) {
			if (CHECK_LIB("ntwdblib.lib", "pdo_mssql",
					pdo_mssql_locations[i] + "\\DevTools\\Lib") &&
					CHECK_HEADER_ADD_INCLUDE("sqlfront.h", "CFLAGS_PDO_MSSQL",
					pdo_mssql_locations[i] + "\\DevTools\\Include",
					null, null, true)) {
				if (pdo_mssql_locations[i] == 'yes') {
					PDO_DBLIB_FLAVOUR = 70;
				} else {
					pdo_mssql_locations[i].match(new RegExp("(\\d)"));
					PDO_DBLIB_FLAVOUR = RegExp.$1 + 0;
				}
				break;
			}
		}
	}

	if (PDO_DBLIB_FLAVOUR != 0) {
		EXTENSION("pdo_mssql", "pdo_dblib.c dblib_driver.c dblib_stmt.c", null, null, null, "ext\\pdo_mssql");
		if (PDO_DBLIB_FLAVOUR != "freetds") {
			ADD_FLAG("CFLAGS_PDO_MSSQL", "/DPHP_DBLIB_IS_MSSQL=1 /DDBNTWIN32=1 /DMSSQL" + PDO_DBLIB_FLAVOUR + "0=1 /DMSSQL_VERSION=\\\"" + PDO_DBLIB_FLAVOUR + ".0\\\"");
			ADD_FLAG("CFLAGS_PDO_MSSQL", "/DPDO_DBLIB_IS_MSSQL=" + PDO_DBLIB_FLAVOUR);
			PDO_DBLIB_FLAVOUR = "MSSQL_" + PDO_DBLIB_FLAVOUR;
		}
		ADD_FLAG('CFLAGS_PDO_MSSQL', "/D PDO_DBLIB_FLAVOUR=\\\"" + PDO_DBLIB_FLAVOUR + "\\\"");
		ADD_EXTENSION_DEP('pdo_mssql', 'pdo');
	} else {
		WARNING("pdo_mssql not enabled, libraries or headers not found")
	}
}