1 # FPTOOLS_SET_PLATFORMS_VARS
2 # ----------------------------------
3 # Set all the platform variables. First massage the default autoconf
4 # choices for build, host, and target, then parse it into
5 # <platform>Arch, <platform>Vendor, and <platform>OS, and finally define
6 # the other variables in terms of those.
7 AC_DEFUN([FPTOOLS_SET_PLATFORMS_VARS],
9 # If no argument was given for a configuration variable, then discard
10 # the guessed canonical system and use the configuration of the
11 # bootstrapping ghc. If an argument was given, map it from gnu format
14 # For why we do it this way, see: #3637, #1717, #2951
16 # In bindists, we haven't called AC_CANONICAL_{BUILD,HOST,TARGET}
17 # so this justs uses $bootstrap_target.
19 if test "$build_alias" = ""
21 FPTOOLS_OVERRIDE_PLATFORM_FROM_BOOTSTRAP([build], [Build])
23 GHC_CONVERT_PLATFORM_PARTS([build], [Build])
26 if test "$host_alias" = ""
28 FPTOOLS_OVERRIDE_PLATFORM_FROM_BOOTSTRAP([host], [Host])
30 GHC_CONVERT_PLATFORM_PARTS([host], [Host])
33 if test "$target_alias" = ""
35 if test "$host_alias" != ""
37 GHC_CONVERT_PLATFORM_PARTS([host], [Target])
39 FPTOOLS_OVERRIDE_PLATFORM_FROM_BOOTSTRAP([target], [Target])
42 GHC_CONVERT_PLATFORM_PARTS([target], [Target])
45 FPTOOLS_SET_PLATFORM_VARS([build], [Build])
46 FPTOOLS_SET_PLATFORM_VARS([host], [Host])
47 FPTOOLS_SET_PLATFORM_VARS([target], [Target])
57 dnl Attempt at arch agnostic distillation of the above, but it
58 dnl doesn't quite work yet. Perhaps after the configure script is
59 dnl more split up (#17191) this wil become more feasible.
61 dnl if test "[$]$1_alias" = ""
63 dnl if test "[$]$3_alias" != ""
65 dnl GHC_CONVERT_PLATFORM_PARTS($3, $2)
67 dnl FPTOOLS_SET_PLATFORMS_VARS($1, $2)
70 dnl GHC_CONVERT_PLATFORM_PARTS($1, $2)
73 # FPTOOLS_OVERRIDE_PLATFORM_FROM_BOOTSTRAP(platform,Platform)
74 # ----------------------------------
75 # Per the comment in FPTOOLS_OVERRIDE_PLATFORM_FROM_BOOTSTRAP's body, we
76 # need to sometimes replace inferred platforms with the bootstrap
77 # compiler's target platform.
78 AC_DEFUN([FPTOOLS_OVERRIDE_PLATFORM_FROM_BOOTSTRAP],
80 if test "$bootstrap_target" != ""
83 echo "$1 platform inferred as: [$]$1"
85 echo "Can't work out $1 platform"
89 $2[Arch]=`echo "[$]$1" | sed 's/-.*//'`
90 $2[Vendor]=`echo "[$]$1" | sed -e 's/.*-\(.*\)-.*/\1/'`
91 $2[OS]=`echo "[$]$1" | sed 's/.*-//'`
94 # FPTOOLS_SET_PLATFORM_VARS(platform,Platform)
95 # ----------------------------------
96 # Set the platform variables for a single plaform (one of build, host,
97 # or target). Assumes <platform>Arch, <platform>Vendor, and <platform>OS
98 # are defined, and does everything else in terms of them.
99 AC_DEFUN([FPTOOLS_SET_PLATFORM_VARS],
102 $2Platform="[$]$2Arch-[$]$2Vendor-[$]$2OS"
103 $2Platform_CPP=`echo "[$]$2Platform" | sed -e 's/\./_/g' -e 's/-/_/g'`
104 $2Arch_CPP=` echo "[$]$2Arch" | sed -e 's/\./_/g' -e 's/-/_/g'`
105 $2Vendor_CPP=` echo "[$]$2Vendor" | sed -e 's/\./_/g' -e 's/-/_/g'`
106 $2OS_CPP=` echo "[$]$2OS" | sed -e 's/\./_/g' -e 's/-/_/g'`
108 AC_MSG_NOTICE([GHC ]$1[ : $]$2[Platform])
111 AC_SUBST($2Platform_CPP)
115 AC_SUBST($2Vendor_CPP)
117 GHC_SELECT_FILE_EXTENSIONS([$]$1, [exeext_]$1, [soext_]$1)