Skip to content

Commit f64c624

Browse files
authored
Autotools: Update ax_check_compile_flag.m4 to serial 11 (#19127)
```sh wget -O build/ax_check_compile_flag.m4 \ https://cgit.git.savannah.gnu.org/cgit/autoconf-archive.git/plain/m4/ax_check_compile_flag.m4 ``` New version of AX_CHECK_COMPILE_FLAG macro now adds the -Werror flag automatically, if GNU-compatible compiler is detected.
1 parent 7bf79ab commit f64c624

File tree

7 files changed

+25
-26
lines changed

7 files changed

+25
-26
lines changed

UPGRADING.INTERNALS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ PHP 8.5 INTERNALS UPGRADE NOTES
101101
. PHP_ODBC_CFLAGS, PHP_ODBC_LFLAGS, PHP_ODBC_LIBS, PHP_ODBC_TYPE preprocessor
102102
macros defined by ext/odbc are now defined in php_config.h instead of the
103103
build-defs.h header.
104+
. Autoconf macro AX_CHECK_COMPILE_FLAG updated to serial 11.
104105
. Autoconf macro PHP_AP_EXTRACT_VERSION has been removed.
105106
. Autoconf macro PHP_BUILD_THREAD_SAFE has been removed (set enable_zts
106107
manually).

Zend/Zend.m4

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -193,28 +193,21 @@ AS_VAR_IF([GCC], [yes],
193193
194194
dnl Check if compiler supports -Wno-clobbered (only GCC).
195195
AX_CHECK_COMPILE_FLAG([-Wno-clobbered],
196-
[CFLAGS="-Wno-clobbered $CFLAGS"],,
197-
[-Werror])
196+
[CFLAGS="-Wno-clobbered $CFLAGS"])
198197
dnl Check for support for implicit fallthrough level 1, also add after previous
199198
dnl CFLAGS as level 3 is enabled in -Wextra.
200199
AX_CHECK_COMPILE_FLAG([-Wimplicit-fallthrough=1],
201-
[CFLAGS="$CFLAGS -Wimplicit-fallthrough=1"],,
202-
[-Werror])
200+
[CFLAGS="$CFLAGS -Wimplicit-fallthrough=1"])
203201
AX_CHECK_COMPILE_FLAG([-Wduplicated-cond],
204-
[CFLAGS="-Wduplicated-cond $CFLAGS"],,
205-
[-Werror])
202+
[CFLAGS="-Wduplicated-cond $CFLAGS"])
206203
AX_CHECK_COMPILE_FLAG([-Wlogical-op],
207-
[CFLAGS="-Wlogical-op $CFLAGS"],,
208-
[-Werror])
204+
[CFLAGS="-Wlogical-op $CFLAGS"])
209205
AX_CHECK_COMPILE_FLAG([-Wformat-truncation],
210-
[CFLAGS="-Wformat-truncation $CFLAGS"],,
211-
[-Werror])
206+
[CFLAGS="-Wformat-truncation $CFLAGS"])
212207
AX_CHECK_COMPILE_FLAG([-Wstrict-prototypes],
213-
[CFLAGS="-Wstrict-prototypes $CFLAGS"],,
214-
[-Werror])
208+
[CFLAGS="-Wstrict-prototypes $CFLAGS"])
215209
AX_CHECK_COMPILE_FLAG([-fno-common],
216-
[CFLAGS="-fno-common $CFLAGS"],,
217-
[-Werror])
210+
[CFLAGS="-fno-common $CFLAGS"])
218211
219212
ZEND_CHECK_ALIGNMENT
220213
ZEND_CHECK_SIGNALS

build/ax_check_compile_flag.m4

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,24 @@
3434
# and this notice are preserved. This file is offered as-is, without any
3535
# warranty.
3636

37-
#serial 7
37+
#serial 11
3838

