@@ -165,10 +165,20 @@ if (PHP_MONGODB != "no") {
165165 mongoc_ssl_path_to_check += ";" + PHP_OPENSSL ;
166166 }
167167
168- if ( CHECK_LIB ( "ssleay32.lib" , "mongodb" , mongoc_ssl_path_to_check ) &&
169- CHECK_LIB ( "libeay32.lib" , "mongodb" , mongoc_ssl_path_to_check ) &&
170- CHECK_LIB ( "crypt32.lib" , "mongodb" ) &&
171- CHECK_HEADER_ADD_INCLUDE ( "openssl/ssl.h" , "CFLAGS_MONGODB" ) ) {
168+ var mongoc_ssl_found = false ;
169+
170+ /* PHP 7.1.2 introduced SETUP_OPENSSL(), which supports OpenSSL 1.1.x. Earlier
171+ * versions will use the legacy check for OpenSSL 1.0.x and lower. */
172+ if ( typeof SETUP_OPENSSL === 'function' ) {
173+ mongoc_ssl_found = SETUP_OPENSSL ( "mongodb" , mongoc_ssl_path_to_check ) > 0 ;
174+ } else if ( CHECK_LIB ( "ssleay32.lib" , "mongodb" , mongoc_ssl_path_to_check ) &&
175+ CHECK_LIB ( "libeay32.lib" , "mongodb" , mongoc_ssl_path_to_check ) &&
176+ CHECK_LIB ( "crypt32.lib" , "mongodb" , mongoc_ssl_path_to_check ) &&
177+ CHECK_HEADER_ADD_INCLUDE ( "openssl/ssl.h" , "CFLAGS_MONGODB" ) ) {
178+ mongoc_ssl_found = true ;
179+ }
180+
181+ if ( mongoc_ssl_found ) {
172182 mongoc_opts . MONGOC_ENABLE_SSL_OPENSSL = 1 ;
173183 mongoc_opts . MONGOC_ENABLE_CRYPTO_LIBCRYPTO = 1 ;
174184 mongoc_opts . MONGOC_ENABLE_SSL = 1 ;
0 commit comments