2007-02-03 Thomas Schwinge <tschwinge@gnu.org>

* aclocal.m4 (grub_CHECK_STACK_PROTECTOR): New definition.
	* configure.ac: Use it for testing the HOST and TARGET compilers.
This commit is contained in:
tschwinge 2007-02-03 11:36:13 +00:00
parent fd3e4ea524
commit baa2a121e0
3 changed files with 49 additions and 0 deletions

19
aclocal.m4 vendored
View file

@ -343,3 +343,22 @@ dnl So use regparm 2 until a better test is found.
[Catch gcc bug])
fi
])
dnl Check if the C compiler supports `-fstack-protector'.
AC_DEFUN(grub_CHECK_STACK_PROTECTOR,[
[# Smashing stack protector.
ssp_possible=yes]
AC_MSG_CHECKING([whether `$CC' accepts `-fstack-protector'])
# Is this a reliable test case?
AC_LANG_CONFTEST([[void foo (void) { volatile char a[8]; a[3]; }]])
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
# `ac_compile' like this correct, after all?
if eval "$ac_compile -S -fstack-protector -o conftest.s" 2> /dev/null; then]
AC_MSG_RESULT([yes])
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
rm -f conftest.s
else
ssp_possible=no]
AC_MSG_RESULT([no])
[fi]
])