Skip to content

Commit 056bfa7

Browse files
committed
pythongh-131093: Enforce -std=c11 for gcc at configure time rather than make time
When compiling under gcc, configure.ac currently assumes -std=c11 rather than checking it. This causes configure to succeed but make to fail on old compilers. Fix this by adding a check for -std=c11 in configure.ac.
1 parent 00f0771 commit 056bfa7

File tree

4 files changed

+54
-2
lines changed

4 files changed

+54
-2
lines changed

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,6 +2028,7 @@ Cliff Wells
20282028
Rickard Westman
20292029
Joseph Weston
20302030
Jeff Wheeler
2031+
Chris White
20312032
Christopher White
20322033
David White
20332034
Mats Wichmann
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
On GCC-compatible compilers, check at configure time that ``--std=c11``
2+
works. This way you don't hit an "invalid option" error at make time on old
3+
compilers.

configure

Lines changed: 45 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2491,7 +2491,11 @@ then
24912491
fi
24922492

24932493
AS_VAR_IF([ac_cv_gcc_compat], [yes], [
2494-
CFLAGS_NODIST="$CFLAGS_NODIST -std=c11"
2494+
AX_CHECK_COMPILE_FLAG([-std=c11],[
2495+
AS_VAR_APPEND([CFLAGS_NODIST], [" -std=c11"])
2496+
], [
2497+
AC_MSG_ERROR([Python requires -std=c11 on gcc])
2498+
], [-Werror])
24952499
24962500
PY_CHECK_CC_WARNING([enable], [extra], [if we can add -Wextra])
24972501
AS_VAR_IF([ac_cv_enable_extra_warning], [yes],

0 commit comments

Comments
 (0)