@@ -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 ) ;
@@ -51,7 +57,7 @@ if (PHP_MONGODB != "no") {
5157 ADD_SOURCES ( configure_module_dirname + "/src/MongoDB/Exception" , "Exception.c LogicException.c RuntimeException.c UnexpectedValueException.c InvalidArgumentException.c ConnectionException.c AuthenticationException.c SSLConnectionException.c ExecutionTimeoutException.c ConnectionTimeoutException.c WriteException.c BulkWriteException.c" , "mongodb" ) ;
5258 ADD_SOURCES ( configure_module_dirname + "/src/libbson/src/yajl" , "yajl_version.c yajl.c yajl_encode.c yajl_lex.c yajl_parser.c yajl_buf.c yajl_tree.c yajl_alloc.c yajl_gen.c" , "mongodb" ) ;
5359 ADD_SOURCES ( configure_module_dirname + "/src/libbson/src/bson" , "bcon.c bson.c bson-atomic.c bson-clock.c bson-context.c bson-decimal128.c bson-error.c bson-iter.c bson-iso8601.c bson-json.c bson-keys.c bson-md5.c bson-memory.c bson-oid.c bson-reader.c bson-string.c bson-timegm.c bson-utf8.c bson-value.c bson-version-functions.c bson-writer.c" , "mongodb" ) ;
54- ADD_SOURCES ( configure_module_dirname + "/src/libmongoc/src/mongoc" , "mongoc-apm.c mongoc-array.c mongoc-async.c mongoc-async-cmd.c mongoc-buffer.c mongoc-bulk-operation.c mongoc-b64.c mongoc-client.c mongoc-client-pool.c mongoc-cluster.c mongoc-collection.c mongoc-counters.c mongoc-cursor.c mongoc-cursor-array.c mongoc-cursor-cursorid.c mongoc-cursor-transform.c mongoc-database.c mongoc-find-and-modify.c mongoc-host-list.c mongoc-init.c mongoc-gridfs.c mongoc-gridfs-file.c mongoc-gridfs-file-page.c mongoc-gridfs-file-list.c mongoc-index.c mongoc-list.c mongoc-log.c mongoc-matcher-op.c mongoc-matcher.c mongoc-memcmp.c mongoc-opcode.c mongoc-queue.c mongoc-read-concern.c mongoc-read-prefs.c mongoc-rpc.c mongoc-server-description.c mongoc-server-stream.c mongoc-set.c mongoc-socket.c mongoc-stream.c mongoc-stream-buffered.c mongoc-stream-file.c mongoc-stream-gridfs.c mongoc-stream-socket.c mongoc-topology.c mongoc-topology-description.c mongoc-topology-scanner.c mongoc-uri.c mongoc-util.c mongoc-version-functions.c mongoc-write-command.c mongoc-write-concern.c" , "mongodb" ) ;
60+ ADD_SOURCES ( configure_module_dirname + "/src/libmongoc/src/mongoc" , "mongoc-apm.c mongoc-array.c mongoc-async.c mongoc-async-cmd.c mongoc-buffer.c mongoc-bulk-operation.c mongoc-b64.c mongoc-client.c mongoc-client-pool.c mongoc-cluster.c mongoc-collection.c mongoc-counters.c mongoc-cursor.c mongoc-cursor-array.c mongoc-cursor-cursorid.c mongoc-cursor-transform.c mongoc-database.c mongoc-find-and-modify.c mongoc-host-list.c mongoc-init.c mongoc-gridfs.c mongoc-gridfs-file.c mongoc-gridfs-file-page.c mongoc-gridfs-file-list.c mongoc-handshake.c mongoc-index.c mongoc-linux-distro-scanner.c mongoc-list.c mongoc-log.c mongoc-matcher-op.c mongoc-matcher.c mongoc-memcmp.c mongoc-opcode.c mongoc-queue.c mongoc-read-concern.c mongoc-read-prefs.c mongoc-rpc.c mongoc-server-description.c mongoc-server-stream.c mongoc-set.c mongoc-socket.c mongoc-stream.c mongoc-stream-buffered.c mongoc-stream-file.c mongoc-stream-gridfs.c mongoc-stream-socket.c mongoc-topology.c mongoc-topology-description.c mongoc-topology-scanner.c mongoc-uri.c mongoc-util.c mongoc-version-functions.c mongoc-write-command.c mongoc-write-concern.c" , "mongodb" ) ;
5561 ADD_SOURCES ( configure_module_dirname + "/src/libmongoc/src/mongoc" , "mongoc-crypto.c mongoc-scram.c" , "mongodb" ) ;
5662 ADD_SOURCES ( configure_module_dirname + "/src/libmongoc/src/mongoc" , "mongoc-stream-tls.c mongoc-ssl.c" , "mongodb" ) ;
5763 ADD_SOURCES ( configure_module_dirname + "/src/libmongoc/src/mongoc" , "mongoc-crypto-openssl.c mongoc-rand-openssl.c" , "mongodb" ) ;
@@ -79,7 +85,7 @@ if (PHP_MONGODB != "no") {
7985 BSON_HAVE_TIMESPEC : 0 ,
8086 BSON_EXTRA_ALIGN : 0 ,
8187 BSON_HAVE_SYSCALL_TID : 0 ,
82- BSON_HAVE_DECIMAL128 : 0 ,
88+ BSON_HAVE_DECIMAL128 : 0
8389 } ;
8490
8591 if ( CHECK_FUNC_IN_HEADER ( "stdio.h" , "_set_output_format" ) ) {
@@ -105,6 +111,7 @@ if (PHP_MONGODB != "no") {
105111 // Secure Transport does not apply to Windows
106112 MONGOC_ENABLE_SSL_SECURE_TRANSPORT : 0 ,
107113 MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO : 0 ,
114+ MONGOC_ENABLE_SSL_LIBRESSL : 0 ,
108115 MONGOC_ENABLE_SSL_OPENSSL : 0 ,
109116 MONGOC_ENABLE_CRYPTO_LIBCRYPTO : 0 ,
110117 MONGOC_ENABLE_SSL : 0 ,
@@ -114,11 +121,15 @@ if (PHP_MONGODB != "no") {
114121 MONGOC_HAVE_SASL_CLIENT_DONE : 0 ,
115122 MONGOC_HAVE_WEAK_SYMBOLS : 0 ,
116123 MONGOC_NO_AUTOMATIC_GLOBALS : 1 ,
124+ MONGOC_CC : "" ,
125+ MONGOC_USER_SET_CFLAGS : "" ,
126+ MONGOC_USER_SET_LDFLAGS : ""
117127 } ;
118128
119129 if ( CHECK_LIB ( "ssleay32.lib" , "mongodb" , PHP_MONGODB ) &&
120130 CHECK_LIB ( "libeay32.lib" , "mongodb" , PHP_MONGODB ) &&
121- CHECK_HEADER_ADD_INCLUDE ( "openssl/ssl.h" , "CFLAGS_MONGOC" ) ) {
131+ CHECK_LIB ( "crypt32.lib" , "mongodb" , PHP_MONGODB ) &&
132+ CHECK_HEADER_ADD_INCLUDE ( "openssl/ssl.h" , "CFLAGS_MONGODB" ) ) {
122133 mongoc_opts . MONGOC_ENABLE_SSL_OPENSSL = 1 ;
123134 mongoc_opts . MONGOC_ENABLE_CRYPTO_LIBCRYPTO = 1 ;
124135 mongoc_opts . MONGOC_ENABLE_SSL = 1 ;
@@ -130,7 +141,7 @@ if (PHP_MONGODB != "no") {
130141
131142 if ( PHP_MONGODB_SASL != "no" &&
132143 CHECK_LIB ( "libsasl.lib" , "mongodb" , PHP_MONGODB ) &&
133- CHECK_HEADER_ADD_INCLUDE ( "sasl/sasl.h" , "CFLAGS_MONGOC " ) ) {
144+ CHECK_HEADER_ADD_INCLUDE ( "sasl/sasl.h" , "CFLAGS_MONGODB " ) ) {
134145 mongoc_opts . MONGOC_ENABLE_SASL = 1 ;
135146 if ( CHECK_FUNC_IN_HEADER ( "sasl/sasl.h" , "sasl_client_done" ) ) {
136147 mongoc_opts . MONGOC_HAVE_SASL_CLIENT_DONE = 1 ;
@@ -139,6 +150,15 @@ if (PHP_MONGODB != "no") {
139150 WARNING ( "mongodb libsasl support not enabled, libs not found" ) ;
140151 }
141152
153+ if ( typeof COMPILER_NAME === 'string' ) {
154+ mongoc_opts . MONGOC_CC = COMPILER_NAME ;
155+ } else if ( typeof VC_VERSIONS [ VCVERS ] === 'string' ) {
156+ mongoc_opts . MONGOC_CC = VC_VERSIONS [ VCVERS ] ;
157+ }
158+
159+ /* MONGOC_USER_SET_CFLAGS and MONGOC_USER_SET_LDFLAGS can be left blank, as we
160+ * do not expect CFLAGS or LDFLAGS to be customized at build time. */
161+
142162 mongodb_generate_header (
143163 configure_module_dirname + "/src/libmongoc/src/mongoc/mongoc-config.h.in" ,
144164 configure_module_dirname + "/src/libmongoc/src/mongoc/mongoc-config.h" ,
0 commit comments