3939
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
4040
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
4141
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
4242
AC_CACHE_CHECK([whether the _AC_LANG compiler accepts $1], CACHEVAR, [
4343
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
44-
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
44+
if test x"m4_case(_AC_LANG,
45+
[C], [$GCC],
46+
[C++], [$GXX],
47+
[Fortran], [$GFC],
48+
[Fortran 77], [$G77],
49+
[Objective C], [$GOBJC],
50+
[Objective C++], [$GOBJCXX],
51+
[no])" = xyes ; then
52+
add_gnu_werror="-Werror"
53+
fi
54+
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1 $add_gnu_werror"
4555
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
4656
[AS_VAR_SET(CACHEVAR,[yes])],
4757
[AS_VAR_SET(CACHEVAR,[no])])

ext/date/config0.m4

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,14 @@ dnl Check for strtoll, atoll
55
AC_CHECK_FUNCS([strtoll atoll])
66

77
AX_CHECK_COMPILE_FLAG([-Wno-implicit-fallthrough],
8-
[PHP_DATE_CFLAGS="$PHP_DATE_CFLAGS -Wno-implicit-fallthrough"],,
9-
[-Werror])
8+
[PHP_DATE_CFLAGS="$PHP_DATE_CFLAGS -Wno-implicit-fallthrough"])
109

1110
PHP_DATE_CFLAGS="$PHP_DATE_CFLAGS -DHAVE_TIMELIB_CONFIG_H=1"
1211
PHP_TIMELIB_CFLAGS="$PHP_DATE_CFLAGS"
1312
PHP_DATE_CFLAGS="$PHP_DATE_CFLAGS -I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
1413

1514
AX_CHECK_COMPILE_FLAG([-fwrapv],
16-
[PHP_TIMELIB_CFLAGS="$PHP_TIMELIB_CFLAGS -fwrapv"],,
17-
[-Werror])
15+
[PHP_TIMELIB_CFLAGS="$PHP_TIMELIB_CFLAGS -fwrapv"])
1816

1917
timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.c lib/parse_posix.c
2018
lib/timelib.c lib/tm2unixtime.c lib/unixtime2tm.c lib/parse_iso_intervals.c lib/interval.c"

ext/hash/config.m4

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ AS_VAR_IF([ac_cv_c_bigendian_php], [yes], [
2323
SHA3_OPT_SRC="$SHA3_DIR/KeccakP-1600-inplace32BI.c"
2424
dnl Add -Wno-implicit-fallthrough flag as it happens on 32 bit builds
2525
AX_CHECK_COMPILE_FLAG([-Wno-implicit-fallthrough],
26-
[PHP_HASH_CFLAGS="$PHP_HASH_CFLAGS -Wno-implicit-fallthrough"],,
27-
[-Werror])
26+
[PHP_HASH_CFLAGS="$PHP_HASH_CFLAGS -Wno-implicit-fallthrough"])
2827
],[
2928
AC_MSG_RESULT([yes])
3029
SHA3_DIR="sha3/generic64lc"

ext/pcre/config0.m4

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ else
9696
"])
9797

9898
AX_CHECK_COMPILE_FLAG([-Wno-implicit-fallthrough],
99-
[PHP_PCRE_CFLAGS="$PHP_PCRE_CFLAGS -Wno-implicit-fallthrough"],,
100-
[-Werror])
99+
[PHP_PCRE_CFLAGS="$PHP_PCRE_CFLAGS -Wno-implicit-fallthrough"])
101100

102101
PHP_PCRE_CFLAGS=m4_normalize(["
103102
$PHP_PCRE_CFLAGS

ext/sodium/config.m4

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ if test "$PHP_SODIUM" != "no"; then
1919
AS_IF([test "$ac_cv_sizeof_long" -eq 4], [
2020
SODIUM_COMPILER_FLAGS="$SODIUM_COMPILER_FLAGS -Wno-type-limits"
2121
AX_CHECK_COMPILE_FLAG([-Wno-logical-op],
22-
[SODIUM_COMPILER_FLAGS="$SODIUM_COMPILER_FLAGS -Wno-logical-op"],,
23-
[-Werror])
22+
[SODIUM_COMPILER_FLAGS="$SODIUM_COMPILER_FLAGS -Wno-logical-op"])
2423
])
2524

2625
PHP_NEW_EXTENSION([sodium],

0 commit comments

Comments
 (0)