11PHP_ARG_WITH([ mongodb-ssl] ,
22 [ whether to enable crypto and TLS] ,
3- [ AS_HELP_STRING ( [ --with-mongodb-ssl=@<:@ auto/openssl/libressl/ darwin/no@:>@ ] ,
3+ [ AS_HELP_STRING ( [ --with-mongodb-ssl=@<:@ auto/openssl/darwin/no@:>@ ] ,
44 [ MongoDB: Enable TLS connections and SCRAM-SHA-1 authentication [ default=auto] ] ) ] ,
55 [ auto] ,
66 [ no] )
77
8+ dnl PHP_ARG_WITH without a value assigns "yes". Treat it like "auto" but
9+ dnl require a crypto library.
10+ if test "$PHP_MONGODB_SSL" = "yes"; then
11+ PHP_MONGODB_SSL="auto"
12+ fi
13+
14+ dnl TODO 3.0: Remove libressl from valid options
15+ PHP_MONGODB_VALIDATE_ARG([ PHP_MONGODB_SSL] , [ auto openssl libressl darwin no] )
16+
17+ if test "$PHP_MONGODB_SSL" = "libressl"; then
18+ dnl libressl is a valid option, but it is not supported by libmongoc
19+ dnl Warn users that it is not supported and treat it like "auto"
20+ PHP_MONGODB_SSL="auto"
21+ AC_MSG_WARN ( [ Building with libressl is not supported by libmongoc. Falling back to "auto".] )
22+ fi
23+
824if test "$PHP_MONGODB_SSL" = "auto" -o "$PHP_MONGODB_SSL" = "no"; then
925 crypto_required="no"
1026else
1127 crypto_required="yes"
12-
13- dnl PHP_ARG_WITH without a value assigns "yes". Treat it like "auto" but
14- dnl require a crypto library.
15- if test "$PHP_MONGODB_SSL" = "yes"; then
16- PHP_MONGODB_SSL="auto"
17- fi
1828fi
1929
20- PHP_MONGODB_VALIDATE_ARG([ PHP_MONGODB_SSL] , [ auto openssl libressl darwin no] )
21-
2230AS_IF ( [ test "$PHP_MONGODB_SSL" = "openssl" -o "$PHP_MONGODB_SSL" = "auto"] ,[
2331 found_openssl="no"
2432
@@ -130,38 +138,6 @@ AS_IF([test "$PHP_MONGODB_SSL" = "darwin" -o \( "$PHP_MONGODB_SSL" = "auto" -a "
130138 PHP_MONGODB_SSL="darwin"
131139] )
132140
133- AS_IF ( [ test "$PHP_MONGODB_SSL" = "libressl" -o "$PHP_MONGODB_SSL" = "auto"] ,[
134- found_libressl="no"
135-
136- PKG_CHECK_MODULES([ PHP_MONGODB_SSL] ,[ libtls libcrypto] ,[
137- PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS $PHP_MONGODB_SSL_CFLAGS"
138- PHP_EVAL_LIBLINE([ $PHP_MONGODB_SSL_LIBS] ,[ MONGODB_SHARED_LIBADD] )
139- PHP_MONGODB_SSL="libressl"
140- found_libressl="yes"
141- ] ,[
142- PHP_CHECK_LIBRARY([ crypto] ,
143- [ EVP_DigestInit_ex] ,
144- [ have_crypto_lib="yes"] ,
145- [ have_crypto_lib="no"] )
146- PHP_CHECK_LIBRARY([ tls] ,
147- [ tls_init] ,
148- [ have_ssl_lib="yes"] ,
149- [ have_ssl_lib="no"] ,
150- [ -lcrypto] )
151-
152- if test "$have_ssl_lib" = "yes" -a "$have_crypto_lib" = "yes"; then
153- PHP_ADD_LIBRARY([ tls] ,,[ MONGODB_SHARED_LIBADD] )
154- PHP_ADD_LIBRARY([ crypto] ,,[ MONGODB_SHARED_LIBADD] )
155- PHP_MONGODB_SSL="libressl"
156- found_libressl="yes"
157- fi
158- ] )
159-
160- if test "$PHP_MONGODB_SSL" = "libressl" -a "$found_libressl" != "yes"; then
161- AC_MSG_ERROR ( [ LibreSSL libraries and development headers could not be found] )
162- fi
163- ] )
164-
165141AS_IF ( [ test "$PHP_MONGODB_SSL" = "auto"] ,[
166142 if test "$crypto_required" = "yes"; then
167143 AC_MSG_ERROR ( [ crypto and TLS libraries not found] )
@@ -177,28 +153,18 @@ AC_SUBST(MONGOC_ENABLE_SSL_SECURE_CHANNEL, 0)
177153AC_SUBST ( MONGOC_ENABLE_CRYPTO_CNG , 0 )
178154AC_SUBST ( MONGOC_HAVE_BCRYPT_PBKDF2 , 0 )
179155
180- if test "$PHP_MONGODB_SSL" = "openssl" -o "$PHP_MONGODB_SSL" = "libressl" -o "$PHP_MONGODB_SSL" = " darwin"; then
156+ if test "$PHP_MONGODB_SSL" = "openssl" -o "$PHP_MONGODB_SSL" = "darwin"; then
181157 AC_SUBST ( MONGOC_ENABLE_SSL , 1 )
182158 AC_SUBST ( MONGOC_ENABLE_CRYPTO , 1 )
183159 if test "$PHP_MONGODB_SSL" = "darwin"; then
184160 AC_SUBST ( MONGOC_ENABLE_SSL_OPENSSL , 0 )
185- AC_SUBST ( MONGOC_ENABLE_SSL_LIBRESSL , 0 )
186161 AC_SUBST ( MONGOC_ENABLE_SSL_SECURE_TRANSPORT , 1 )
187162 AC_SUBST ( MONGOC_ENABLE_CRYPTO_LIBCRYPTO , 0 )
188163 AC_SUBST ( MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO , 1 )
189164
190165 PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -DKMS_MESSAGE_ENABLE_CRYPTO=1 -DKMS_MESSAGE_ENABLE_CRYPTO_COMMON_CRYPTO=1"
191166 elif test "$PHP_MONGODB_SSL" = "openssl"; then
192167 AC_SUBST ( MONGOC_ENABLE_SSL_OPENSSL , 1 )
193- AC_SUBST ( MONGOC_ENABLE_SSL_LIBRESSL , 0 )
194- AC_SUBST ( MONGOC_ENABLE_SSL_SECURE_TRANSPORT , 0 )
195- AC_SUBST ( MONGOC_ENABLE_CRYPTO_LIBCRYPTO , 1 )
196- AC_SUBST ( MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO , 0 )
197-
198- PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -DKMS_MESSAGE_ENABLE_CRYPTO=1 -DKMS_MESSAGE_ENABLE_CRYPTO_LIBCRYPTO=1"
199- elif test "$PHP_MONGODB_SSL" = "libressl"; then
200- AC_SUBST ( MONGOC_ENABLE_SSL_OPENSSL , 0 )
201- AC_SUBST ( MONGOC_ENABLE_SSL_LIBRESSL , 1 )
202168 AC_SUBST ( MONGOC_ENABLE_SSL_SECURE_TRANSPORT , 0 )
203169 AC_SUBST ( MONGOC_ENABLE_CRYPTO_LIBCRYPTO , 1 )
204170 AC_SUBST ( MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO , 0 )
@@ -207,7 +173,6 @@ if test "$PHP_MONGODB_SSL" = "openssl" -o "$PHP_MONGODB_SSL" = "libressl" -o "$P
207173 fi
208174else
209175 AC_SUBST ( MONGOC_ENABLE_SSL , 0 )
210- AC_SUBST ( MONGOC_ENABLE_SSL_LIBRESSL , 0 )
211176 AC_SUBST ( MONGOC_ENABLE_SSL_OPENSSL , 0 )
212177 AC_SUBST ( MONGOC_ENABLE_SSL_SECURE_TRANSPORT , 0 )
213178 AC_SUBST ( MONGOC_ENABLE_CRYPTO , 0 )
0 commit comments