- (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@
This commit is contained in:
Damien Miller 2011-05-20 11:45:25 +10:00
parent 14684a1f84
commit b176362d26
2 changed files with 29 additions and 23 deletions

20
aclocal.m4 vendored
View File

@ -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
dnl OpenSSH-specific autoconf macros dnl OpenSSH-specific autoconf macros
dnl 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 OSSH_CHECK_HEADER_FOR_FIELD(field, header, symbol)
dnl Does AC_EGREP_HEADER on 'header' for the string 'field' dnl Does AC_EGREP_HEADER on 'header' for the string 'field'

View File

@ -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 # Copyright (c) 1999-2004 Damien Miller
# #
@ -15,22 +15,10 @@
# 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.473 $) AC_REVISION($Revision: 1.474 $)
AC_CONFIG_SRCDIR([ssh.c]) AC_CONFIG_SRCDIR([ssh.c])
AC_LANG([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_CONFIG_HEADER([config.h])
AC_PROG_CC AC_PROG_CC
AC_CANONICAL_HOST AC_CANONICAL_HOST
@ -128,14 +116,14 @@ AC_ARG_WITH([stackprotect],
if test "$GCC" = "yes" || test "$GCC" = "egcs"; then if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
OPENSSH_CHECK_CFLAG_COMPILE([-Wall]) OSSH_CHECK_CFLAG_COMPILE([-Wall])
OPENSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith]) OSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith])
OPENSSH_CHECK_CFLAG_COMPILE([-Wuninitialized]) OSSH_CHECK_CFLAG_COMPILE([-Wuninitialized])
OPENSSH_CHECK_CFLAG_COMPILE([-Wsign-compare]) OSSH_CHECK_CFLAG_COMPILE([-Wsign-compare])
OPENSSH_CHECK_CFLAG_COMPILE([-Wformat-security]) OSSH_CHECK_CFLAG_COMPILE([-Wformat-security])
OPENSSH_CHECK_CFLAG_COMPILE([-Wno-pointer-sign]) OSSH_CHECK_CFLAG_COMPILE([-Wpointer-sign], [-Wno-pointer-sign])
OPENSSH_CHECK_CFLAG_COMPILE([-Wno-unused-result]) OSSH_CHECK_CFLAG_COMPILE([-Wunused-result], [-Wno-unused-result])
OPENSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing]) OSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing])
AC_MSG_CHECKING([gcc version]) AC_MSG_CHECKING([gcc version])
GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'` GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
case $GCC_VER in case $GCC_VER in