Skip to content

Commit 8942485

Browse files
Merge pull request NoiseByNorthwest#328 from NoiseByNorthwest/fix_326
Switch to c11
2 parents c6b00ed + e7973c2 commit 8942485

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

config.m4

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,16 @@ if test "$PHP_SPX" = "yes"; then
1919
AC_DEFINE_UNQUOTED([SPX_HTTP_UI_ASSETS_DIR], [ "$PHP_SPX_ASSETS_DIR/web-ui" ], [path of web-ui assets directory])
2020
PHP_SUBST([PHP_SPX_ASSETS_DIR])
2121

22-
CFLAGS="$CFLAGS -Werror -Wall -Wno-attributes -O3 -pthread -std=gnu90"
22+
CFLAGS="$CFLAGS -Werror -Wall -Wno-attributes -O3 -pthread"
23+
24+
php_ver_num=$(echo $PHP_VERSION | awk -F. '{printf("%d%02d%02d",$1,$2,$3)}')
25+
if test "$php_ver_num" -ge 80200; then
26+
CFLAGS="$CFLAGS -std=c11"
27+
AC_MSG_NOTICE([Adding -std=c11 because PHP >= 8.2])
28+
else
29+
CFLAGS="$CFLAGS -std=gnu90"
30+
AC_MSG_NOTICE([Adding -std=gnu90 because PHP < 8.2])
31+
fi
2332

2433
# Disabling typedef-redefinition is required for:
2534
# - macOS, see https://github.com/NoiseByNorthwest/php-spx/pull/270

src/php_spx.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "main/php.h"
2424

2525
/* linux 2.6+ or OSX */
26-
#if !defined(linux) && !(defined(__APPLE__) && defined(__MACH__)) && !defined(__FreeBSD__)
26+
#if !defined(__linux__) && !(defined(__APPLE__) && defined(__MACH__)) && !defined(__FreeBSD__)
2727
# error "Only Linux-based OSes, Apple MacOS and FreeBSD are supported"
2828
#endif
2929

src/spx_resource_stats.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818

19-
#if defined(linux)
19+
#if defined(__linux__)
2020
# include "spx_resource_stats-linux.c"
2121
#elif defined(__APPLE__) && defined(__MACH__)
2222
# include "spx_resource_stats-macos.c"

0 commit comments

Comments
 (0)