summaryrefslogtreecommitdiff
path: root/m4/fp_cc_linker_flag_try.m4
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-04-02 11:52:47 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-05 05:42:38 -0400
commit7ffbdc3fa603c6411249ba9b758cf8f109c5fb30 (patch)
tree8a05d6e03ce2790e6e59651c824e569fee088d33 /m4/fp_cc_linker_flag_try.m4
parent6acadb79afe685c635fd255f90551a0fbfcbe3dc (diff)
downloadhaskell-7ffbdc3fa603c6411249ba9b758cf8f109c5fb30.tar.gz
Break up aclocal.m4
Diffstat (limited to 'm4/fp_cc_linker_flag_try.m4')
-rw-r--r--m4/fp_cc_linker_flag_try.m420
1 files changed, 20 insertions, 0 deletions
diff --git a/m4/fp_cc_linker_flag_try.m4 b/m4/fp_cc_linker_flag_try.m4
new file mode 100644
index 0000000000..69af387d5d
--- /dev/null
+++ b/m4/fp_cc_linker_flag_try.m4
@@ -0,0 +1,20 @@
+# FP_CC_LINKER_FLAG_TRY()
+# --------------------
+# Try a particular linker to see whether we can use it. In particular, determine
+# whether we can convince gcc to use it via a -fuse-ld=... flag.
+#
+# $1 = the name of the linker to try
+# $2 = the variable to set with the appropriate GHC flag if the linker is
+# found to be usable
+AC_DEFUN([FP_CC_LINKER_FLAG_TRY], [
+ AC_MSG_CHECKING([whether C compiler supports -fuse-ld=$1])
+ echo 'int main(void) {return 0;}' > conftest.c
+ if $CC -o conftest.o -fuse-ld=$1 conftest.c > /dev/null 2>&1
+ then
+ $2="-fuse-ld=$1"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ rm -f conftest.c conftest.o
+])