summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorNate Ohlson <nateohlson@gmail.com>2024-07-18 16:06:51 (GMT)
committerGitHub <noreply@github.com>2024-07-18 16:06:51 (GMT)
commitbdab67e1c795443a0d8f8a5bbeb3a91ac4fd5a19 (patch)
tree44f516dbb1e7cd155188b7b71d747f197bb7febc /configure
parent94e6644584d9cb08a4edcd1027e288386184816b (diff)
downloadcpython-bdab67e1c795443a0d8f8a5bbeb3a91ac4fd5a19.zip
cpython-bdab67e1c795443a0d8f8a5bbeb3a91ac4fd5a19.tar.gz
cpython-bdab67e1c795443a0d8f8a5bbeb3a91ac4fd5a19.tar.bz2
gh-112301: Add fortify source level 3 to default compiler options (gh-121520)
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure39
1 files changed, 39 insertions, 0 deletions
diff --git a/configure b/configure
index 73d3bda..36f4bf7 100755
--- a/configure
+++ b/configure
@@ -9691,6 +9691,45 @@ else $as_nop
printf "%s\n" "$as_me: WARNING: -Wtrampolines not supported" >&2;}
fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -D_FORTIFY_SOURCE=3" >&5
+printf %s "checking whether C compiler accepts -D_FORTIFY_SOURCE=3... " >&6; }
+if test ${ax_cv_check_cflags___D_FORTIFY_SOURCE_3+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+
+ ax_check_save_flags=$CFLAGS
+ CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=3"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main (void)
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"
+then :
+ ax_cv_check_cflags___D_FORTIFY_SOURCE_3=yes
+else $as_nop
+ ax_cv_check_cflags___D_FORTIFY_SOURCE_3=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
+ CFLAGS=$ax_check_save_flags
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___D_FORTIFY_SOURCE_3" >&5
+printf "%s\n" "$ax_cv_check_cflags___D_FORTIFY_SOURCE_3" >&6; }
+if test "x$ax_cv_check_cflags___D_FORTIFY_SOURCE_3" = xyes
+then :
+ BASECFLAGS="$BASECFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3"
+else $as_nop
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: -D_FORTIFY_SOURCE=3 not supported" >&5
+printf "%s\n" "$as_me: WARNING: -D_FORTIFY_SOURCE=3 not supported" >&2;}
+fi
+
case $GCC in
yes)