From b176362d26dd746819b6287e4702bce90eefa2c1 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 20 May 2011 11:45:25 +1000 Subject: - (djm) [aclocal.m4 configure.ac] since gcc-4.x ignores all -Wno-options options, we should corresponding -W-option when trying to determine whether it is accepted. Also includes a warning fix on the program fragment uses (bad main() return type). bz#1900 and bz#1901 reported by g.esp AT free.fr; ok dtucker@ --- aclocal.m4 | 20 +++++++++++++++++++- configure.ac | 32 ++++++++++---------------------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/aclocal.m4 b/aclocal.m4 index 83b241f7b..9bdea5ec2 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,8 +1,26 @@ -dnl $Id: aclocal.m4,v 1.7 2011/05/05 03:48:37 djm Exp $ +dnl $Id: aclocal.m4,v 1.8 2011/05/20 01:45:25 djm Exp $ dnl dnl OpenSSH-specific autoconf macros dnl +dnl OSSH_CHECK_CFLAG_COMPILE(check_flag[, define_flag]) +dnl Check that $CC accepts a flag 'check_flag'. If it is supported append +dnl 'define_flag' to $CFLAGS. If 'define_flag' is not specified, then append +dnl 'check_flag'. +AC_DEFUN([OSSH_CHECK_CFLAG_COMPILE], [{ + AC_MSG_CHECKING([if $CC supports $1]) + saved_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $1" + _define_flag="$2" + test "x$_define_flag" = "x" && _define_flag="$1" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int main(void) { return 0; }]])], + [ AC_MSG_RESULT([yes]) + CFLAGS="$saved_CFLAGS $_define_flag"], + [ AC_MSG_RESULT([no]) + CFLAGS="$saved_CFLAGS" ] + ) +}]) + dnl OSSH_CHECK_HEADER_FOR_FIELD(field, header, symbol) dnl Does AC_EGREP_HEADER on 'header' for the string 'field' diff --git a/configure.ac b/configure.ac index 5357cab60..d56bf6d36 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.473 2011/05/05 04:44:25 tim Exp $ +# $Id: configure.ac,v 1.474 2011/05/20 01:45:25 djm Exp $ # # Copyright (c) 1999-2004 Damien Miller # @@ -15,22 +15,10 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_INIT([OpenSSH], [Portable], [openssh-unix-dev@mindrot.org]) -AC_REVISION($Revision: 1.473 $) +AC_REVISION($Revision: 1.474 $) AC_CONFIG_SRCDIR([ssh.c]) AC_LANG([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([AC_LANG_SOURCE([[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 @@ -128,14 +116,14 @@ AC_ARG_WITH([stackprotect], if test "$GCC" = "yes" || test "$GCC" = "egcs"; then - 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]) + OSSH_CHECK_CFLAG_COMPILE([-Wall]) + OSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith]) + OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized]) + OSSH_CHECK_CFLAG_COMPILE([-Wsign-compare]) + OSSH_CHECK_CFLAG_COMPILE([-Wformat-security]) + OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign]) + OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result]) + OSSH_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 -- cgit v1.2.3