Skip to content

Commit cd1f3ee

Browse files
authored
PHPC-2270 and PHPC-2271: Bump to libmongoc 1.24.3 and update build configuration (#1458)
* Update to libmongoc 1.24.3 * Define constants for POSIX features and extensions used by libmongoc 1.24 This removes old logic to not define _DEFAULT_SOURCE on Windows (technically MinGW or Cygwin). It's not clear whether that was ever necessary; it was introduced in ab44b0c based on upstream work in mongodb/mongo-c-driver@9d2d8b1, but libmongoc did not utilize the same logic. In any event, these constants are now defined unconditionally for libmongoc since mongodb/mongo-c-driver@c520651, so this change should restore parity between PHPC's autoconf and libmongoc's CMake configurations. * Remove obsolete conditional defines for glibc 2.19 It's not clear what purpose this originally served. It dates back to mongodb/mongo-c-driver@50f701c, but PHPC never incorporated the defines into its own CPPFLAGS. The recent additions to PlatformFlags.m4 should be sufficient.
1 parent 1a2b881 commit cd1f3ee

File tree

8 files changed

+38
-41
lines changed

8 files changed

+38
-41
lines changed

.evergreen/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,9 +1170,9 @@ axes:
11701170
display_name: libmongoc version
11711171
values:
11721172
- id: "lowest-supported"
1173-
display_name: "1.24.2"
1173+
display_name: "1.24.3"
11741174
variables:
1175-
LIBMONGOC_VERSION: "1.24.2"
1175+
LIBMONGOC_VERSION: "1.24.3"
11761176
- id: "upcoming-stable"
11771177
display_name: "1.24-dev"
11781178
variables:

config.m4

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,14 @@ if test "$PHP_MONGODB" != "no"; then
253253
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
254254
AC_MSG_CHECKING(for libbson)
255255
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libbson-1.0; then
256-
if $PKG_CONFIG libbson-1.0 --atleast-version 1.24.2; then
256+
if $PKG_CONFIG libbson-1.0 --atleast-version 1.24.3; then
257257
PHP_MONGODB_BSON_CFLAGS=`$PKG_CONFIG libbson-1.0 --cflags`
258258
PHP_MONGODB_BSON_LIBS=`$PKG_CONFIG libbson-1.0 --libs`
259259
PHP_MONGODB_BSON_VERSION=`$PKG_CONFIG libbson-1.0 --modversion`
260260
PHP_MONGODB_BSON_VERSION_STRING="System ($PHP_MONGODB_BSON_VERSION)"
261261
AC_MSG_RESULT(version $PHP_MONGODB_BSON_VERSION found)
262262
else
263-
AC_MSG_ERROR(system libbson must be upgraded to version >= 1.24.2)
263+
AC_MSG_ERROR(system libbson must be upgraded to version >= 1.24.3)
264264
fi
265265
else
266266
AC_MSG_ERROR(pkgconfig and libbson must be installed)
@@ -271,14 +271,14 @@ if test "$PHP_MONGODB" != "no"; then
271271

272272
AC_MSG_CHECKING(for libmongoc)
273273
if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libmongoc-1.0; then
274-
if $PKG_CONFIG libmongoc-1.0 --atleast-version 1.24.2; then
274+
if $PKG_CONFIG libmongoc-1.0 --atleast-version 1.24.3; then
275275
PHP_MONGODB_MONGOC_CFLAGS=`$PKG_CONFIG libmongoc-1.0 --cflags`
276276
PHP_MONGODB_MONGOC_LIBS=`$PKG_CONFIG libmongoc-1.0 --libs`
277277
PHP_MONGODB_MONGOC_VERSION=`$PKG_CONFIG libmongoc-1.0 --modversion`
278278
PHP_MONGODB_MONGOC_VERSION_STRING="System ($PHP_MONGODB_MONGOC_VERSION)"
279279
AC_MSG_RESULT(version $PHP_MONGODB_MONGOC_VERSION found)
280280
else
281-
AC_MSG_ERROR(system libmongoc must be upgraded to version >= 1.24.2)
281+
AC_MSG_ERROR(system libmongoc must be upgraded to version >= 1.24.3)
282282
fi
283283
else
284284
AC_MSG_ERROR(pkgconfig and libmongoc must be installed)
@@ -344,6 +344,7 @@ if test "$PHP_MONGODB" != "no"; then
344344

345345
_include([scripts/autotools/CheckCompiler.m4])
346346
_include([scripts/autotools/CheckHost.m4])
347+
_include([scripts/autotools/PlatformFlags.m4])
347348

348349
_include([scripts/autotools/libbson/CheckAtomics.m4])
349350
_include([scripts/autotools/libbson/CheckHeaders.m4])
@@ -357,7 +358,6 @@ if test "$PHP_MONGODB" != "no"; then
357358
_include([scripts/autotools/libmongoc/CheckSSL.m4])
358359
_include([scripts/autotools/libmongoc/CheckICU.m4])
359360
_include([scripts/autotools/libmongoc/FindDependencies.m4])
360-
_include([scripts/autotools/libmongoc/PlatformFlags.m4])
361361
_include([scripts/autotools/libmongoc/Versions.m4])
362362
_include([scripts/autotools/libmongoc/WeakSymbols.m4])
363363

scripts/autotools/CheckCompiler.m4

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -86,18 +86,6 @@ if test "$c_compiler" = "unknown"; then
8686
AC_MSG_ERROR([Compiler GCC >= 4.1 or Clang >= 3.3 is required for C compilation])
8787
fi
8888

89-
# GLibc 2.19 complains about both _BSD_SOURCE and _GNU_SOURCE. The _GNU_SOURCE
90-
# contains everything anyway. So just use that.
91-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
92-
#include <features.h>
93-
#ifndef __GLIBC__
94-
#error not glibc
95-
#endif
96-
]], [])],
97-
LIBC_FEATURES="-D_GNU_SOURCE",
98-
LIBC_FEATURES="-D_BSD_SOURCE")
99-
AC_SUBST(LIBC_FEATURES)
100-
10189
AC_C_CONST
10290
AC_C_INLINE
10391
AC_C_TYPEOF

