- (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).
This commit is contained in:
Darren Tucker 2008-03-09 22:50:50 +11:00
parent 7643e3397d
commit fe1cf97ee8
2 changed files with 19 additions and 9 deletions

View File

@ -8,6 +8,9 @@
- (dtucker) [openbsd-compat/regress/strtonumtest.c] Bug #1347: Use platform's - (dtucker) [openbsd-compat/regress/strtonumtest.c] Bug #1347: Use platform's
equivalent of LLONG_MAX for the compat regression tests, which makes them equivalent of LLONG_MAX for the compat regression tests, which makes them
run on AIX and HP-UX. Patch from David Leonard. run on AIX and HP-UX. Patch from David Leonard.
- (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).
20080307 20080307
- (djm) OpenBSD CVS Sync - (djm) OpenBSD CVS Sync
@ -3709,4 +3712,4 @@
OpenServer 6 and add osr5bigcrypt support so when someone migrates OpenServer 6 and add osr5bigcrypt support so when someone migrates
passwords between UnixWare and OpenServer they will still work. OK dtucker@ passwords between UnixWare and OpenServer they will still work. OK dtucker@
$Id: ChangeLog,v 1.4863 2008/03/09 06:10:09 dtucker Exp $ $Id: ChangeLog,v 1.4864 2008/03/09 11:50:50 dtucker Exp $

View File

@ -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 # Copyright (c) 1999-2004 Damien Miller
# #
@ -15,7 +15,7 @@
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) 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_SRCDIR([ssh.c])
AC_CONFIG_HEADER(config.h) AC_CONFIG_HEADER(config.h)
@ -113,16 +113,23 @@ if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
esac esac
# -fstack-protector-all doesn't always work for some GCC versions # -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 if test "x$use_stack_protector" = "x1"; then
for t in -fstack-protector-all -fstack-protector; do 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_CFLAGS="$CFLAGS"
saved_LDFLAGS="$LDFLAGS" saved_LDFLAGS="$LDFLAGS"
CFLAGS="$CFLAGS $t" CFLAGS="$CFLAGS $t -Werror"
LDFLAGS="$LDFLAGS $t" LDFLAGS="$LDFLAGS $t -Werror"
AC_TRY_LINK([], [ int main(void){return 0;} ], AC_LINK_IFELSE(
[AC_LANG_SOURCE([
#include <stdlib.h>
int main(void){return 0;}
])],
[ AC_MSG_RESULT(yes) [ AC_MSG_RESULT(yes)
CFLAGS="$saved_CFLAGS $t"
LDFLAGS="$saved_LDFLAGS $t"
AC_MSG_CHECKING(if $t works) AC_MSG_CHECKING(if $t works)
AC_RUN_IFELSE( AC_RUN_IFELSE(
[AC_LANG_SOURCE([ [AC_LANG_SOURCE([
@ -134,7 +141,7 @@ int main(void){exit(0);}
[ AC_MSG_RESULT(no) ], [ AC_MSG_RESULT(no) ],
[ AC_MSG_WARN([cross compiling: cannot test]) [ AC_MSG_WARN([cross compiling: cannot test])
break ] break ]
) )
], ],
[ AC_MSG_RESULT(no) ] [ AC_MSG_RESULT(no) ]
) )