From 134d02a494f435458a1147dea9ed719f1274078c Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Wed, 12 Jan 2011 16:00:37 +1100 Subject: - (djm) [configure.ac] Fix broken test for gcc >= 4.4 with per-compiler flag tests that don't depend on gcc version at all; suggested by and ok dtucker@ --- ChangeLog | 3 +++ configure.ac | 32 +++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index da374f54..f928331c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,9 @@ "looks ok" tedu@ feedback guenther@ - (djm) [configure.ac] Turn on -Wno-unused-result for gcc >= 4.4 to avoid silly warnings on write() calls we don't care succeed or not. + - (djm) [configure.ac] Fix broken test for gcc >= 4.4 with per-compiler + flag tests that don't depend on gcc version at all; suggested by and + ok dtucker@ 20110111 - (tim) [regress/host-expand.sh] Fix for building outside of read only diff --git a/configure.ac b/configure.ac index 020634b5..93dd2217 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.462 2011/01/12 02:34:02 djm Exp $ +# $Id: configure.ac,v 1.463 2011/01/12 05:00:39 djm Exp $ # # Copyright (c) 1999-2004 Damien Miller # @@ -15,9 +15,21 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) -AC_REVISION($Revision: 1.462 $) +AC_REVISION($Revision: 1.463 $) AC_CONFIG_SRCDIR([ssh.c]) +# local macros +AC_DEFUN([OPENSSH_CHECK_CFLAG_COMPILE], [{ + AC_MSG_CHECKING([if $CC supports $1]) + saved_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + AC_COMPILE_IFELSE([void main(void) { return 0; }], + [ AC_MSG_RESULT(yes) ], + [ AC_MSG_RESULT(no) + CFLAGS="$saved_CFLAGS" ] + ) +}]) + AC_CONFIG_HEADER(config.h) AC_PROG_CC AC_CANONICAL_HOST @@ -113,21 +125,27 @@ AC_ARG_WITH(stackprotect, use_stack_protector=0 fi ]) + if test "$GCC" = "yes" || test "$GCC" = "egcs"; then - CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized" + OPENSSH_CHECK_CFLAG_COMPILE([-Wall]) + OPENSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith]) + OPENSSH_CHECK_CFLAG_COMPILE([-Wuninitialized]) + OPENSSH_CHECK_CFLAG_COMPILE([-Wsign-compare]) + OPENSSH_CHECK_CFLAG_COMPILE([-Wformat-security]) + OPENSSH_CHECK_CFLAG_COMPILE([-Wno-pointer-sign]) + OPENSSH_CHECK_CFLAG_COMPILE([-Wno-unused-result]) + OPENSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing]) + AC_MSG_CHECKING(gcc version) GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'` case $GCC_VER in 1.*) no_attrib_nonnull=1 ;; 2.8* | 2.9*) - CFLAGS="$CFLAGS -Wsign-compare" no_attrib_nonnull=1 ;; 2.*) no_attrib_nonnull=1 ;; - 3.*) CFLAGS="$CFLAGS -Wsign-compare -Wformat-security" ;; - 4.[0123]|4.[0123].*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign -Wformat-security -fno-strict-aliasing" ;; - 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign -Wformat-security -fno-strict-aliasing -Wno-unused-result" ;; *) ;; esac + AC_MSG_RESULT($GCC_VER) AC_MSG_CHECKING(if $CC accepts -fno-builtin-memset) saved_CFLAGS="$CFLAGS" -- cgit v1.2.3