Skip to content

Commit e15b54e

Browse files
committed
Merge pull request #651
2 parents 92ac080 + 1ca4d3c commit e15b54e

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

config.w32

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,20 @@ if (PHP_MONGODB != "no") {
153153
mongoc_ssl_path_to_check += ";" + PHP_OPENSSL;
154154
}
155155

156-
if (CHECK_LIB("ssleay32.lib", "mongodb", mongoc_ssl_path_to_check) &&
157-
CHECK_LIB("libeay32.lib", "mongodb", mongoc_ssl_path_to_check) &&
158-
CHECK_LIB("crypt32.lib", "mongodb") &&
159-
CHECK_HEADER_ADD_INCLUDE("openssl/ssl.h", "CFLAGS_MONGODB")) {
156+
var mongoc_ssl_found = false;
157+
158+
/* PHP 7.1.2 introduced SETUP_OPENSSL(), which supports OpenSSL 1.1.x. Earlier
159+
* versions will use the legacy check for OpenSSL 1.0.x and lower. */
160+
if (typeof SETUP_OPENSSL === 'function') {
161+
mongoc_ssl_found = SETUP_OPENSSL("mongodb", mongoc_ssl_path_to_check) > 0;
162+
} else if (CHECK_LIB("ssleay32.lib", "mongodb", mongoc_ssl_path_to_check) &&
163+
CHECK_LIB("libeay32.lib", "mongodb", mongoc_ssl_path_to_check) &&
164+
CHECK_LIB("crypt32.lib", "mongodb", mongoc_ssl_path_to_check) &&
165+
CHECK_HEADER_ADD_INCLUDE("openssl/ssl.h", "CFLAGS_MONGODB")) {
166+
mongoc_ssl_found = true;
167+
}
168+
169+
if (mongoc_ssl_found) {
160170
mongoc_opts.MONGOC_ENABLE_SSL_OPENSSL = 1;
161171
mongoc_opts.MONGOC_ENABLE_CRYPTO_LIBCRYPTO = 1;
162172
mongoc_opts.MONGOC_ENABLE_SSL = 1;

0 commit comments

Comments
 (0)