Skip to content

Commit 21d46fe

Browse files
jmikolaalcaeus
andauthored
PHPC-2382: Allow static builds with php-src (#1555)
* PHPC-2382: Allow static builds with php-src Prefer PHP_VERSION_ID for static builds, and fall back to invoking php-config otherwise. mongocrypt.h previously used a path relative to the PHPC project root, which is not compatible with static builds. The current path is relative to src/, which is explicitly defined as an include path in config.m4. * Preserve CPPFLAGS before modification by PlatformFlags.m4 PlatformFlags.m4 modifies CPPFLAGS in order to make checks in subsequent M4 scripts consistent with PHP_MONGODB_BUNDLED_CFLAGS. Restoring its original value after executing all M4 scripts will avoid unintended side effects on a static PHP build. * Remove obsolete STD_CFLAGS assignments STD_CFLAGS was never appended to PHP_MONGODB_BUNDLED_CFLAGS after these M4 scripts were run, so it's safe to assume they had no effect and can be removed entirely. For CheckCompiler.m4, bumping the GCC requirement to 4.6 (still quite old) will ensure compatibility for libmongoc's BEGIN_IGNORE_DEPRECATIONS macro. * Prefix names of internal CFLAGS vars in config.m4 * Remove obsolete comment in config.m4 This comment should have been removed in d8d30e5 * Include CPPFLAGS in build config output Co-authored-by: Andreas Braun <[email protected]>
1 parent a32da95 commit 21d46fe

File tree

4 files changed

+68
-79
lines changed

4 files changed

+68
-79
lines changed

config.m4

Lines changed: 63 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,28 @@ if test "$PHP_MONGODB" != "no"; then
2424
dnl Check PHP version is compatible with this extension
2525
AC_MSG_CHECKING([PHP version])
2626

27-
if test -z "$PHP_CONFIG"; then
28-
AC_MSG_ERROR([php-config not found])
29-
fi
27+
if test -z "${PHP_VERSION_ID}"; then
28+
if test -z "$PHP_CONFIG"; then
29+
AC_MSG_ERROR([php-config not found])
30+
fi
3031

31-
PHP_MONGODB_PHP_VERSION=`${PHP_CONFIG} --version`
32-
PHP_MONGODB_PHP_VERSION_ID=`${PHP_CONFIG} --vernum`
32+
PHP_MONGODB_PHP_VERSION=`${PHP_CONFIG} --version`
33+
PHP_MONGODB_PHP_VERSION_ID=`${PHP_CONFIG} --vernum`
34+
else
35+
PHP_MONGODB_PHP_VERSION="${PHP_VERSION}"
36+
PHP_MONGODB_PHP_VERSION_ID="${PHP_VERSION_ID}"
37+
fi
3338

3439
AC_MSG_RESULT($PHP_MONGODB_PHP_VERSION)
3540

3641
if test "$PHP_MONGODB_PHP_VERSION_ID" -lt "70400"; then
3742
AC_MSG_ERROR([not supported. Need a PHP version >= 7.4.0 (found $PHP_MONGODB_PHP_VERSION)])
3843
fi
3944

45+
PHP_MONGODB_STD_CFLAGS=""
46+
PHP_MONGODB_DEV_CFLAGS=""
47+
PHP_MONGODB_COVERAGE_CFLAGS=""
48+
4049
PHP_ARG_ENABLE([mongodb-developer-flags],
4150
[whether to enable developer build flags],
4251
[AS_HELP_STRING([--enable-mongodb-developer-flags],
@@ -46,54 +55,53 @@ if test "$PHP_MONGODB" != "no"; then
4655
PHP_MONGODB_VALIDATE_ARG([PHP_MONGODB_DEVELOPER_FLAGS], [yes no])
4756

4857
if test "$PHP_MONGODB_DEVELOPER_FLAGS" = "yes"; then
58+
PHP_MONGODB_STD_CFLAGS="-g -O0 -Wall"
59+
4960
dnl Warn about functions which might be candidates for format attributes
50-
AX_CHECK_COMPILE_FLAG(-Wmissing-format-attribute, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wmissing-format-attribute" ,, -Werror)
61+
AX_CHECK_COMPILE_FLAG(-Wmissing-format-attribute, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wmissing-format-attribute" ,, -Werror)
5162
dnl Avoid duplicating values for an enum
52-
AX_CHECK_COMPILE_FLAG(-Wduplicate-enum, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wduplicate-enum" ,, -Werror)
63+
AX_CHECK_COMPILE_FLAG(-Wduplicate-enum, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wduplicate-enum" ,, -Werror)
5364
dnl Warns on mismatches between #ifndef and #define header guards
54-
AX_CHECK_COMPILE_FLAG(-Wheader-guard, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wheader-guard" ,, -Werror)
65+
AX_CHECK_COMPILE_FLAG(-Wheader-guard, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wheader-guard" ,, -Werror)
5566
dnl logical not of a non-boolean expression
56-
AX_CHECK_COMPILE_FLAG(-Wlogical-not-parentheses, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wlogical-not-parentheses" ,, -Werror)
67+
AX_CHECK_COMPILE_FLAG(-Wlogical-not-parentheses, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wlogical-not-parentheses" ,, -Werror)
5768
dnl Warn about suspicious uses of logical operators in expressions
58-
AX_CHECK_COMPILE_FLAG(-Wlogical-op, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wlogical-op" ,, -Werror)
69+
AX_CHECK_COMPILE_FLAG(-Wlogical-op, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wlogical-op" ,, -Werror)
5970
dnl memory error detector.
6071
dnl FIXME: -fsanitize=address,undefined for clang. The AX_CHECK_COMPILE_FLAG macro isn't happy about that string :(
61-
AX_CHECK_COMPILE_FLAG(-fsanitize-address, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fsanitize-address" ,, -Werror)
72+
AX_CHECK_COMPILE_FLAG(-fsanitize-address, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -fsanitize-address" ,, -Werror)
6273
dnl Enable frame debugging
63-
AX_CHECK_COMPILE_FLAG(-fno-omit-frame-pointer, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fno-omit-frame-pointer" ,, -Werror)
74+
AX_CHECK_COMPILE_FLAG(-fno-omit-frame-pointer, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -fno-omit-frame-pointer" ,, -Werror)
6475
dnl Make sure we don't optimize calls
65-
AX_CHECK_COMPILE_FLAG(-fno-optimize-sibling-calls, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fno-optimize-sibling-calls" ,, -Werror)
66-
AX_CHECK_COMPILE_FLAG(-Wlogical-op-parentheses, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wlogical-op-parentheses" ,, -Werror)
67-
AX_CHECK_COMPILE_FLAG(-Wpointer-bool-conversion, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wpointer-bool-conversion" ,, -Werror)
68-
AX_CHECK_COMPILE_FLAG(-Wbool-conversion, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wbool-conversion" ,, -Werror)
69-
AX_CHECK_COMPILE_FLAG(-Wloop-analysis, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wloop-analysis" ,, -Werror)
70-
AX_CHECK_COMPILE_FLAG(-Wsizeof-array-argument, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wsizeof-array-argument" ,, -Werror)
71-
AX_CHECK_COMPILE_FLAG(-Wstring-conversion, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wstring-conversion" ,, -Werror)
72-
AX_CHECK_COMPILE_FLAG(-Wno-variadic-macros, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-variadic-macros" ,, -Werror)
73-
AX_CHECK_COMPILE_FLAG(-Wno-sign-compare, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-sign-compare" ,, -Werror)
74-
AX_CHECK_COMPILE_FLAG(-fstack-protector, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fstack-protector" ,, -Werror)
75-
AX_CHECK_COMPILE_FLAG(-fno-exceptions, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -fno-exceptions" ,, -Werror)
76-
AX_CHECK_COMPILE_FLAG(-Wformat-security, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wformat-security" ,, -Werror)
77-
AX_CHECK_COMPILE_FLAG(-Wformat-nonliteral, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wformat-nonliteral" ,, -Werror)
78-
AX_CHECK_COMPILE_FLAG(-Winit-self, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Winit-self" ,, -Werror)
79-
AX_CHECK_COMPILE_FLAG(-Wwrite-strings, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wwrite-strings" ,, -Werror)
80-
AX_CHECK_COMPILE_FLAG(-Wenum-compare, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wenum-compare" ,, -Werror)
81-
AX_CHECK_COMPILE_FLAG(-Wempty-body, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wempty-body" ,, -Werror)
82-
AX_CHECK_COMPILE_FLAG(-Wparentheses, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wparentheses" ,, -Werror)
83-
AX_CHECK_COMPILE_FLAG(-Wmaybe-uninitialized, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wmaybe-uninitialized" ,, -Werror)
84-
AX_CHECK_COMPILE_FLAG(-Wimplicit-fallthrough, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wimplicit-fallthrough" ,, -Werror)
85-
AX_CHECK_COMPILE_FLAG(-Werror, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Werror" ,, -Werror)
86-
AX_CHECK_COMPILE_FLAG(-Wextra, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wextra" ,, -Werror)
87-
AX_CHECK_COMPILE_FLAG(-Wno-unused-parameter, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-unused-parameter" ,, -Werror)
88-
AX_CHECK_COMPILE_FLAG(-Wno-unused-but-set-variable, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-unused-but-set-variable" ,, -Werror)
89-
AX_CHECK_COMPILE_FLAG(-Wno-missing-field-initializers, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wno-missing-field-initializers",, -Werror)
76+
AX_CHECK_COMPILE_FLAG(-fno-optimize-sibling-calls, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -fno-optimize-sibling-calls" ,, -Werror)
77+
AX_CHECK_COMPILE_FLAG(-Wlogical-op-parentheses, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wlogical-op-parentheses" ,, -Werror)
78+
AX_CHECK_COMPILE_FLAG(-Wpointer-bool-conversion, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wpointer-bool-conversion" ,, -Werror)
79+
AX_CHECK_COMPILE_FLAG(-Wbool-conversion, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wbool-conversion" ,, -Werror)
80+
AX_CHECK_COMPILE_FLAG(-Wloop-analysis, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wloop-analysis" ,, -Werror)
81+
AX_CHECK_COMPILE_FLAG(-Wsizeof-array-argument, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wsizeof-array-argument" ,, -Werror)
82+
AX_CHECK_COMPILE_FLAG(-Wstring-conversion, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wstring-conversion" ,, -Werror)
83+
AX_CHECK_COMPILE_FLAG(-Wno-variadic-macros, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wno-variadic-macros" ,, -Werror)
84+
AX_CHECK_COMPILE_FLAG(-Wno-sign-compare, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wno-sign-compare" ,, -Werror)
85+
AX_CHECK_COMPILE_FLAG(-fstack-protector, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -fstack-protector" ,, -Werror)
86+
AX_CHECK_COMPILE_FLAG(-fno-exceptions, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -fno-exceptions" ,, -Werror)
87+
AX_CHECK_COMPILE_FLAG(-Wformat-security, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wformat-security" ,, -Werror)
88+
AX_CHECK_COMPILE_FLAG(-Wformat-nonliteral, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wformat-nonliteral" ,, -Werror)
89+
AX_CHECK_COMPILE_FLAG(-Winit-self, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Winit-self" ,, -Werror)
90+
AX_CHECK_COMPILE_FLAG(-Wwrite-strings, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wwrite-strings" ,, -Werror)
91+
AX_CHECK_COMPILE_FLAG(-Wenum-compare, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wenum-compare" ,, -Werror)
92+
AX_CHECK_COMPILE_FLAG(-Wempty-body, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wempty-body" ,, -Werror)
93+
AX_CHECK_COMPILE_FLAG(-Wparentheses, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wparentheses" ,, -Werror)
94+
AX_CHECK_COMPILE_FLAG(-Wmaybe-uninitialized, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wmaybe-uninitialized" ,, -Werror)
95+
AX_CHECK_COMPILE_FLAG(-Wimplicit-fallthrough, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wimplicit-fallthrough" ,, -Werror)
96+
AX_CHECK_COMPILE_FLAG(-Werror, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Werror" ,, -Werror)
97+
AX_CHECK_COMPILE_FLAG(-Wextra, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wextra" ,, -Werror)
98+
AX_CHECK_COMPILE_FLAG(-Wno-unused-parameter, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wno-unused-parameter" ,, -Werror)
99+
AX_CHECK_COMPILE_FLAG(-Wno-unused-but-set-variable, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wno-unused-but-set-variable" ,, -Werror)
100+
AX_CHECK_COMPILE_FLAG(-Wno-missing-field-initializers, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wno-missing-field-initializers",, -Werror)
90101

91102
if test "$PHP_MONGODB_PHP_VERSION_ID" -ge "80108"; then
92-
AX_CHECK_COMPILE_FLAG(-Wstrict-prototypes, _MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS -Wstrict-prototypes",, -Werror)
103+
AX_CHECK_COMPILE_FLAG(-Wstrict-prototypes, PHP_MONGODB_DEV_CFLAGS="$PHP_MONGODB_DEV_CFLAGS -Wstrict-prototypes",, -Werror)
93104
fi
94-
95-
MAINTAINER_CFLAGS="$_MAINTAINER_CFLAGS"
96-
STD_CFLAGS="-g -O0 -Wall"
97105
fi
98106

99107

@@ -110,13 +118,11 @@ if test "$PHP_MONGODB" != "no"; then
110118
AC_MSG_ERROR(code coverage is not supported for static builds)
111119
fi
112120

113-
COVERAGE_CFLAGS="--coverage -g"
114-
COVERAGE_LDFLAGS="--coverage"
115-
116-
MONGODB_SHARED_LIBADD="$MONGODB_SHARED_LIBADD $COVERAGE_LDFLAGS"
121+
PHP_MONGODB_COVERAGE_CFLAGS="--coverage -g"
122+
MONGODB_SHARED_LIBADD="$MONGODB_SHARED_LIBADD --coverage"
117123
fi
118124

119-
PHP_MONGODB_CFLAGS="$STD_CFLAGS $MAINTAINER_CFLAGS $COVERAGE_CFLAGS"
125+
PHP_MONGODB_CFLAGS="$PHP_MONGODB_STD_CFLAGS $PHP_MONGODB_DEV_CFLAGS $PHP_MONGODB_COVERAGE_CFLAGS"
120126

121127
PHP_MONGODB_SOURCES="\
122128
php_phongo.c \
@@ -307,7 +313,7 @@ if test "$PHP_MONGODB" != "no"; then
307313
fi
308314

309315
if test "$PHP_MONGODB_SYSTEM_LIBS" = "no"; then
310-
PHP_MONGODB_BUNDLED_CFLAGS="$STD_CFLAGS -DBSON_COMPILATION -DMONGOC_COMPILATION"
316+
PHP_MONGODB_BUNDLED_CFLAGS="$PHP_MONGODB_STD_CFLAGS -DBSON_COMPILATION -DMONGOC_COMPILATION"
311317

312318
dnl CheckUtf8Proc.m4 will modify this when using bundled utf8proc
313319
PHP_MONGODB_UTF8PROC_CFLAGS=""
@@ -318,6 +324,9 @@ if test "$PHP_MONGODB" != "no"; then
318324
dnl Endian.m4 will modify this when using bundled libmongocrypt
319325
PHP_MONGODB_LIBMONGOCRYPT_CFLAGS=""
320326

327+
dnl Save CPPFLAGS, which PlatformFlags.m4 modifies for subsequent M4 scripts
328+
old_CPPFLAGS="$CPPFLAGS"
329+
321330
dnl Avoid using AC_CONFIG_MACRO_DIR, which might conflict with PHP
322331
m4_include(PHP_MONGODB_BASEDIR/scripts/autotools/m4/ax_check_compile_flag.m4)
323332
m4_include(PHP_MONGODB_BASEDIR/scripts/autotools/m4/ax_prototype.m4)
@@ -350,6 +359,9 @@ if test "$PHP_MONGODB" != "no"; then
350359
m4_include(PHP_MONGODB_BASEDIR/scripts/autotools/libmongocrypt/Endian.m4)
351360
m4_include(PHP_MONGODB_BASEDIR/scripts/autotools/libmongocrypt/Version.m4)
352361

362+
dnl Restore CPPFLAGS once all M4 scripts have executed
363+
CPPFLAGS="$old_CPPFLAGS"
364+
353365
PHP_MONGODB_BSON_VERSION_STRING="Bundled ($libbson_VERSION_FULL)"
354366
PHP_MONGODB_MONGOC_VERSION_STRING="Bundled ($libmongoc_VERSION_FULL)"
355367
PHP_MONGODB_MONGOCRYPT_VERSION_STRING="Bundled ($MONGOCRYPT_BUILD_VERSION)"
@@ -509,7 +521,6 @@ if test "$PHP_MONGODB" != "no"; then
509521
dnl This must come after PHP_NEW_EXTENSION, otherwise the srcdir won't be set
510522
PHP_ADD_MAKEFILE_FRAGMENT
511523

512-
dnl The libmongocrypt line intentionally uses the PHP_LIBBSON flag as that decides whether to build against bundled or system libraries.
513524
AC_CONFIG_COMMANDS_POST([
514525
if test "$enable_static" = "no"; then
515526
echo "
@@ -518,9 +529,10 @@ mongodb was configured with the following options:
518529
Build configuration:
519530
CC : $CC
520531
CFLAGS : $CFLAGS
521-
Extra CFLAGS : $STD_CFLAGS $EXTRA_CFLAGS
522-
Developers flags (slow) : $MAINTAINER_CFLAGS
523-
Code Coverage flags (extra slow) : $COVERAGE_CFLAGS
532+
CPPFLAGS : $CPPFLAGS
533+
Extra flags : $PHP_MONGODB_STD_CFLAGS
534+
Developer flags (slow) : $PHP_MONGODB_DEV_CFLAGS
535+
Code Coverage flags (extra slow) : $PHP_MONGODB_COVERAGE_CFLAGS
524536
libmongoc : $PHP_MONGODB_BSON_VERSION_STRING
525537
libbson : $PHP_MONGODB_MONGOC_VERSION_STRING
526538
libmongocrypt : $PHP_MONGODB_MONGOCRYPT_VERSION_STRING

scripts/autotools/CheckCompiler.m4

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dnl so call it once more to ensure C99 remains enabled
1616
m4_version_prereq([2.70],,[AC_PROG_CC_C99])
1717

1818
# Check that an appropriate C compiler is available.
19+
# Note: BEGIN_IGNORE_DEPRECATIONS macro requires GCC 4.6+.
1920
c_compiler="unknown"
2021
AC_LANG_PUSH([C])
2122
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
@@ -26,26 +27,12 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
2627
#define GCC_VERSION (__GNUC__ * 10000 \
2728
+ __GNUC_MINOR__ * 100 \
2829
+ __GNUC_PATCHLEVEL__)
29-
#if GCC_VERSION < 40100
30+
#if GCC_VERSION < 40600
3031
#error Not a supported GCC compiler
3132
#endif
3233
#endif
3334
])], [c_compiler="gcc"], [])
3435

35-
# If our BEGIN_IGNORE_DEPRECATIONS macro won't work, pass
36-
# -Wno-deprecated-declarations
37-
38-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
39-
#if !defined(__clang__) && defined(__GNUC__)
40-
#define GCC_VERSION (__GNUC__ * 10000 \
41-
+ __GNUC_MINOR__ * 100 \
42-
+ __GNUC_PATCHLEVEL__)
43-
#if GCC_VERSION < 40600
44-
#error Does not support deprecation warning pragmas
45-
#endif
46-
#endif
47-
])], [], [STD_CFLAGS="$STD_CFLAGS -Wno-deprecated-declarations"])
48-
4936
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
5037
#if defined(__clang__)
5138
#define CLANG_VERSION (__clang_major__ * 10000 \
@@ -65,7 +52,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
6552
AC_LANG_POP([C])
6653

6754
if test "$c_compiler" = "unknown"; then
68-
AC_MSG_ERROR([Compiler GCC >= 4.1 or Clang >= 3.3 is required for C compilation])
55+
AC_MSG_ERROR([Compiler GCC >= 4.6 or Clang >= 3.3 is required for C compilation])
6956
fi
7057

7158
AC_C_CONST

scripts/autotools/PlatformFlags.m4

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,4 @@ AS_IF([test "$os_darwin" = "yes"],[
1818
dnl https://opensource.apple.com/source/Libc/Libc-1439.40.11/gen/compat.5.auto.html
1919
CPPFLAGS="$CPPFLAGS -D_DARWIN_C_SOURCE"
2020
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"])
2921
])

src/libmongocrypt-compat/mongocrypt/mongocrypt.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
/* This header forwards includes for "mongocrypt/mongocrypt.h" to the desired
2121
* header in the bundled libmongocrypt submodule. This is used when compiling
2222
* bundled versions of libmongoc and libmongocrypt and is necessary because
23-
* libmongocrypt's source directory is not named "mongocrypt/".
24-
*
25-
* This path is relative to the PHPC project directory to avoid ambiguity. */
26-
#include "src/libmongocrypt/src/mongocrypt.h"
23+
* libmongocrypt's source directory is not named "mongocrypt/". */
24+
#include "libmongocrypt/src/mongocrypt.h"
2725

2826
#endif /* PHONGO_COMPAT_MONGOCRYPT_H */

0 commit comments

Comments
 (0)