scripts/autotools/PlatformFlags.m4

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
dnl Enable POSIX features up to POSIX.1-2008 plus the XSI extension and BSD-derived definitions.
2+
dnl Both _BSD_SOURCE and _DEFAULT_SOURCE are defined for backwards-compatibility with glibc 2.19 and earlier.
3+
dnl _BSD_SOURCE and _DEFAULT_SOURCE are required by `getpagesize`, `h_errno`, etc.
4+
dnl _XOPEN_SOURCE=700 is required by `strnlen`, `strerror_l`, etc.
5+
dnl https://man7.org/linux/man-pages/man7/feature_test_macros.7.html
6+
dnl https://pubs.opengroup.org/onlinepubs/7908799/xsh/compilation.html
7+
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_DEFAULT_SOURCE"
8+
PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_DEFAULT_SOURCE"
9+
10+
dnl Enable non-standard features on FreeBSD with __BSD_VISIBLE=1
11+
if test "$os_freebsd" = "yes"; then
12+
CPPFLAGS="$CPPFLAGS -D__BSD_VISIBLE=1"
13+
PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -D__BSD_VISIBLE=1"
14+
fi
15+
16+
AS_IF([test "$os_darwin" = "yes"],[
17+
dnl Non-POSIX extensions are required by `_SC_NPROCESSORS_ONLN`.
18+
dnl https://opensource.apple.com/source/Libc/Libc-1439.40.11/gen/compat.5.auto.html
19+
CPPFLAGS="$CPPFLAGS -D_DARWIN_C_SOURCE"
20+
PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -D_DARWIN_C_SOURCE"
21+
22+
dnl Ignore OpenSSL deprecation warnings on OSX
23+
AX_CHECK_COMPILE_FLAG([-Wno-deprecated-declarations], [STD_CFLAGS="$STD_CFLAGS -Wno-deprecated-declarations"])
24+
25+
dnl We know there are some cast-align issues on OSX
26+
AX_CHECK_COMPILE_FLAG([-Wno-cast-align], [STD_CFLAGS="$STD_CFLAGS -Wno-cast-align"])
27+
AX_CHECK_COMPILE_FLAG([-Wno-unneeded-internal-declaration], [STD_CFLAGS="$STD_CFLAGS -Wno-unneeded-internal-declaration"])
28+
AX_CHECK_COMPILE_FLAG([-Wno-error=unused-command-line-argument], [STD_CFLAGS="$STD_CFLAGS -Wno-error=unused-command-line-argument"])
29+
])

scripts/autotools/libbson/FindDependencies.m4

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
if test "$os_win32" != "yes"; then
2-
PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -D_DEFAULT_SOURCE"
3-
fi
4-
51
# Check for strnlen()
62
dnl AC_CHECK_FUNC isn't properly respecting _XOPEN_SOURCE for strnlen for unknown reason
73
AC_SUBST(BSON_HAVE_STRNLEN, 0)

scripts/autotools/libmongoc/PlatformFlags.m4

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/LIBMONGOC_VERSION_CURRENT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.24.2
1+
1.24.3

0 commit comments

Comments
 (0)