summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2008-03-09 11:34:23 +1100
committerDarren Tucker <dtucker@zip.com.au>2008-03-09 11:34:23 +1100
commitb7918afddf36c22b8eb87d98819d2cf9ddb6b424 (patch)
tree53ead5ba6f0931bf10f8ef7226ff848aea3ddd1e /configure.ac
parent68d293859ed2db128003d6631b63847acf0ea79f (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@
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac53
1 files changed, 39 insertions, 14 deletions
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
17AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) 17AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
18AC_REVISION($Revision: 1.393 $) 18AC_REVISION($Revision: 1.394 $)
19AC_CONFIG_SRCDIR([ssh.c]) 19AC_CONFIG_SRCDIR([ssh.c])
20 20
21AC_CONFIG_HEADER(config.h) 21AC_CONFIG_HEADER(config.h)
@@ -90,6 +90,13 @@ AC_C_INLINE
90 90
91AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>]) 91AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
92 92
93use_stack_protector=1
94AC_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
93if test "$GCC" = "yes" || test "$GCC" = "egcs"; then 100if 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>
130int 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