summaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2010-07-28 16:19:57 +0000
committerIan Lynagh <igloo@earth.li>2010-07-28 16:19:57 +0000
commit2537fda6092f9dd1599d8246060dbb11778b3639 (patch)
tree14e612175cf86468fab4a4258f923606fdb05554 /aclocal.m4
parent6a16aa336536e5e425a5dea9e812bdad762749e5 (diff)
downloadhaskell-2537fda6092f9dd1599d8246060dbb11778b3639.tar.gz
Set -fno-stack-protector in extra-gcc-opts; fixes #4206
We were using it only when building the RTS, and only on certain platforms. However, some versions of OS X need the flag, while others don't support it, so we now test for it properly.
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m49
1 files changed, 9 insertions, 0 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 53bd165bec..5358cc2727 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -962,6 +962,9 @@ AC_SUBST([GhcPkgCmd])
# reordering things in the module and confusing the manger and/or splitter.
# (eg. Trac #1427)
#
+# If gcc knows about the stack protector, turn it off.
+# Otherwise the stack-smash handler gets triggered.
+#
AC_DEFUN([FP_GCC_EXTRA_FLAGS],
[AC_REQUIRE([FP_HAVE_GCC])
AC_CACHE_CHECK([for extra options to pass gcc when compiling via C], [fp_cv_gcc_extra_opts],
@@ -987,6 +990,12 @@ AC_CACHE_CHECK([for extra options to pass gcc when compiling via C], [fp_cv_gcc_
[])
;;
esac
+ echo 'int main(void) {return 0;}' > conftest.c
+ if $CC -c conftest.c -fno-stack-protector > /dev/null 2>&1
+ then
+ fp_cv_gcc_extra_opts="$fp_cv_gcc_extra_opts -fno-stack-protector"
+ fi
+ rm conftest.c conftest.o
])
AC_SUBST([GccExtraViaCOpts],$fp_cv_gcc_extra_opts)
])