+# 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

+])

+

+# FIND_LD

+# ---------

+# Find the version of `ld` to use and figure out how to get gcc to use it for

+# linking (if --enable-ld-override is enabled). This is used in both in the top

+# level configure.ac and in distrib/configure.ac.in.

+#

+# $1 = the platform

+# $2 = the variable to set with GHC options to configure gcc to use the chosen linker

+#

+AC_DEFUN([FIND_LD],[

+ AC_ARG_ENABLE(ld-override,

+ [AC_HELP_STRING([--disable-ld-override],

+ [Prevent GHC from overriding the default linker used by gcc. If ld-override is enabled GHC will try to tell gcc to use whichever linker is selected by the LD environment variable. [default=override enabled]])],