diff options
author | Darren Tucker <dtucker@zip.com.au> | 2008-03-09 11:34:23 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2008-03-09 11:34:23 +1100 |
commit | b7918afddf36c22b8eb87d98819d2cf9ddb6b424 (patch) | |
tree | 53ead5ba6f0931bf10f8ef7226ff848aea3ddd1e | |
parent | 68d293859ed2db128003d6631b63847acf0ea79f (diff) |
- (dtucker) [configure.ac] It turns out gcc's -fstack-protector-all doesn't
always work for all platforms and versions, so test what we can and
add a configure flag to turn it of if needed. ok djm@
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | configure.ac | 53 |
2 files changed, 45 insertions, 15 deletions
@@ -1,3 +1,8 @@ | |||
1 | 20080309 | ||
2 | - (dtucker) [configure.ac] It turns out gcc's -fstack-protector-all doesn't | ||
3 | always work for all platforms and versions, so test what we can and | ||
4 | add a configure flag to turn it of if needed. ok djm@ | ||
5 | |||
1 | 20080307 | 6 | 20080307 |
2 | - (djm) OpenBSD CVS Sync | 7 | - (djm) OpenBSD CVS Sync |
3 | - jmc@cvs.openbsd.org 2008/02/11 07:58:28 | 8 | - jmc@cvs.openbsd.org 2008/02/11 07:58:28 |
@@ -3698,4 +3703,4 @@ | |||
3698 | OpenServer 6 and add osr5bigcrypt support so when someone migrates | 3703 | OpenServer 6 and add osr5bigcrypt support so when someone migrates |
3699 | passwords between UnixWare and OpenServer they will still work. OK dtucker@ | 3704 | passwords between UnixWare and OpenServer they will still work. OK dtucker@ |
3700 | 3705 | ||
3701 | $Id: ChangeLog,v 1.4860 2008/03/08 03:00:33 tim Exp $ | 3706 | $Id: ChangeLog,v 1.4861 2008/03/09 00:34:23 dtucker Exp $ |
diff --git a/configure.ac b/configure.ac index 017fd7e3d..b71f6832a 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,4 +1,4 @@ | |||
1 | # $Id: configure.ac,v 1.393 2008/03/02 10:52:28 dtucker Exp $ | 1 | # $Id: configure.ac,v 1.394 2008/03/09 00:34:23 dtucker Exp $ |
2 | # | 2 | # |
3 | # Copyright (c) 1999-2004 Damien Miller | 3 | # Copyright (c) 1999-2004 Damien Miller |
4 | # | 4 | # |
@@ -15,7 +15,7 @@ | |||
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.393 $) | 18 | AC_REVISION($Revision: 1.394 $) |
19 | AC_CONFIG_SRCDIR([ssh.c]) | 19 | AC_CONFIG_SRCDIR([ssh.c]) |
20 | 20 | ||
21 | AC_CONFIG_HEADER(config.h) | 21 | AC_CONFIG_HEADER(config.h) |
@@ -90,6 +90,13 @@ AC_C_INLINE | |||
90 | 90 | ||
91 | AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>]) | 91 | AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>]) |
92 | 92 | ||
93 | use_stack_protector=1 | ||
94 | AC_ARG_WITH(stackprotect, | ||
95 | [ --without-stackprotect Don't use compiler's stack protection], [ | ||
96 | if test "x$withval" = "xno"; then | ||
97 | use_stack_protector=0 | ||
98 | fi ]) | ||
99 | |||
93 | if test "$GCC" = "yes" || test "$GCC" = "egcs"; then | 100 | if test "$GCC" = "yes" || test "$GCC" = "egcs"; then |
94 | CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized" | 101 | CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized" |
95 | GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'` | 102 | GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'` |
@@ -105,18 +112,36 @@ if test "$GCC" = "yes" || test "$GCC" = "egcs"; then | |||
105 | *) ;; | 112 | *) ;; |
106 | esac | 113 | esac |
107 | 114 | ||
108 | AC_MSG_CHECKING(if $CC understands -fstack-protector-all) | 115 | # -fstack-protector-all doesn't always work for some GCC versions |
109 | saved_CFLAGS="$CFLAGS" | 116 | # and/or platforms, so we test if we can. |
110 | saved_LDFLAGS="$LDFLAGS" | 117 | if test "x$use_stack_protector" = "x1"; then |
111 | CFLAGS="$CFLAGS -fstack-protector-all" | 118 | for t in -fstack-protector-all -fstack-protector; do |
112 | LDFLAGS="$LDFLAGS -fstack-protector-all" | 119 | AC_MSG_CHECKING(if $CC understands $t) |
113 | AC_TRY_LINK([], [ int main(void){return 0;} ], | 120 | saved_CFLAGS="$CFLAGS" |
114 | [ AC_MSG_RESULT(yes) ], | 121 | saved_LDFLAGS="$LDFLAGS" |
115 | [ AC_MSG_RESULT(no) | 122 | CFLAGS="$CFLAGS $t" |
116 | CFLAGS="$saved_CFLAGS" | 123 | LDFLAGS="$LDFLAGS $t" |
117 | LDFLAGS="$saved_LDFLAGS" | 124 | AC_TRY_LINK([], [ int main(void){return 0;} ], |
118 | ] | 125 | [ AC_MSG_RESULT(yes) |
119 | ) | 126 | AC_MSG_CHECKING(if $t works) |
127 | AC_RUN_IFELSE( | ||
128 | [AC_LANG_SOURCE([ | ||
129 | #include <stdlib.h> | ||
130 | int main(void){exit(0);} | ||
131 | ])], | ||
132 | [ AC_MSG_RESULT(yes) | ||
133 | break ], | ||
134 | [ AC_MSG_RESULT(no) ], | ||
135 | [ AC_MSG_WARN([cross compiling: cannot test]) | ||
136 | break ] | ||
137 | ) | ||
138 | ], | ||
139 | [ AC_MSG_RESULT(no) ] | ||
140 | ) | ||
141 | CFLAGS="$saved_CFLAGS" | ||
142 | LDFLAGS="$saved_LDFLAGS" | ||
143 | done | ||
144 | fi | ||
120 | 145 | ||
121 | if test -z "$have_llong_max"; then | 146 | if test -z "$have_llong_max"; then |
122 | # retry LLONG_MAX with -std=gnu99, needed on some Linuxes | 147 | # retry LLONG_MAX with -std=gnu99, needed on some Linuxes |