diff options
Diffstat (limited to 'aclocal.m4')
-rw-r--r-- | aclocal.m4 | 86 |
1 files changed, 82 insertions, 4 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index 1b3bed790..1640683e1 100644 --- a/aclocal.m4 +++ b/aclocal.m4 | |||
@@ -1,4 +1,4 @@ | |||
1 | dnl $Id: aclocal.m4,v 1.9 2013/06/02 21:31:27 tim Exp $ | 1 | dnl $Id: aclocal.m4,v 1.13 2014/01/22 10:30:12 djm Exp $ |
2 | dnl | 2 | dnl |
3 | dnl OpenSSH-specific autoconf macros | 3 | dnl OpenSSH-specific autoconf macros |
4 | dnl | 4 | dnl |
@@ -8,12 +8,24 @@ dnl Check that $CC accepts a flag 'check_flag'. If it is supported append | |||
8 | dnl 'define_flag' to $CFLAGS. If 'define_flag' is not specified, then append | 8 | dnl 'define_flag' to $CFLAGS. If 'define_flag' is not specified, then append |
9 | dnl 'check_flag'. | 9 | dnl 'check_flag'. |
10 | AC_DEFUN([OSSH_CHECK_CFLAG_COMPILE], [{ | 10 | AC_DEFUN([OSSH_CHECK_CFLAG_COMPILE], [{ |
11 | AC_MSG_CHECKING([if $CC supports $1]) | 11 | AC_MSG_CHECKING([if $CC supports compile flag $1]) |
12 | saved_CFLAGS="$CFLAGS" | 12 | saved_CFLAGS="$CFLAGS" |
13 | CFLAGS="$CFLAGS $1" | 13 | CFLAGS="$CFLAGS $WERROR $1" |
14 | _define_flag="$2" | 14 | _define_flag="$2" |
15 | test "x$_define_flag" = "x" && _define_flag="$1" | 15 | test "x$_define_flag" = "x" && _define_flag="$1" |
16 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int main(void) { return 0; }]])], | 16 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
17 | #include <stdlib.h> | ||
18 | #include <stdio.h> | ||
19 | int main(int argc, char **argv) { | ||
20 | /* Some math to catch -ftrapv problems in the toolchain */ | ||
21 | int i = 123 * argc, j = 456 + argc, k = 789 - argc; | ||
22 | float l = i * 2.1; | ||
23 | double m = l / 0.5; | ||
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 | ]])], | ||
17 | [ | 29 | [ |
18 | if `grep -i "unrecognized option" conftest.err >/dev/null` | 30 | if `grep -i "unrecognized option" conftest.err >/dev/null` |
19 | then | 31 | then |
@@ -28,6 +40,72 @@ fi], | |||
28 | ) | 40 | ) |
29 | }]) | 41 | }]) |
30 | 42 | ||
43 | dnl OSSH_CHECK_CFLAG_LINK(check_flag[, define_flag]) | ||
44 | dnl Check that $CC accepts a flag 'check_flag'. If it is supported append | ||
45 | dnl 'define_flag' to $CFLAGS. If 'define_flag' is not specified, then append | ||
46 | dnl 'check_flag'. | ||
47 | AC_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> | ||
56 | int 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); | ||
63 | exit(0); | ||
64 | } | ||
65 | ]])], | ||
66 | [ | ||
67 | if `grep -i "unrecognized option" conftest.err >/dev/null` | ||
68 | then | ||
69 | AC_MSG_RESULT([no]) | ||
70 | CFLAGS="$saved_CFLAGS" | ||
71 | else | ||
72 | AC_MSG_RESULT([yes]) | ||
73 | CFLAGS="$saved_CFLAGS $_define_flag" | ||
74 | fi], | ||
75 | [ AC_MSG_RESULT([no]) | ||
76 | CFLAGS="$saved_CFLAGS" ] | ||
77 | ) | ||
78 | }]) | ||
79 | |||
80 | dnl OSSH_CHECK_LDFLAG_LINK(check_flag[, define_flag]) | ||
81 | dnl Check that $LD accepts a flag 'check_flag'. If it is supported append | ||
82 | dnl 'define_flag' to $LDFLAGS. If 'define_flag' is not specified, then append | ||
83 | dnl 'check_flag'. | ||
84 | AC_DEFUN([OSSH_CHECK_LDFLAG_LINK], [{ | ||
85 | AC_MSG_CHECKING([if $LD supports link flag $1]) | ||
86 | saved_LDFLAGS="$LDFLAGS" | ||
87 | LDFLAGS="$LDFLAGS $WERROR $1" | ||
88 | _define_flag="$2" | ||
89 | test "x$_define_flag" = "x" && _define_flag="$1" | ||
90 | AC_LINK_IFELSE([AC_LANG_SOURCE([[ | ||
91 | #include <stdlib.h> | ||
92 | #include <stdio.h> | ||
93 | int main(int argc, char **argv) { | ||
94 | /* Some math to catch -ftrapv problems in the toolchain */ | ||
95 | int i = 123 * argc, j = 456 + argc, k = 789 - argc; | ||
96 | float l = i * 2.1; | ||
97 | double m = l / 0.5; | ||
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); | ||
100 | exit(0); | ||
101 | } | ||
102 | ]])], | ||
103 | [ AC_MSG_RESULT([yes]) | ||
104 | LDFLAGS="$saved_LDFLAGS $_define_flag"], | ||
105 | [ AC_MSG_RESULT([no]) | ||
106 | LDFLAGS="$saved_LDFLAGS" ] | ||
107 | ) | ||
108 | }]) | ||
31 | 109 | ||
32 | dnl OSSH_CHECK_HEADER_FOR_FIELD(field, header, symbol) | 110 | dnl OSSH_CHECK_HEADER_FOR_FIELD(field, header, symbol) |
33 | dnl Does AC_EGREP_HEADER on 'header' for the string 'field' | 111 | dnl Does AC_EGREP_HEADER on 'header' for the string 'field' |