]> andersk Git - openssh.git/commitdiff
- (dtucker) [configure.ac] Run stack-protector tests with -Werror to catch
authordtucker <dtucker>
Sun, 9 Mar 2008 11:50:50 +0000 (11:50 +0000)
committerdtucker <dtucker>
Sun, 9 Mar 2008 11:50:50 +0000 (11:50 +0000)
   platforms where gcc understands the option but it's not supported (and
   thus generates a warning).

ChangeLog
configure.ac

index 01ed00afa3aa95fa87ff1d00f0143c3c5f8a85d1..13e979cf25dd06217caa680658a03b186b049e04 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,9 @@
  - (dtucker) [openbsd-compat/regress/strtonumtest.c] Bug #1347: Use platform's
    equivalent of LLONG_MAX for the compat regression tests, which makes them
    run on AIX and HP-UX.  Patch from David Leonard.
+ - (dtucker) [configure.ac] Run stack-protector tests with -Werror to catch
+   platforms where gcc understands the option but it's not supported (and
+   thus generates a warning).
 
 20080307
  - (djm) OpenBSD CVS Sync
index 45ef53c46c04daceb87e01b5771d77cf5a6ae8fc..68cac01ae569d39318bc61aec6652325df53d175 100644 (file)
@@ -113,16 +113,23 @@ if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
        esac
 
        # -fstack-protector-all doesn't always work for some GCC versions
-       # and/or platforms, so we test if we can.
+       # and/or platforms, so we test if we can.  If it's not supported
+       # on a give platform gcc will emit a warning so we use -Werror.
        if test "x$use_stack_protector" = "x1"; then
            for t in -fstack-protector-all -fstack-protector; do
-               AC_MSG_CHECKING(if $CC understands $t)
+               AC_MSG_CHECKING(if $CC supports $t)
                saved_CFLAGS="$CFLAGS"
                saved_LDFLAGS="$LDFLAGS"
-               CFLAGS="$CFLAGS $t"
-               LDFLAGS="$LDFLAGS $t"
-               AC_TRY_LINK([], [ int main(void){return 0;} ],
+               CFLAGS="$CFLAGS $t -Werror"
+               LDFLAGS="$LDFLAGS $t -Werror"
+               AC_LINK_IFELSE(
+                       [AC_LANG_SOURCE([
+#include <stdlib.h>
+int main(void){return 0;}
+                        ])],
                    [ AC_MSG_RESULT(yes)
+                     CFLAGS="$saved_CFLAGS $t"
+                     LDFLAGS="$saved_LDFLAGS $t"
                      AC_MSG_CHECKING(if $t works)
                      AC_RUN_IFELSE(
                        [AC_LANG_SOURCE([
@@ -134,7 +141,7 @@ int main(void){exit(0);}
                        [ AC_MSG_RESULT(no) ],
                        [ AC_MSG_WARN([cross compiling: cannot test])
                          break ]
-                   )
+                     )
                    ],
                    [ AC_MSG_RESULT(no) ]
                )
This page took 0.06244 seconds and 5 git commands to generate.