diff options
author | Damien Miller <djm@mindrot.org> | 2011-01-12 16:00:37 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2011-01-12 16:00:37 +1100 |
commit | 134d02a494f435458a1147dea9ed719f1274078c (patch) | |
tree | 22e45b45fcf6e146dce42d7d5d6fb19b7bda8f27 /configure.ac | |
parent | 945aa0c744ea99544fdf7f868ff9cce0193c9fdd (diff) |
- (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@
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac index 020634b56..93dd22174 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,4 +1,4 @@ | |||
1 | # $Id: configure.ac,v 1.462 2011/01/12 02:34:02 djm Exp $ | 1 | # $Id: configure.ac,v 1.463 2011/01/12 05:00:39 djm Exp $ |
2 | # | 2 | # |
3 | # Copyright (c) 1999-2004 Damien Miller | 3 | # Copyright (c) 1999-2004 Damien Miller |
4 | # | 4 | # |
@@ -15,9 +15,21 @@ | |||
15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 | 16 | ||
17 | AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) | 17 | AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) |
18 | AC_REVISION($Revision: 1.462 $) | 18 | AC_REVISION($Revision: 1.463 $) |
19 | AC_CONFIG_SRCDIR([ssh.c]) | 19 | AC_CONFIG_SRCDIR([ssh.c]) |
20 | 20 | ||
21 | # local macros | ||
22 | AC_DEFUN([OPENSSH_CHECK_CFLAG_COMPILE], [{ | ||
23 | AC_MSG_CHECKING([if $CC supports $1]) | ||
24 | saved_CFLAGS="$CFLAGS" | ||
25 | CFLAGS="$CFLAGS $1" | ||
26 | AC_COMPILE_IFELSE([void main(void) { return 0; }], | ||
27 | [ AC_MSG_RESULT(yes) ], | ||
28 | [ AC_MSG_RESULT(no) | ||
29 | CFLAGS="$saved_CFLAGS" ] | ||
30 | ) | ||
31 | }]) | ||
32 | |||
21 | AC_CONFIG_HEADER(config.h) | 33 | AC_CONFIG_HEADER(config.h) |
22 | AC_PROG_CC | 34 | AC_PROG_CC |
23 | AC_CANONICAL_HOST | 35 | AC_CANONICAL_HOST |
@@ -113,21 +125,27 @@ AC_ARG_WITH(stackprotect, | |||
113 | use_stack_protector=0 | 125 | use_stack_protector=0 |
114 | fi ]) | 126 | fi ]) |
115 | 127 | ||
128 | |||
116 | if test "$GCC" = "yes" || test "$GCC" = "egcs"; then | 129 | if test "$GCC" = "yes" || test "$GCC" = "egcs"; then |
117 | CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized" | 130 | OPENSSH_CHECK_CFLAG_COMPILE([-Wall]) |
131 | OPENSSH_CHECK_CFLAG_COMPILE([-Wpointer-arith]) | ||
132 | OPENSSH_CHECK_CFLAG_COMPILE([-Wuninitialized]) | ||
133 | OPENSSH_CHECK_CFLAG_COMPILE([-Wsign-compare]) | ||
134 | OPENSSH_CHECK_CFLAG_COMPILE([-Wformat-security]) | ||
135 | OPENSSH_CHECK_CFLAG_COMPILE([-Wno-pointer-sign]) | ||
136 | OPENSSH_CHECK_CFLAG_COMPILE([-Wno-unused-result]) | ||
137 | OPENSSH_CHECK_CFLAG_COMPILE([-fno-strict-aliasing]) | ||
138 | AC_MSG_CHECKING(gcc version) | ||
118 | GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'` | 139 | GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'` |
119 | case $GCC_VER in | 140 | case $GCC_VER in |
120 | 1.*) no_attrib_nonnull=1 ;; | 141 | 1.*) no_attrib_nonnull=1 ;; |
121 | 2.8* | 2.9*) | 142 | 2.8* | 2.9*) |
122 | CFLAGS="$CFLAGS -Wsign-compare" | ||
123 | no_attrib_nonnull=1 | 143 | no_attrib_nonnull=1 |
124 | ;; | 144 | ;; |
125 | 2.*) no_attrib_nonnull=1 ;; | 145 | 2.*) no_attrib_nonnull=1 ;; |
126 | 3.*) CFLAGS="$CFLAGS -Wsign-compare -Wformat-security" ;; | ||
127 | 4.[0123]|4.[0123].*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign -Wformat-security -fno-strict-aliasing" ;; | ||
128 | 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign -Wformat-security -fno-strict-aliasing -Wno-unused-result" ;; | ||
129 | *) ;; | 146 | *) ;; |
130 | esac | 147 | esac |
148 | AC_MSG_RESULT($GCC_VER) | ||
131 | 149 | ||
132 | AC_MSG_CHECKING(if $CC accepts -fno-builtin-memset) | 150 | AC_MSG_CHECKING(if $CC accepts -fno-builtin-memset) |
133 | saved_CFLAGS="$CFLAGS" | 151 | saved_CFLAGS="$CFLAGS" |