1 # GHC_LLVM_TARGET(target, target_cpu, target_vendor, target_os, llvm_target_var)
2 # --------------------------------
3 # converts the canonicalized target into something llvm can understand
4 AC_DEFUN([GHC_LLVM_TARGET], [
8 llvm_target_vendor="unknown"
9 llvm_target_os="freebsd-gnueabihf"
12 llvm_target_vendor="unknown"
13 llvm_target_os="$4""hf"
15 *-mingw32|*-mingw64|*-msys)
16 llvm_target_vendor="unknown"
17 llvm_target_os="windows-gnu"
19 # apple is a bit about their naming scheme for
20 # aarch64; and clang on macOS doesn't know that
21 # aarch64 would be arm64. So for LLVM we'll need
22 # to call it arm64; while we'll refer to it internally
23 # as aarch64 for consistency and sanity.
24 aarch64-apple-*|arm64-apple-*)
25 llvm_target_cpu="arm64"
26 GHC_CONVERT_VENDOR([$3],[llvm_target_vendor])
27 GHC_CONVERT_OS([$4],[$2],[llvm_target_os])
30 GHC_CONVERT_VENDOR([$3],[llvm_target_vendor])
31 GHC_CONVERT_OS([$4],[$2],[llvm_target_os])
35 # retain any android and gnueabi linux flavours
36 # for the LLVM Target. Otherwise these would be
37 # turned into just `-linux` and fail to be found
38 # in the `llvm-targets` file.
39 *-android*|*-gnueabi*|*-musleabi*)
40 GHC_CONVERT_VENDOR([$3],[llvm_target_vendor])
44 $5="$llvm_target_cpu-$llvm_target_vendor-$llvm_target_os"
47 # GHC_LLVM_TARGET_SET_VAR
48 # -----------------------
49 # Sets the cannonical target variable. This stub exists so other macros can
51 AC_DEFUN([GHC_LLVM_TARGET_SET_VAR], [
52 AC_REQUIRE([FPTOOLS_SET_PLATFORMS_VARS])
53 if test "$bootstrap_llvm_target" != ""
55 LlvmTarget=$bootstrap_llvm_target
57 GHC_LLVM_TARGET([$target],[$target_cpu],[$target_vendor],[$target_os],[LlvmTarget])