1*49cdfc7eSAndroid Build Coastguard Workerdnl SPDX-License-Identifier: GPL-2.0-or-later 2*49cdfc7eSAndroid Build Coastguard Workerdnl Copyright (c) 2013 Cyril Hrubis <[email protected]> 3*49cdfc7eSAndroid Build Coastguard Worker 4*49cdfc7eSAndroid Build Coastguard WorkerAC_DEFUN([LTP_CHECK_FORTIFY_SOURCE],[ 5*49cdfc7eSAndroid Build Coastguard Worker AC_MSG_CHECKING(whether to define _FORTIFY_SOURCE=2) 6*49cdfc7eSAndroid Build Coastguard Worker AC_COMPILE_IFELSE([AC_LANG_SOURCE([ 7*49cdfc7eSAndroid Build Coastguard Worker#include <stdio.h> 8*49cdfc7eSAndroid Build Coastguard Worker 9*49cdfc7eSAndroid Build Coastguard Workerint main(void) 10*49cdfc7eSAndroid Build Coastguard Worker{ 11*49cdfc7eSAndroid Build Coastguard Worker#if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ 12*49cdfc7eSAndroid Build Coastguard Worker return 0; 13*49cdfc7eSAndroid Build Coastguard Worker#else 14*49cdfc7eSAndroid Build Coastguard Worker# error Compiling without optimalizations 15*49cdfc7eSAndroid Build Coastguard Worker#endif 16*49cdfc7eSAndroid Build Coastguard Worker} 17*49cdfc7eSAndroid Build Coastguard Worker])],[CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2" 18*49cdfc7eSAndroid Build Coastguard WorkerAC_MSG_RESULT(yes)], 19*49cdfc7eSAndroid Build Coastguard Worker[AC_MSG_RESULT(no)]) 20*49cdfc7eSAndroid Build Coastguard Worker]) 21