Skip to content

Commit 6b366e8

Browse files
committed
Set compiler info in mongoc-config.h for handshake metadata
1 parent d4e9e57 commit 6b366e8

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

config.w32

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@ function mongodb_generate_header(inpath, outpath, replacements)
99
infile.Close();
1010

1111
for (var key in replacements) {
12-
outdata = outdata.replace("@" + key + "@", replacements[key]);
12+
var replacement = replacements[key];
13+
14+
if (typeof replacement === 'string') {
15+
replacement = replacement.replace(/"/g, '\\"');
16+
}
17+
18+
outdata = outdata.replace("@" + key + "@", replacement);
1319
}
1420

1521
var outfile = FSO.CreateTextFile(outpath, true);
@@ -113,7 +119,10 @@ if (PHP_MONGODB != "no") {
113119
MONGOC_ENABLE_SASL: 0,
114120
MONGOC_HAVE_SASL_CLIENT_DONE: 0,
115121
MONGOC_HAVE_WEAK_SYMBOLS: 0,
116-
MONGOC_NO_AUTOMATIC_GLOBALS: 1
122+
MONGOC_NO_AUTOMATIC_GLOBALS: 1,
123+
MONGOC_CC: "",
124+
MONGOC_USER_SET_CFLAGS: "",
125+
MONGOC_USER_SET_LDFLAGS: ""
117126
};
118127

119128
if (CHECK_LIB("ssleay32.lib", "mongodb", PHP_MONGODB) &&
@@ -140,6 +149,15 @@ if (PHP_MONGODB != "no") {
140149
WARNING("mongodb libsasl support not enabled, libs not found");
141150
}
142151

152+
if (typeof COMPILER_NAME === 'string') {
153+
mongoc_opts.MONGOC_CC = COMPILER_NAME;
154+
} else if (typeof VC_VERSIONS[VCVERS] === 'string') {
155+
mongoc_opts.MONGOC_CC = VC_VERSIONS[VCVERS];
156+
}
157+
158+
/* MONGOC_USER_SET_CFLAGS and MONGOC_USER_SET_LDFLAGS can be left blank, as we
159+
* do not expect CFLAGS or LDFLAGS to be customized at build time. */
160+
143161
mongodb_generate_header(
144162
configure_module_dirname + "/src/libmongoc/src/mongoc/mongoc-config.h.in",
145163
configure_module_dirname + "/src/libmongoc/src/mongoc/mongoc-config.h",

0 commit comments

Comments
 (0)