summaryrefslogtreecommitdiff
path: root/m4/ghc_convert_os.m4
blob: 885ca2484811c0cc28f088c038724515399e26ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# GHC_CONVERT_OS(os, converted_cpu, target_var)
# --------------------------------
# converts os from gnu to ghc naming, and assigns the result to $target_var
AC_DEFUN([GHC_CONVERT_OS],[
    case "$1" in
      gnu*) # e.g. i686-unknown-gnu0.9
        $3="gnu"
        ;;
      # watchos and tvos are ios variants as of May 2017.
      ios|watchos|tvos)
        $3="ios"
        ;;
      linux-android*)
        $3="linux-android"
        ;;
      linux-*|linux)
        $3="linux"
        ;;
      netbsd*)
        $3="netbsd"
        ;;
      openbsd*)
        $3="openbsd"
        ;;
      # As far as I'm aware, none of these have relevant variants
      freebsd|dragonfly|hpux|linuxaout|kfreebsdgnu|freebsd2|mingw32|darwin|nextstep2|nextstep3|sunos4|ultrix|haiku)
        $3="$1"
        ;;
      msys)
        AC_MSG_ERROR([Building GHC using the msys toolchain is not supported; please use mingw instead. Perhaps you need to set 'MSYSTEM=MINGW64 or MINGW32?'])
        ;;
      aix*) # e.g. powerpc-ibm-aix7.1.3.0
        $3="aix"
        ;;
      darwin*) # e.g. aarch64-apple-darwin14
        $3="darwin"
        ;;
      solaris2*)
        $3="solaris2"
        ;;
      freebsd*) # like i686-gentoo-freebsd7
                #      i686-gentoo-freebsd8
                #      i686-gentoo-freebsd8.2
        $3="freebsd"
        ;;
      nto-qnx*)
        $3="nto-qnx"
        ;;
      wasi)
        $3="wasi"
        ;;
      ghcjs*)
        $3="ghcjs"
        ;;
      *)
        echo "Unknown OS $1"
        exit 1
        ;;
      esac
])