Skip to content

Commit 39b48f8

Browse files
authored
Add -Wno-type-limits and -Wno-logical-op only on 32-bit (#14271)
For ext/sodium these two flags can be added conditionally only for the 32-bit target architecture.
1 parent b7dd3d8 commit 39b48f8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ext/sodium/config.m4

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,16 @@ if test "$PHP_SODIUM" != "no"; then
1111

1212
AC_DEFINE(HAVE_LIBSODIUMLIB, 1, [ ])
1313

14+
SODIUM_COMPILER_FLAGS="$LIBSODIUM_CFLAGS"
15+
1416
dnl Add -Wno-type-limits and -Wno-logical-op as this may arise on 32bits platforms
15-
SODIUM_COMPILER_FLAGS="$LIBSODIUM_CFLAGS -Wno-type-limits"
16-
AX_CHECK_COMPILE_FLAG([-Wno-logical-op], SODIUM_COMPILER_FLAGS="$SODIUM_COMPILER_FLAGS -Wno-logical-op", , [-Werror])
17+
AC_CHECK_SIZEOF([long])
18+
AS_IF([test "$ac_cv_sizeof_long" -eq 4], [
19+
SODIUM_COMPILER_FLAGS="$SODIUM_COMPILER_FLAGS -Wno-type-limits"
20+
AX_CHECK_COMPILE_FLAG([-Wno-logical-op],
21+
[SODIUM_COMPILER_FLAGS="$SODIUM_COMPILER_FLAGS -Wno-logical-op"],, [-Werror])
22+
])
23+
1724
PHP_NEW_EXTENSION(sodium, libsodium.c sodium_pwhash.c, $ext_shared, , $SODIUM_COMPILER_FLAGS)
1825
PHP_INSTALL_HEADERS([ext/sodium], [php_libsodium.h])
1926
PHP_SUBST(SODIUM_SHARED_LIBADD)

0 commit comments

Comments
 (0)