Skip to content

Commit a79c983

Browse files
committed
Merged pull request #849
2 parents 5a3ead6 + ab1f151 commit a79c983

File tree

5 files changed

+63
-1
lines changed

5 files changed

+63
-1
lines changed

config.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ if test "$PHP_MONGODB" != "no"; then
265265
_include([scripts/autotools/libmongoc/CheckResolv.m4])
266266
_include([scripts/autotools/libmongoc/CheckSasl.m4])
267267
_include([scripts/autotools/libmongoc/CheckSSL.m4])
268+
_include([scripts/autotools/libmongoc/CheckICU.m4])
268269
_include([scripts/autotools/libmongoc/FindDependencies.m4])
269270
_include([scripts/autotools/libmongoc/PlatformFlags.m4])
270271
_include([scripts/autotools/libmongoc/Versions.m4])

config.w32

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ if (PHP_MONGODB != "no") {
154154
MONGOC_ENABLE_SASL_CYRUS: 0,
155155
MONGOC_ENABLE_SASL_GSSAPI: 0,
156156
MONGOC_ENABLE_SASL_SSPI: 0,
157+
MONGOC_ENABLE_ICU: 0,
157158
MONGOC_ENABLE_RDTSCP: 0,
158159
MONGOC_ENABLE_SHM_COUNTERS: 0,
159160
MONGOC_HAVE_ASN1_STRING_GET0_DATA: 0,
@@ -225,6 +226,23 @@ if (PHP_MONGODB != "no") {
225226
mongoc_opts.MONGOC_HAVE_DNSAPI = 1;
226227
}
227228

229+
if (CHECK_LIB("icuuc.lib", "mongodb", PHP_MONGODB) &&
230+
CHECK_HEADER_ADD_INCLUDE("unicode/utf.h", "CFLAGS_MONGODB")) {
231+
mongoc_opts.MONGODB_ENABLE_ICU = 1;
232+
233+
ADD_FLAG("LIBS_MONGODB", "icudt.lib icuin.lib icuio.lib");
234+
235+
/* Compat for ICU before 58.1.*/
236+
if (CHECK_LIB("icule.lib", "mongodb", PHP_MONGODB)) {
237+
ADD_FLAG("LIBS_MONGODB", "icule.lib");
238+
}
239+
if (CHECK_LIB("iculx.lib", "mongodb", PHP_MONGODB)) {
240+
ADD_FLAG("LIBS_MONGODB", "iculx.lib");
241+
}
242+
243+
ADD_FLAG("CFLAGS_MONGODB", "/EHsc /D U_USING_ICU_NAMESPACE=1");
244+
}
245+
228246
if (typeof COMPILER_NAME === 'string') {
229247
mongoc_opts.MONGOC_CC = COMPILER_NAME;
230248
} else if (typeof VC_VERSIONS[VCVERS] === 'string') {

php_phongo.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3034,6 +3034,12 @@ PHP_MINFO_FUNCTION(mongodb)
30343034
php_info_print_table_row(2, "libmongoc SASL", "disabled");
30353035
#endif
30363036

3037+
#ifdef MONGOC_ENABLE_ICU
3038+
php_info_print_table_row(2, "libmongoc ICU", "enabled");
3039+
#else
3040+
php_info_print_table_row(2, "libmongoc ICU", "disabled");
3041+
#endif
3042+
30373043
#ifdef MONGOC_ENABLE_COMPRESSION
30383044
php_info_print_table_row(2, "libmongoc compression", "enabled");
30393045
#ifdef MONGOC_ENABLE_COMPRESSION_SNAPPY
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
PHP_ARG_WITH([mongodb-icu],
2+
[whether to enable ICU for SASLPrep with SCRAM-SHA-256 authentication],
3+
[AS_HELP_STRING([--with-mongodb-icu=@<:@auto/yes/no@:>@],
4+
[MongoDB: Enable ICU for SASLPrep with SCRAM-SHA-256 authentication [default=auto]])],
5+
[auto],
6+
[no])
7+
8+
AS_IF([test "$PHP_MONGODB_ICU" = "auto" -o "$PHP_MONGODB_ICU" = "yes"],[
9+
found_icu=no
10+
11+
PKG_CHECK_MODULES([PHP_MONGODB_ICU],[icu-uc],[
12+
PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS $PHP_MONGODB_ICU_CFLAGS"
13+
PHP_EVAL_LIBLINE([$PHP_MONGODB_ICU_LIBS],[MONGODB_SHARED_LIBADD])
14+
PHP_MONGODB_ICU="yes"
15+
found_icu=yes
16+
],[
17+
found_icu=no
18+
])
19+
20+
if test "$PHP_MONGODB_ICU" = "yes" -a "$found_icu" = "no"; then
21+
AC_MSG_ERROR([ICU libraries and development headers could not be found])
22+
fi
23+
])
24+
25+
AS_IF([test "$PHP_MONGODB_ICU" = "auto"],[
26+
PHP_MONGODB_ICU="no"
27+
])
28+
29+
if test ! \( "$PHP_MONGODB_ICU" = "yes" -o "$PHP_MONGODB_ICU" = "no" \); then
30+
AC_MSG_WARN([unsupported --with-mongodb-icu value: $PHP_MONGODB_ICU])
31+
fi
32+
33+
if test "$PHP_MONGODB_ICU" = "yes"; then
34+
AC_SUBST(MONGOC_ENABLE_ICU, 1)
35+
else
36+
AC_SUBST(MONGOC_ENABLE_ICU, 0)
37+
fi

src/libmongoc

Submodule libmongoc updated 193 files

0 commit comments

Comments
 (0)