Skip to content

Commit 8dfe6c3

Browse files
authored
PHPC-2256: Build configuration improvements (#1483)
* PHPC-2311: Note that with-libbson and with-libmongoc are deprecated * PHPC-2312: MONGOC_ENABLE_SASL_GSSAPI is obsolete * PHPC-1218: Use m4_include with base path for including m4 scripts This removes the custom _include macro, which used sinclude on two different paths in order to support both shared and static builds. Unlike m4_sinclude, m4_include reports an error if the file is not found, so this also addresses the validation that was disabled to support PECL installs. * PHPC-2300 and PHPC-2302: Fix configure output for bundled libbson/libmongoc versions This was missed in 7ccb094 and 1c533ff. * PHPC-2225: Validate PHP_ARG_ENABLE and PHP_ARG_WITH configure options Introduce a PHP_MONGODB_VALIDATE_ARG macro, which is called after processing a configure option. PHP may still assign "yes" as a value during parsing, so map that to another value when necessary (e.g. selecting a crypto/TLS library). * Add deprecation notice for --enable-system-ciphers in shared builds * PHPC-2155: Remove prefixes for quoted shell variable references * PHPC-1017: Allow configure options to be specified with PECL install Introducing <configureoption> tags in package.xml means that PECL installs will now prompt for input. Non-interactive installs can still be achieved by either piping input (e.g. `yes '' | pecl install mongodb`) or explicitly specifying configure options (--configureoptions option for pecl install). * Refer to update-submodule-sources.php in config.m4/w32 and fix macOS compatibility * PHPC-2314: Require OpenSSL 1.0.1+ for libmongoc 1.24+ * PHPC-2315: Use PKG_CHECK_MODULES for detecting libmongoc system libs * Remove superfluous AC_MSG_NOTICE output in CheckSSL.m4
1 parent bd74639 commit 8dfe6c3

File tree

9 files changed

+187
-194
lines changed

9 files changed

+187
-194
lines changed

bin/package.xml.in

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,17 @@ necessary to build a fully-functional MongoDB driver.
6767
</required>
6868
</dependencies>
6969
<providesextension>mongodb</providesextension>
70-
<extsrcrelease/>
70+
<extsrcrelease>
71+
<configureoption name="enable-mongodb-developer-flags" prompt="Enable developer flags? (yes/no)" default="no" />
72+
<configureoption name="enable-mongodb-coverage" prompt="Enable code coverage? (yes/no)" default="no" />
73+
<configureoption name="with-mongodb-system-libs" prompt="Use system libraries for libbson, libmongoc, and libmongocrypt? (yes/no)" default="no" />
74+
<configureoption name="with-mongodb-client-side-encryption" prompt="Enable client-side encryption? (auto/yes/no)" default="auto" />
75+
<configureoption name="with-mongodb-snappy" prompt="Enable Snappy for compression? (auto/yes/no)" default="auto" />
76+
<configureoption name="with-mongodb-zlib" prompt="Enable zlib for compression? (auto/system/bundled/no)" default="auto" />
77+
<configureoption name="with-mongodb-zstd" prompt="Enable zstd for compression? (auto/yes/no)" default="auto" />
78+
<configureoption name="with-mongodb-sasl" prompt="Enable SASL for Kerberos authentication? (auto/cyrus/no)" default="auto" />
79+
<configureoption name="with-mongodb-ssl" prompt="Enable crypto and TLS? (auto/openssl/libressl/darwin/no)" default="auto" />
80+
<configureoption name="enable-mongodb-crypto-system-profile" prompt="Use system crypto profile (OpenSSL only)? (yes/no)" default="no" />
81+
<configureoption name="with-mongodb-utf8proc" prompt="Use bundled or system utf8proc for SCRAM-SHA-256 SASLprep? (bundled/system)" default="bundled" />
82+
</extsrcrelease>
7183
</package>

config.m4

Lines changed: 82 additions & 136 deletions
Large diffs are not rendered by default.

config.w32

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,12 @@ if (PHP_MONGODB != "no") {
112112
// Condense whitespace in CFLAGS
113113
PHP_MONGODB_CFLAGS = PHP_MONGODB_CFLAGS.replace(/\s+/g, ' ');
114114

115-
// On MacOS, use gcut from the coreutils brew package instead of cut
116-
// Generated with: find src/libmongoc/src/common -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
115+
// Sources below are updated by scripts/update-submodule-sources.php
117116
var PHP_MONGODB_COMMON_SOURCES="common-b64.c common-md5.c common-thread.c"
118-
119-
// Generated with: find src/libmongoc/src/kms-message/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 6- | sort -dz | tr '\000' ' '
120117
var PHP_MONGODB_KMS_MESSAGE_SOURCES="hexlify.c kms_azure_request.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_gcp_request.c kms_kmip_reader_writer.c kms_kmip_request.c kms_kmip_response.c kms_kmip_response_parser.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c";
121-
122-
// Generated with: find src/libmongoc/src/libbson/src/bson -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | tr '\000' ' '
123118
var PHP_MONGODB_BSON_SOURCES="bcon.c bson-atomic.c bson.c bson-clock.c bson-context.c bson-decimal128.c bson-error.c bson-iso8601.c bson-iter.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";
124-
125-
// Generated with: find src/libmongoc/src/libbson/src/jsonsl -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | tr '\000' ' '
126119
var PHP_MONGODB_JSONSL_SOURCES="jsonsl.c";
127-
128-
// Generated with: find src/libmongoc/src/libmongoc/src/mongoc -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | tr '\000' ' '
129120
var PHP_MONGODB_MONGOC_SOURCES="mcd-azure.c mcd-rpc.c mongoc-aggregate.c mongoc-apm.c mongoc-array.c mongoc-async.c mongoc-async-cmd.c mongoc-buffer.c mongoc-bulk-operation.c mongoc-change-stream.c mongoc-client.c mongoc-client-pool.c mongoc-client-session.c mongoc-client-side-encryption.c mongoc-cluster-aws.c mongoc-cluster.c mongoc-cluster-cyrus.c mongoc-cluster-sasl.c mongoc-cluster-sspi.c mongoc-cmd.c mongoc-collection.c mongoc-compression.c mongoc-counters.c mongoc-crypt.c mongoc-crypto.c mongoc-crypto-cng.c mongoc-crypto-common-crypto.c mongoc-crypto-openssl.c mongoc-cursor-array.c mongoc-cursor.c mongoc-cursor-change-stream.c mongoc-cursor-cmd.c mongoc-cursor-cmd-deprecated.c mongoc-cursor-find.c mongoc-cursor-find-cmd.c mongoc-cursor-find-opquery.c mongoc-cursor-legacy.c mongoc-cyrus.c mongoc-database.c mongoc-error.c mongoc-find-and-modify.c mongoc-flags.c mongoc-generation-map.c mongoc-gridfs-bucket.c mongoc-gridfs-bucket-file.c mongoc-gridfs.c mongoc-gridfs-file.c mongoc-gridfs-file-list.c mongoc-gridfs-file-page.c mongoc-handshake.c mongoc-host-list.c mongoc-http.c mongoc-index.c mongoc-init.c mongoc-interrupt.c mongoc-libressl.c mongoc-linux-distro-scanner.c mongoc-list.c mongoc-log.c mongoc-matcher.c mongoc-matcher-op.c mongoc-memcmp.c mongoc-ocsp-cache.c mongoc-opcode.c mongoc-openssl.c mongoc-optional.c mongoc-opts.c mongoc-opts-helpers.c mongoc-queue.c mongoc-rand-cng.c mongoc-rand-common-crypto.c mongoc-rand-openssl.c mongoc-read-concern.c mongoc-read-prefs.c mongoc-rpc.c mongoc-sasl.c mongoc-scram.c mongoc-secure-channel.c mongoc-secure-transport.c mongoc-server-api.c mongoc-server-description.c mongoc-server-monitor.c mongoc-server-stream.c mongoc-set.c mongoc-shared.c mongoc-socket.c mongoc-ssl.c mongoc-sspi.c mongoc-stream-buffered.c mongoc-stream.c mongoc-stream-file.c mongoc-stream-gridfs.c mongoc-stream-gridfs-download.c mongoc-stream-gridfs-upload.c mongoc-stream-socket.c mongoc-stream-tls.c mongoc-stream-tls-libressl.c mongoc-stream-tls-openssl-bio.c mongoc-stream-tls-openssl.c mongoc-stream-tls-secure-channel.c mongoc-stream-tls-secure-transport.c mongoc-timeout.c mongoc-topology-background-monitoring.c mongoc-topology.c mongoc-topology-description-apm.c mongoc-topology-description.c mongoc-topology-scanner.c mongoc-ts-pool.c mongoc-uri.c mongoc-util.c mongoc-version-functions.c mongoc-write-command.c mongoc-write-concern.c service-gcp.c";
130-
131-
// Generated with: find src/libmongoc/src/utf8proc-2.8.0 -maxdepth 1 -name '*.c' ! -name 'utf8proc_data.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
132121
var PHP_MONGODB_UTF8PROC_SOURCES="utf8proc.c";
133122

134123
EXTENSION("mongodb", "php_phongo.c", null, PHP_MONGODB_CFLAGS);
@@ -295,21 +284,11 @@ if (PHP_MONGODB != "no") {
295284
MONGOCRYPT_ENABLE_CRYPTO_COMMON_CRYPTO: 0
296285
};
297286

298-
// Generated with: find src/libmongocrypt/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 4- | sort -dz | tr '\000' ' '
287+
// Sources below are updated by scripts/update-submodule-sources.php
299288
var PHP_MONGODB_MONGOCRYPT_SOURCES="mc-array.c mc-efc.c mc-fle2-encryption-placeholder.c mc-fle2-find-equality-payload.c mc-fle2-find-equality-payload-v2.c mc-fle2-find-range-payload.c mc-fle2-find-range-payload-v2.c mc-fle2-insert-update-payload.c mc-fle2-insert-update-payload-v2.c mc-fle2-payload-iev.c mc-fle2-payload-iev-v2.c mc-fle2-payload-uev.c mc-fle2-payload-uev-common.c mc-fle2-payload-uev-v2.c mc-fle2-rfds.c mc-range-edge-generation.c mc-range-encoding.c mc-range-mincover.c mc-rangeopts.c mc-reader.c mc-tokens.c mc-writer.c mongocrypt-binary.c mongocrypt-buffer.c mongocrypt.c mongocrypt-cache.c mongocrypt-cache-collinfo.c mongocrypt-cache-key.c mongocrypt-cache-oauth.c mongocrypt-ciphertext.c mongocrypt-crypto.c mongocrypt-ctx.c mongocrypt-ctx-datakey.c mongocrypt-ctx-decrypt.c mongocrypt-ctx-encrypt.c mongocrypt-ctx-rewrap-many-datakey.c mongocrypt-endpoint.c mongocrypt-kek.c mongocrypt-key-broker.c mongocrypt-key.c mongocrypt-kms-ctx.c mongocrypt-log.c mongocrypt-marking.c mongocrypt-opts.c mongocrypt-status.c mongocrypt-traverse-util.c mongocrypt-util.c";
300-
301-
// Generated with: find src/libmongocrypt/src/crypto -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
302289
var PHP_MONGODB_MONGOCRYPT_CRYPTO_SOURCES="cng.c commoncrypto.c libcrypto.c none.c";
303-
304-
// Note: src/libmongocrypt/src/mlib/ does not contain source files (as of libmongocrypt 1.3.2)
305-
306-
// Generated with: find src/libmongocrypt/src/os_posix -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
307290
var PHP_MONGODB_MONGOCRYPT_OS_POSIX_SOURCES="os_dll.c os_mutex.c";
308-
309-
// Generated with: find src/libmongocrypt/src/os_win -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
310291
var PHP_MONGODB_MONGOCRYPT_OS_WIN_SOURCES="os_dll.c os_mutex.c";
311-
312-
// Generated with: find src/libmongocrypt/kms-message/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 5- | sort -dz | tr '\000' ' '
313292
var PHP_MONGODB_MONGOCRYPT_KMS_MESSAGE_SOURCES="hexlify.c kms_azure_request.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_gcp_request.c kms_kmip_reader_writer.c kms_kmip_request.c kms_kmip_response.c kms_kmip_response_parser.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c";
314293

315294
MONGODB_ADD_SOURCES("/src/libmongocrypt/src", PHP_MONGODB_MONGOCRYPT_SOURCES);

scripts/autotools/libmongoc/CheckCompression.m4

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,30 @@ PHP_ARG_WITH([mongodb-snappy],
44
[MongoDB: Enable Snappy for compression [default=auto]])],
55
[auto],
66
[no])
7+
PHP_MONGODB_VALIDATE_ARG([PHP_MONGODB_SNAPPY], [auto yes no])
78

