summaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2014-01-22 21:30:12 +1100
committerDamien Miller <djm@mindrot.org>2014-01-22 21:30:12 +1100
commit5c2ff5e31f57d303ebb414d84a934c02728fa568 (patch)
treeb1c8a8a1d6eee29847c3de5d7ebe00f79f44db93 /aclocal.m4
parent852472a54b8a0dc3e53786b313baaa86850a4273 (diff)
- (djm) [configure.ac aclocal.m4] More tests to detect fallout from
platform hardening options: include some long long int arithmatic to detect missing support functions for -ftrapv in libgcc and equivalents, actually test linking when -ftrapv is supplied and set either both -pie/-fPIE or neither. feedback and ok dtucker@
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m445
1 files changed, 42 insertions, 3 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 195a87636..1640683e1 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
1dnl $Id: aclocal.m4,v 1.12 2014/01/21 02:10:27 djm Exp $ 1dnl $Id: aclocal.m4,v 1.13 2014/01/22 10:30:12 djm Exp $
2dnl 2dnl
3dnl OpenSSH-specific autoconf macros 3dnl OpenSSH-specific autoconf macros
4dnl 4dnl
@@ -21,7 +21,45 @@ int main(int argc, char **argv) {
21 int i = 123 * argc, j = 456 + argc, k = 789 - argc; 21 int i = 123 * argc, j = 456 + argc, k = 789 - argc;
22 float l = i * 2.1; 22 float l = i * 2.1;
23 double m = l / 0.5; 23 double m = l / 0.5;
24 printf("%d %d %d %f %f\n", i, j, k, l, m); 24 long long int n = argc * 12345LL, o = 12345LL * (long long int)argc;
25 printf("%d %d %d %f %f %lld %lld\n", i, j, k, l, m, n, o);
26 exit(0);
27}
28 ]])],
29 [
30if `grep -i "unrecognized option" conftest.err >/dev/null`
31then
32 AC_MSG_RESULT([no])
33 CFLAGS="$saved_CFLAGS"
34else
35 AC_MSG_RESULT([yes])
36 CFLAGS="$saved_CFLAGS $_define_flag"
37fi],
38 [ AC_MSG_RESULT([no])
39 CFLAGS="$saved_CFLAGS" ]
40 )
41}])
42
43dnl OSSH_CHECK_CFLAG_LINK(check_flag[, define_flag])
44dnl Check that $CC accepts a flag 'check_flag'. If it is supported append
45dnl 'define_flag' to $CFLAGS. If 'define_flag' is not specified, then append
46dnl 'check_flag'.
47AC_DEFUN([OSSH_CHECK_CFLAG_LINK], [{
48 AC_MSG_CHECKING([if $CC supports compile flag $1 and linking succeeds])
49 saved_CFLAGS="$CFLAGS"
50 CFLAGS="$CFLAGS $WERROR $1"
51 _define_flag="$2"
52 test "x$_define_flag" = "x" && _define_flag="$1"
53 AC_LINK_IFELSE([AC_LANG_SOURCE([[
54#include <stdlib.h>
55#include <stdio.h>
56int main(int argc, char **argv) {
57 /* Some math to catch -ftrapv problems in the toolchain */
58 int i = 123 * argc, j = 456 + argc, k = 789 - argc;
59 float l = i * 2.1;
60 double m = l / 0.5;
61 long long int n = argc * 12345LL, o = 12345LL * (long long int)argc;
62 printf("%d %d %d %f %f %lld %lld\n", i, j, k, l, m, n, o);
25 exit(0); 63 exit(0);
26} 64}
27 ]])], 65 ]])],
@@ -57,7 +95,8 @@ int main(int argc, char **argv) {
57 int i = 123 * argc, j = 456 + argc, k = 789 - argc; 95 int i = 123 * argc, j = 456 + argc, k = 789 - argc;
58 float l = i * 2.1; 96 float l = i * 2.1;
59 double m = l / 0.5; 97 double m = l / 0.5;
60 printf("%d %d %d %f %f\n", i, j, k, l, m); 98 long long int n = argc * 12345LL, o = 12345LL * (long long int)argc;
99 printf("%d %d %d %f %f %lld %lld\n", i, j, k, l, m, n, o);
61 exit(0); 100 exit(0);
62} 101}
63 ]])], 102 ]])],