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

View File

@ -1,3 +1,8 @@
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.
2006-12-13 Thomas Schwinge <tschwinge@gnu.org>
* Makefile.in (enable_grub_emu): New variable.

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]
])

View File

@ -148,6 +148,19 @@ fi
# Check for functions.
AC_CHECK_FUNCS(posix_memalign memalign)
#
# Compiler features.
#
# Smashing stack protector.
grub_CHECK_STACK_PROTECTOR
[# Need that, because some distributions ship compilers that include
# `-fstack-protector' in the default specs.
if [ x"$ssp_possible" = xyes ]; then
CFLAGS=$CFLAGS\ -fno-stack-protector
fi]
#
# Check for target programs.
#
@ -225,6 +238,18 @@ if test "x$target_m32" = x1; then
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
fi
#
# Compiler features.
#
# Smashing stack protector.
grub_CHECK_STACK_PROTECTOR
[# Need that, because some distributions ship compilers that include
# `-fstack-protector' in the default specs.
if [ x"$ssp_possible" = xyes ]; then
TARGET_CFLAGS=$TARGET_CFLAGS\ -fno-stack-protector
fi]
AC_SUBST(TARGET_CFLAGS)
AC_SUBST(TARGET_CPPFLAGS)
AC_SUBST(TARGET_LDFLAGS)