diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-06-15 21:04:07 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-06-18 11:48:45 -0400 |
commit | adbdeafad9a85226ef9d232e85360bea54f78a73 (patch) | |
tree | a0a8a2d3324f4403dcd92798b7a2313142c07a0c /acinclude.m4 | |
parent | 26855fe22cc314d0f60162f6e6020aa0741a67e3 (diff) | |
download | tor-adbdeafad9a85226ef9d232e85360bea54f78a73.tar.gz tor-adbdeafad9a85226ef9d232e85360bea54f78a73.zip |
More sophisticated attempt at detecting working linker options
On some platforms, the linker is perfectly happy to produce binaries
that won't run if you give it the wrong set of flags. So when not
cross-compiling, try to link-and-run a little test program, rather
than just linking it.
Possible fix for 6173.
Diffstat (limited to 'acinclude.m4')
-rw-r--r-- | acinclude.m4 | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 43280597a4..ae14411f6b 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -71,9 +71,14 @@ AC_DEFUN([TOR_CHECK_LDFLAGS], [ CFLAGS="$CFLAGS -pedantic -Werror" LDFLAGS="$LDFLAGS $2 $1" LIBS="$LIBS $3" - AC_TRY_LINK([], [return 0;], + AC_RUN_IFELSE([ +#include <stdio.h> +int main(int argc, char **argv) { fputs("", stdout); return 0; }], [AS_VAR_SET(VAR,yes)], - [AS_VAR_SET(VAR,no)]) + [AS_VAR_SET(VAR,no)], + [AC_TRY_LINK([], [return 0;], + [AS_VAR_SET(VAR,yes)], + [AS_VAR_SET(VAR,no)])]) CFLAGS="$tor_saved_CFLAGS" LDFLAGS="$tor_saved_LDFLAGS" LIBS="$tor_saved_LIBS" |