Skip to content
Snippets Groups Projects
Commit 485dba86 authored by Erik de Castro Lopo's avatar Erik de Castro Lopo
Browse files

configure : LLVM and LD detections improvements (#10234).


* distrib/configure.ac.in : Detect correct version of LLVM tools as
  was done for the top level configure.ac in 42448e37.
* aclocal.m4 : Add a FIND_LD macro that can be used in both
  configure scripts.
* Use new FIND_LD macro in both configure scripts.

Signed-off-by: default avatarErik de Castro Lopo <erikd@mega-nerd.com>

Test Plan: validate on amd64-linux and armhf-linux.

Reviewers: rwbarton, austin

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D828

GHC Trac Issues: #10234
parent 9d16808e
No related merge requests found
...@@ -2114,6 +2114,28 @@ AC_DEFUN([FIND_LLVM_PROG],[ ...@@ -2114,6 +2114,28 @@ AC_DEFUN([FIND_LLVM_PROG],[
fi 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() # FIND_GHC_BOOTSTRAP_PROG()
# -------------------------------- # --------------------------------
# Parse the bootstrap GHC's compier settings file for the location of things # Parse the bootstrap GHC's compier settings file for the location of things
......
...@@ -437,19 +437,7 @@ AC_SUBST([HaskellCPPArgs]) ...@@ -437,19 +437,7 @@ AC_SUBST([HaskellCPPArgs])
dnl ** Which ld to use? dnl ** Which ld to use?
dnl -------------------------------------------------------------- dnl --------------------------------------------------------------
FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) FIND_LD([LdCmd])
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
AC_SUBST([LdCmd]) AC_SUBST([LdCmd])
dnl ** Which nm to use? dnl ** Which nm to use?
...@@ -487,17 +475,18 @@ esac ...@@ -487,17 +475,18 @@ esac
# tools we are looking for. In the past, GHC supported a number of # tools we are looking for. In the past, GHC supported a number of
# versions of LLVM simultaneously, but that stopped working around # versions of LLVM simultaneously, but that stopped working around
# 3.5/3.6 release of LLVM. # 3.5/3.6 release of LLVM.
llvm_version=3.6 LlvmVersion=3.6
AC_SUBST([LlvmVersion])
dnl ** Which LLVM llc to use? dnl ** Which LLVM llc to use?
dnl -------------------------------------------------------------- dnl --------------------------------------------------------------
FIND_LLVM_PROG([LLC], [llc], [llc], [$llvm_version]) FIND_LLVM_PROG([LLC], [llc], [llc], [$LlvmVersion])
LlcCmd="$LLC" LlcCmd="$LLC"
AC_SUBST([LlcCmd]) AC_SUBST([LlcCmd])
dnl ** Which LLVM opt to use? dnl ** Which LLVM opt to use?
dnl -------------------------------------------------------------- dnl --------------------------------------------------------------
FIND_LLVM_PROG([OPT], [opt], [opt], [$llvm_version]) FIND_LLVM_PROG([OPT], [opt], [opt], [$LlvmVersion])
OptCmd="$OPT" OptCmd="$OPT"
AC_SUBST([OptCmd]) AC_SUBST([OptCmd])
......
...@@ -68,10 +68,27 @@ FP_CPP_CMD_WITH_ARGS(HaskellCPPCmd, HaskellCPPArgs) ...@@ -68,10 +68,27 @@ FP_CPP_CMD_WITH_ARGS(HaskellCPPCmd, HaskellCPPArgs)
AC_SUBST([HaskellCPPCmd]) AC_SUBST([HaskellCPPCmd])
AC_SUBST([HaskellCPPArgs]) 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 ** Which ld to use?
dnl -------------------------------------------------------------- dnl --------------------------------------------------------------
FP_ARG_WITH_PATH_GNU_PROG([LD], [ld], [ld]) FIND_LD([LdCmd])
LdCmd="$LD"
AC_SUBST([LdCmd]) AC_SUBST([LdCmd])
FP_GCC_VERSION FP_GCC_VERSION
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment