From fe1cf97ee811dc7a2bb7cea912c9292c976ab5af Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Sun, 9 Mar 2008 22:50:50 +1100 Subject: - (dtucker) [configure.ac] Run stack-protector tests with -Werror to catch platforms where gcc understands the option but it's not supported (and thus generates a warning). --- configure.ac | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index b71f6832a..b6fa19bd0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.394 2008/03/09 00:34:23 dtucker Exp $ +# $Id: configure.ac,v 1.395 2008/03/09 11:50:50 dtucker Exp $ # # Copyright (c) 1999-2004 Damien Miller # @@ -15,7 +15,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) -AC_REVISION($Revision: 1.394 $) +AC_REVISION($Revision: 1.395 $) AC_CONFIG_SRCDIR([ssh.c]) AC_CONFIG_HEADER(config.h) @@ -113,16 +113,23 @@ if test "$GCC" = "yes" || test "$GCC" = "egcs"; then esac # -fstack-protector-all doesn't always work for some GCC versions - # and/or platforms, so we test if we can. + # and/or platforms, so we test if we can. If it's not supported + # on a give platform gcc will emit a warning so we use -Werror. if test "x$use_stack_protector" = "x1"; then for t in -fstack-protector-all -fstack-protector; do - AC_MSG_CHECKING(if $CC understands $t) + AC_MSG_CHECKING(if $CC supports $t) saved_CFLAGS="$CFLAGS" saved_LDFLAGS="$LDFLAGS" - CFLAGS="$CFLAGS $t" - LDFLAGS="$LDFLAGS $t" - AC_TRY_LINK([], [ int main(void){return 0;} ], + CFLAGS="$CFLAGS $t -Werror" + LDFLAGS="$LDFLAGS $t -Werror" + AC_LINK_IFELSE( + [AC_LANG_SOURCE([ +#include +int main(void){return 0;} + ])], [ AC_MSG_RESULT(yes) + CFLAGS="$saved_CFLAGS $t" + LDFLAGS="$saved_LDFLAGS $t" AC_MSG_CHECKING(if $t works) AC_RUN_IFELSE( [AC_LANG_SOURCE([ @@ -134,7 +141,7 @@ int main(void){exit(0);} [ AC_MSG_RESULT(no) ], [ AC_MSG_WARN([cross compiling: cannot test]) break ] - ) + ) ], [ AC_MSG_RESULT(no) ] ) -- cgit v1.2.3