Files
mongo-php-driver/scripts/autotools/PlatformFlags.m4
T
Jeremy Mikola cd1f3ee60c 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 ab44b0cbeb based on upstream work in mongodb/mongo-c-driver@9d2d8b157c, but libmongoc did not utilize the same logic.

In any event, these constants are now defined unconditionally for libmongoc since mongodb/mongo-c-driver@c5206511cd, 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@50f701ce6a, but PHPC never incorporated the defines into its own CPPFLAGS.

The recent additions to PlatformFlags.m4 should be sufficient.
2023-08-15 09:16:37 -04:00

30 lines
1.8 KiB
Plaintext

dnl Enable POSIX features up to POSIX.1-2008 plus the XSI extension and BSD-derived definitions.
dnl Both _BSD_SOURCE and _DEFAULT_SOURCE are defined for backwards-compatibility with glibc 2.19 and earlier.
dnl _BSD_SOURCE and _DEFAULT_SOURCE are required by `getpagesize`, `h_errno`, etc.
dnl _XOPEN_SOURCE=700 is required by `strnlen`, `strerror_l`, etc.
dnl https://man7.org/linux/man-pages/man7/feature_test_macros.7.html
dnl https://pubs.opengroup.org/onlinepubs/7908799/xsh/compilation.html
CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_DEFAULT_SOURCE"
PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -D_XOPEN_SOURCE=700 -D_BSD_SOURCE -D_DEFAULT_SOURCE"
dnl Enable non-standard features on FreeBSD with __BSD_VISIBLE=1
if test "$os_freebsd" = "yes"; then
CPPFLAGS="$CPPFLAGS -D__BSD_VISIBLE=1"
PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -D__BSD_VISIBLE=1"
fi
AS_IF([test "$os_darwin" = "yes"],[
dnl Non-POSIX extensions are required by `_SC_NPROCESSORS_ONLN`.
dnl https://opensource.apple.com/source/Libc/Libc-1439.40.11/gen/compat.5.auto.html
CPPFLAGS="$CPPFLAGS -D_DARWIN_C_SOURCE"
PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_BUNDLED_CFLAGS -D_DARWIN_C_SOURCE"
dnl Ignore OpenSSL deprecation warnings on OSX
AX_CHECK_COMPILE_FLAG([-Wno-deprecated-declarations], [STD_CFLAGS="$STD_CFLAGS -Wno-deprecated-declarations"])
dnl We know there are some cast-align issues on OSX
AX_CHECK_COMPILE_FLAG([-Wno-cast-align], [STD_CFLAGS="$STD_CFLAGS -Wno-cast-align"])
AX_CHECK_COMPILE_FLAG([-Wno-unneeded-internal-declaration], [STD_CFLAGS="$STD_CFLAGS -Wno-unneeded-internal-declaration"])
AX_CHECK_COMPILE_FLAG([-Wno-error=unused-command-line-argument], [STD_CFLAGS="$STD_CFLAGS -Wno-error=unused-command-line-argument"])
])