89
PHP_ARG_WITH([mongodb-zlib],
910
[whether to enable zlib for compression],
10-
[AS_HELP_STRING([--with-mongodb-zlib=@<:@auto/yes/system/bundled/no@:>@],
11+
[AS_HELP_STRING([--with-mongodb-zlib=@<:@auto/system/bundled/no@:>@],
1112
[MongoDB: Enable zlib for compression [default=auto]])],
1213
[auto],
1314
[no])
1415

16+
dnl PHP_ARG_WITH without a value assigns "yes". Treat it like "auto" since we
17+
dnl fall back to bundled zlib if the system library isn't found
18+
if test "$PHP_MONGODB_ZLIB" = "yes"; then
19+
PHP_MONGODB_ZLIB="auto"
20+
fi
21+
22+
PHP_MONGODB_VALIDATE_ARG([PHP_MONGODB_ZLIB], [auto system bundled no])
23+
1524
PHP_ARG_WITH([mongodb-zstd],
1625
[whether to enable zstd for compression],
1726
[AS_HELP_STRING([--with-mongodb-zstd=@<:@auto/yes/no@:>@],
1827
[MongoDB: Enable zstd for compression [default=auto]])],
1928
[auto],
2029
[no])
30+
PHP_MONGODB_VALIDATE_ARG([PHP_MONGODB_ZSTD], [auto yes no])
2131

2232
found_snappy="no"
2333
found_zlib="no"
@@ -50,7 +60,7 @@ AS_IF([test "$PHP_MONGODB_SNAPPY" = "auto" -o "$PHP_MONGODB_SNAPPY" = "yes"],[
5060
fi
5161
])
5262

53-
AS_IF([test "$PHP_MONGODB_ZLIB" = "auto" -o "$PHP_MONGODB_ZLIB" = "yes" -o "$PHP_MONGODB_ZLIB" = "system"],[
63+
AS_IF([test "$PHP_MONGODB_ZLIB" = "auto" -o "$PHP_MONGODB_ZLIB" = "system"],[
5464
PKG_CHECK_MODULES([PHP_MONGODB_ZLIB],[zlib],[
5565
PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS $PHP_MONGODB_ZLIB_CFLAGS"
5666
PHP_EVAL_LIBLINE([$PHP_MONGODB_ZLIB_LIBS],[MONGODB_SHARED_LIBADD])
@@ -77,7 +87,7 @@ AS_IF([test "$PHP_MONGODB_ZLIB" = "auto" -o "$PHP_MONGODB_ZLIB" = "yes" -o "$PHP
7787
])
7888

7989
dnl Use libmongoc's bundled zlib if necessary
80-
AS_IF([test "$found_zlib" = "no" -a \( "$PHP_MONGODB_ZLIB" = "auto" -o "$PHP_MONGODB_ZLIB" = "yes" -o "$PHP_MONGODB_ZLIB" = "bundled" \)],[
90+
AS_IF([test "$found_zlib" = "no" -a \( "$PHP_MONGODB_ZLIB" = "auto" -o "$PHP_MONGODB_ZLIB" = "bundled" \)],[
8191
AC_CHECK_HEADER([unistd.h],[PHP_MONGODB_ZLIB_CFLAGS="$PHP_MONGODB_ZLIB_CFLAGS -DHAVE_UNISTD_H"])
8292
AC_CHECK_HEADER([stdarg.h],[PHP_MONGODB_ZLIB_CFLAGS="$PHP_MONGODB_ZLIB_CFLAGS -DHAVE_STDARG_H"])
8393
bundled_zlib="yes"

scripts/autotools/libmongoc/CheckSSL.m4

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,37 @@
11
PHP_ARG_WITH([mongodb-ssl],
22
[whether to enable crypto and TLS],
3-
[AS_HELP_STRING([--with-mongodb-ssl=@<:@auto/no/openssl/libressl/darwin@:>@],
3+
[AS_HELP_STRING([--with-mongodb-ssl=@<:@auto/openssl/libressl/darwin/no@:>@],
44
[MongoDB: Enable TLS connections and SCRAM-SHA-1 authentication [default=auto]])],
55
[auto],
66
[no])
77

8+
if test "$PHP_MONGODB_SSL" = "auto" -o "$PHP_MONGODB_SSL" = "no"; then
9+
crypto_required="no"
10+
else
11+
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
18+
fi
19+
20+
PHP_MONGODB_VALIDATE_ARG([PHP_MONGODB_SSL], [auto openssl libressl darwin no])
21+
822
PHP_ARG_WITH([openssl-dir],
923
[deprecated option for OpenSSL library path],
1024
[AS_HELP_STRING([--with-openssl-dir=@<:@auto/DIR@:>@],
1125
[MongoDB: OpenSSL library path (deprecated for pkg-config) [default=auto]])],
1226
[auto],
1327
[no])
1428

15-
dnl PHP_ARG_WITH without a value assigns "yes". Treat it like "auto" but required.
16-
AS_IF([test "$PHP_MONGODB_SSL" = "yes"],[
17-
crypto_required="yes"
18-
PHP_MONGODB_SSL="auto"
19-
])
20-
2129
AS_IF([test "$PHP_MONGODB_SSL" = "openssl" -o "$PHP_MONGODB_SSL" = "auto"],[
22-
AC_MSG_NOTICE([checking whether OpenSSL is available])
2330
found_openssl="no"
2431
25-
PKG_CHECK_MODULES([PHP_MONGODB_SSL],[openssl],[
32+
dnl OpenSSL 1.0.1 is required for libmongoc 1.24+ (CDRIVER-3562). This can be
33+
dnl enforced through pkg-config but not the PHP_CHECK_LIBRARY fallback.
34+
PKG_CHECK_MODULES([PHP_MONGODB_SSL],[openssl >= 1.0.1],[
2635
PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS $PHP_MONGODB_SSL_CFLAGS"
2736
PHP_EVAL_LIBLINE([$PHP_MONGODB_SSL_LIBS],[MONGODB_SHARED_LIBADD])
2837
PHP_MONGODB_SSL="openssl"
@@ -68,15 +77,15 @@ AS_IF([test "$PHP_MONGODB_SSL" = "openssl" -o "$PHP_MONGODB_SSL" = "auto"],[
6877
[$OPENSSL_LIBDIR_LDFLAG])
6978
7079
71-
AC_MSG_NOTICE([checking whether OpenSSL >= 1.1.0 is available])
80+
dnl Check whether OpenSSL >= 1.1.0 is available
7281
PHP_CHECK_LIBRARY([ssl],
7382
[OPENSSL_init_ssl],
7483
[have_ssl_lib="yes"],
7584
[have_ssl_lib="no"],
7685
[$OPENSSL_LIBDIR_LDFLAG -lcrypto])
7786
87+
dnl If necessary, check whether OpenSSL < 1.1.0 is available
7888
if test "$have_ssl_lib" = "no"; then
79-
AC_MSG_NOTICE([checking whether OpenSSL < 1.1.0 is available])
8089
PHP_CHECK_LIBRARY([ssl],
8190
[SSL_library_init],
8291
[have_ssl_lib="yes"],
@@ -117,23 +126,22 @@ AS_IF([test "$PHP_MONGODB_SSL" = "openssl" -o "$PHP_MONGODB_SSL" = "auto"],[
117126
])
118127

119128
AS_IF([test "$PHP_MONGODB_SSL" = "darwin" -o \( "$PHP_MONGODB_SSL" = "auto" -a "$os_darwin" = "yes" \)],[
120-
AC_MSG_NOTICE([checking whether Darwin SSL is available])
121-
122129
if test "$os_darwin" = "no"; then
123130
AC_MSG_ERROR([Darwin SSL is only supported on macOS])
124131
fi
132+
125133
dnl PHP_FRAMEWORKS is only used for SAPI builds, so use MONGODB_SHARED_LIBADD for shared builds
126134
if test "$ext_shared" = "yes"; then
127135
MONGODB_SHARED_LIBADD="-framework Security -framework CoreFoundation $MONGODB_SHARED_LIBADD"
128136
else
129137
PHP_ADD_FRAMEWORK([Security])
130138
PHP_ADD_FRAMEWORK([CoreFoundation])
131139
fi
140+
132141
PHP_MONGODB_SSL="darwin"
133142
])
134143

135144
AS_IF([test "$PHP_MONGODB_SSL" = "libressl" -o "$PHP_MONGODB_SSL" = "auto"],[
136-
AC_MSG_NOTICE([checking whether LibreSSL is available])
137145
found_libressl="no"
138146
139147
PKG_CHECK_MODULES([PHP_MONGODB_SSL],[libtls libcrypto],[
@@ -166,7 +174,7 @@ AS_IF([test "$PHP_MONGODB_SSL" = "libressl" -o "$PHP_MONGODB_SSL" = "auto"],[
166174
])
167175

168176
AS_IF([test "$PHP_MONGODB_SSL" = "auto"],[
169-
if test "x$crypto_required" = "xyes"; then
177+
if test "$crypto_required" = "yes"; then
170178
AC_MSG_ERROR([crypto and TLS libraries not found])
171179
fi
172180
PHP_MONGODB_SSL="no"
@@ -217,7 +225,7 @@ else
217225
AC_SUBST(MONGOC_ENABLE_CRYPTO_COMMON_CRYPTO, 0)
218226
fi
219227

220-
if test "x$have_ASN1_STRING_get0_data" = "xyes"; then
228+
if test "$have_ASN1_STRING_get0_data" = "yes"; then
221229
AC_SUBST(MONGOC_HAVE_ASN1_STRING_GET0_DATA, 1)
222230
else
223231
AC_SUBST(MONGOC_HAVE_ASN1_STRING_GET0_DATA, 0)
@@ -229,6 +237,7 @@ PHP_ARG_ENABLE([mongodb-crypto-system-profile],
229237
[MongoDB: Use system crypto profile (OpenSSL only) [default=no]])],
230238
[no],
231239
[no])
240+
PHP_MONGODB_VALIDATE_ARG([PHP_MONGODB_CRYPTO_SYSTEM_PROFILE], [yes no])
232241

233242
PHP_ARG_WITH([system-ciphers],
234243
[deprecated option for whether to use system crypto profile],
@@ -237,6 +246,16 @@ PHP_ARG_WITH([system-ciphers],
237246
[no],
238247
[no])
239248

249+
dnl Do not validate PHP_SYSTEM_CIPHERS for static builds, since it is also used
250+
dnl by the OpenSSL extension, which checks for values other than "no".
251+
if test "$ext_shared" = "yes"; then
252+
PHP_MONGODB_VALIDATE_ARG([PHP_SYSTEM_CIPHERS], [yes no])
253+
254+
if test "$PHP_SYSTEM_CIPHERS" != "no"; then
255+
AC_MSG_WARN([Using --enable-system-ciphers is deprecated and will be removed in a future version. Please use --enable-mongodb-crypto-system-profile instead])
256+
fi
257+
fi
258+
240259
dnl Also consider the deprecated --enable-system-ciphers option
241260
if test "$PHP_MONGODB_CRYPTO_SYSTEM_PROFILE" = "yes" -o "$PHP_SYSTEM_CIPHERS" = "yes"; then
242261
if test "$PHP_MONGODB_SSL" = "openssl"; then

scripts/autotools/libmongoc/CheckSasl.m4

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
PHP_ARG_WITH([mongodb-sasl],
22
[whether to enable SASL for Kerberos authentication],
3-
[AS_HELP_STRING([--with-mongodb-sasl=@<:@auto/no/cyrus@:>@],
3+
[AS_HELP_STRING([--with-mongodb-sasl=@<:@auto/cyrus/no@:>@],
44
[MongoDB: Enable SASL for Kerberos authentication [default=auto]])],
55
[auto],
66
[no])
77

8-
dnl PHP_ARG_WITH without a value assigns "yes". Treat it like "auto" but required.
9-
AS_IF([test "$PHP_MONGODB_SASL" = "cyrus" -o "$PHP_MONGODB_SASL" = "auto" -o "$PHP_MONGODB_SASL" = "yes"],[
8+
dnl PHP_ARG_WITH without a value assigns "yes". Treat it like "cyrus" (required)
9+
if test "$PHP_MONGODB_SASL" = "yes"; then
10+
PHP_MONGODB_SASL="cyrus"
11+
fi
12+
13+
PHP_MONGODB_VALIDATE_ARG([PHP_MONGODB_SASL], [auto cyrus no])
14+
15+
AS_IF([test "$PHP_MONGODB_SASL" = "auto" -o "$PHP_MONGODB_SASL" = "cyrus"],[
1016
found_cyrus="no"
1117
1218
PKG_CHECK_MODULES([PHP_MONGODB_SASL],[libsasl2],[
@@ -39,31 +45,25 @@ AS_IF([test "$PHP_MONGODB_SASL" = "cyrus" -o "$PHP_MONGODB_SASL" = "auto" -o "$P
3945
$MONGODB_SHARED_LIBADD)
4046
fi
4147
42-
if test \( "$PHP_MONGODB_SASL" = "cyrus" -o "$PHP_MONGODB_SASL" = "yes" \) -a "$found_cyrus" != "yes"; then
48+
if test "$PHP_MONGODB_SASL" = "cyrus" -a "$found_cyrus" != "yes"; then
4349
AC_MSG_ERROR([Cyrus SASL libraries and development headers could not be found])
4450
fi
4551
])
4652

47-
AS_IF([test "$PHP_MONGODB_SASL" = "auto"],[
53+
if test "$PHP_MONGODB_SASL" = "auto"; then
4854
PHP_MONGODB_SASL="no"
49-
])
50-
51-
dnl Warn for unsupported values (e.g. Cyrus SASL search path)
52-
if test ! \( "$PHP_MONGODB_SASL" = "cyrus" -o "$PHP_MONGODB_SASL" = "no" \); then
53-
AC_MSG_WARN([unsupported --with-mongodb-sasl value: $PHP_MONGODB_SASL])
5455
fi
5556

5657
AC_MSG_CHECKING([which SASL library to use])
5758
AC_MSG_RESULT([$PHP_MONGODB_SASL])
5859

59-
dnl Disable Windows SSPI and GSSAPI
60+
dnl Disable Windows SSPI
6061
AC_SUBST(MONGOC_ENABLE_SASL_SSPI, 0)
61-
AC_SUBST(MONGOC_ENABLE_SASL_GSSAPI, 0)
6262

6363
if test "$PHP_MONGODB_SASL" = "cyrus"; then
6464
AC_SUBST(MONGOC_ENABLE_SASL, 1)
6565
AC_SUBST(MONGOC_ENABLE_SASL_CYRUS, 1)
66-
if test "x$have_sasl_client_done" = "xyes"; then
66+
if test "$have_sasl_client_done" = "yes"; then
6767
AC_SUBST(MONGOC_HAVE_SASL_CLIENT_DONE, 1)
6868
else
6969
AC_SUBST(MONGOC_HAVE_SASL_CLIENT_DONE, 0)

scripts/autotools/libmongoc/CheckUtf8Proc.m4

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
PHP_ARG_WITH([mongodb-utf8proc],
2-
[whether to use system or bundled utf8proc for SCRAM-SHA-256 SASLprep],
2+
[whether to use bundled or system utf8proc for SCRAM-SHA-256 SASLprep],
33
[AS_HELP_STRING([--with-mongodb-utf8proc=@<:@bundled/system@:>@],
4-
[MongoDB: Enable utf8proc for SCRAM-SHA-256 SASLprep [default=bundled]])],
4+
[MongoDB: Use bundled or system utf8proc for SCRAM-SHA-256 SASLprep [default=bundled]])],
55
[bundled],
66
[no])
7+
PHP_MONGODB_VALIDATE_ARG([PHP_MONGODB_UTF8PROC], [bundled system])
78

89
found_utf8proc="no"
910
bundled_utf8proc="no"

0 commit comments

Comments
 (0)