diff --git a/aclocal.m4 b/aclocal.m4 index c247f917e07aef1636361cd59e6cc2b288e44612..226e15aec556fe779a639e5c54d4063a9724a8f8 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -2114,6 +2114,28 @@ AC_DEFUN([FIND_LLVM_PROG],[ fi ]) +# FIND_LD +# Find the version of `ld` to use. This is used in both in the top level +# configure.ac and in distrib/configure.ac.in. +# +# $1 = the variable to set +# +AC_DEFUN([FIND_LD],[ + FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) + case $target in + arm*linux*) + # Arm requires use of the binutils ld.gold linker. + # This case should catch at least arm-unknown-linux-gnueabihf and + # arm-linux-androideabi. + FP_ARG_WITH_PATH_GNU_PROG([LD_GOLD], [ld.gold], [ld.gold]) + $1="$LD_GOLD" + ;; + *) + $1="$LD" + ;; + esac +]) + # FIND_GHC_BOOTSTRAP_PROG() # -------------------------------- # Parse the bootstrap GHC's compier settings file for the location of things diff --git a/configure.ac b/configure.ac index fc6b3c217e4fa2ffd5abc171e2e2ff43b53de05b..d5d9ab3032765eab4dc078334a24162ee8499ac5 100644 --- a/configure.ac +++ b/configure.ac @@ -437,19 +437,7 @@ AC_SUBST([HaskellCPPArgs]) dnl ** Which ld to use? dnl -------------------------------------------------------------- -FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) -case $target in -arm*linux*) - # Arm requires use of the binutils ld.gold linker. - # This case should catch at least arm-unknown-linux-gnueabihf and - # arm-linux-androideabi. - FP_ARG_WITH_PATH_GNU_PROG([LD_GOLD], [ld.gold], [ld.gold]) - LdCmd="$LD_GOLD" - ;; -*) - LdCmd="$LD" - ;; -esac +FIND_LD([LdCmd]) AC_SUBST([LdCmd]) dnl ** Which nm to use? @@ -487,17 +475,18 @@ esac # tools we are looking for. In the past, GHC supported a number of # versions of LLVM simultaneously, but that stopped working around # 3.5/3.6 release of LLVM. -llvm_version=3.6 +LlvmVersion=3.6 +AC_SUBST([LlvmVersion]) dnl ** Which LLVM llc to use? dnl -------------------------------------------------------------- -FIND_LLVM_PROG([LLC], [llc], [llc], [$llvm_version]) +FIND_LLVM_PROG([LLC], [llc], [llc], [$LlvmVersion]) LlcCmd="$LLC" AC_SUBST([LlcCmd]) dnl ** Which LLVM opt to use? dnl -------------------------------------------------------------- -FIND_LLVM_PROG([OPT], [opt], [opt], [$llvm_version]) +FIND_LLVM_PROG([OPT], [opt], [opt], [$LlvmVersion]) OptCmd="$OPT" AC_SUBST([OptCmd]) diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in index ab5c29933add18c92e1e997d84b8071428897b39..0fcd869491ea76d4aac304ce25217e91f10f9870 100644 --- a/distrib/configure.ac.in +++ b/distrib/configure.ac.in @@ -68,10 +68,27 @@ FP_CPP_CMD_WITH_ARGS(HaskellCPPCmd, HaskellCPPArgs) AC_SUBST([HaskellCPPCmd]) AC_SUBST([HaskellCPPArgs]) +# Here is where we re-target which specific version of the LLVM +# tools we are looking for. In the past, GHC supported a number of +# versions of LLVM simultaneously, but that stopped working around +# 3.5/3.6 release of LLVM. +LlvmVersion=@LlvmVersion@ + +dnl ** Which LLVM llc to use? +dnl -------------------------------------------------------------- +FIND_LLVM_PROG([LLC], [llc], [llc], [$LlvmVersion]) +LlcCmd="$LLC" +AC_SUBST([LlcCmd]) + +dnl ** Which LLVM opt to use? +dnl -------------------------------------------------------------- +FIND_LLVM_PROG([OPT], [opt], [opt], [$LlvmVersion]) +OptCmd="$OPT" +AC_SUBST([OptCmd]) + dnl ** Which ld to use? dnl -------------------------------------------------------------- -FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) -LdCmd="$LD" +FIND_LD([LdCmd]) AC_SUBST([LdCmd]) FP_GCC_VERSION