summaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2014-01-21 13:10:26 +1100
committerDamien Miller <djm@mindrot.org>2014-01-21 13:10:26 +1100
commit5c96a154c7940fa67b1f11c421e390dbbc159f27 (patch)
tree91fba8b07a70fa23909c29a256ebfd926d4dee55 /aclocal.m4
parent9464ba6fb34bb42eb3501ec3c5143662e75674bf (diff)
- (djm) [aclocal.m4] Flesh out the code run in the OSSH_CHECK_CFLAG_COMPILE
and OSSH_CHECK_LDFLAG_LINK tests to give them a better chance of detecting toolchain-related problems; ok dtucker
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m430
1 files changed, 26 insertions, 4 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index ce679648d..195a87636 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
1dnl $Id: aclocal.m4,v 1.11 2014/01/21 01:50:46 dtucker Exp $ 1dnl $Id: aclocal.m4,v 1.12 2014/01/21 02:10:27 djm Exp $
2dnl 2dnl
3dnl OpenSSH-specific autoconf macros 3dnl OpenSSH-specific autoconf macros
4dnl 4dnl
@@ -13,7 +13,18 @@ AC_DEFUN([OSSH_CHECK_CFLAG_COMPILE], [{
13 CFLAGS="$CFLAGS $WERROR $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>
19int 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 printf("%d %d %d %f %f\n", i, j, k, l, m);
25 exit(0);
26}
27 ]])],
17 [ 28 [
18if `grep -i "unrecognized option" conftest.err >/dev/null` 29if `grep -i "unrecognized option" conftest.err >/dev/null`
19then 30then
@@ -28,7 +39,7 @@ fi],
28 ) 39 )
29}]) 40}])
30 41
31dnl OSSH_CHECK_CFLAG_LINK(check_flag[, define_flag]) 42dnl OSSH_CHECK_LDFLAG_LINK(check_flag[, define_flag])
32dnl Check that $LD accepts a flag 'check_flag'. If it is supported append 43dnl Check that $LD accepts a flag 'check_flag'. If it is supported append
33dnl 'define_flag' to $LDFLAGS. If 'define_flag' is not specified, then append 44dnl 'define_flag' to $LDFLAGS. If 'define_flag' is not specified, then append
34dnl 'check_flag'. 45dnl 'check_flag'.
@@ -38,7 +49,18 @@ AC_DEFUN([OSSH_CHECK_LDFLAG_LINK], [{
38 LDFLAGS="$LDFLAGS $WERROR $1" 49 LDFLAGS="$LDFLAGS $WERROR $1"
39 _define_flag="$2" 50 _define_flag="$2"
40 test "x$_define_flag" = "x" && _define_flag="$1" 51 test "x$_define_flag" = "x" && _define_flag="$1"
41 AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void) { return 0; }]])], 52 AC_LINK_IFELSE([AC_LANG_SOURCE([[
53#include <stdlib.h>
54#include <stdio.h>
55int main(int argc, char **argv) {
56 /* Some math to catch -ftrapv problems in the toolchain */
57 int i = 123 * argc, j = 456 + argc, k = 789 - argc;
58 float l = i * 2.1;
59 double m = l / 0.5;
60 printf("%d %d %d %f %f\n", i, j, k, l, m);
61 exit(0);
62}
63 ]])],
42 [ AC_MSG_RESULT([yes]) 64 [ AC_MSG_RESULT([yes])
43 LDFLAGS="$saved_LDFLAGS $_define_flag"], 65 LDFLAGS="$saved_LDFLAGS $_define_flag"],
44 [ AC_MSG_RESULT([no]) 66 [ AC_MSG_RESULT([no])