From: Remi Gacogne Date: Thu, 5 Jan 2023 14:52:10 +0000 (+0100) Subject: Enable FORTIFY_SOURCE=3 when supported by the compiler X-Git-Tag: dnsdist-1.8.0-rc1~110^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b69ef907a56a23fdeee9ab66931dbde45b54cb3;p=thirdparty%2Fpdns.git Enable FORTIFY_SOURCE=3 when supported by the compiler Barely tested, we should at least measure the performance impact and ponder making that optional. --- diff --git a/m4/pdns_d_fortify_source.m4 b/m4/pdns_d_fortify_source.m4 index 68e9be5ef5..4a3322519f 100644 --- a/m4/pdns_d_fortify_source.m4 +++ b/m4/pdns_d_fortify_source.m4 @@ -21,8 +21,14 @@ dnl AC_DEFUN([AC_CC_D_FORTIFY_SOURCE],[ OLD_CXXFLAGS="$CXXFLAGS" CXXFLAGS="-Wall -W -Werror $CXXFLAGS" - gl_COMPILER_OPTION_IF([-D_FORTIFY_SOURCE=2], [ - CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" - CXXFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $OLD_CXXFLAGS" - ], [CXXFLAGS="$OLD_CXXFLAGS"], [AC_LANG_PROGRAM([[#include ]],[])]) -]) + gl_COMPILER_OPTION_IF([-D_FORTIFY_SOURCE=3], [ + CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $CFLAGS" + CXXFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 $OLD_CXXFLAGS" + ], [ + gl_COMPILER_OPTION_IF([-D_FORTIFY_SOURCE=2], [ + CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $CFLAGS" + CXXFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $OLD_CXXFLAGS" + ], [CXXFLAGS="$OLD_CXXFLAGS"], [AC_LANG_PROGRAM([[#include ]],[])]) + ] + , [AC_LANG_PROGRAM([[#include ]],[])]) +])