summaryrefslogtreecommitdiff
path: root/m4/fp_settings.m4
blob: 09a24f33e10bcc81d7e00daade8cddf35ca2ab37 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# FP_SETTINGS
# ----------------------------------
# Set the variables used in the settings file
# See Note [tooldir: How GHC finds mingw on Windows]
AC_DEFUN([FP_SETTINGS],
[
    if test "$windows" = YES -a "$EnableDistroToolchain" = "NO"
    then
        mingw_bin_prefix='$$tooldir/mingw/bin/'
        SettingsCCompilerCommand="${mingw_bin_prefix}gcc.exe"
        SettingsHaskellCPPCommand="${mingw_bin_prefix}gcc.exe"
        SettingsHaskellCPPFlags="$HaskellCPPArgs"
        SettingsLdCommand="${mingw_bin_prefix}ld.exe"
        # Overrides FIND_MERGE_OBJECTS in order to avoid hard-coding linker
        # path on Windows (#18550).
        SettingsMergeObjectsCommand="${SettingsLdCommand}"
        SettingsMergeObjectsFlags="-r --oformat=pe-bigobj-x86-64"
        SettingsArCommand="${mingw_bin_prefix}ar.exe"
        SettingsRanlibCommand="${mingw_bin_prefix}ranlib.exe"
        SettingsDllWrapCommand="${mingw_bin_prefix}dllwrap.exe"
        SettingsWindresCommand="${mingw_bin_prefix}windres.exe"
        SettingsTouchCommand='$$topdir/bin/touchy.exe'
    elif test "$EnableDistroToolchain" = "YES"
    then
        SettingsCCompilerCommand="$(basename $CC)"
        SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2"
        SettingsCxxCompilerFlags="$CONF_CXX_OPTS_STAGE2"
        SettingsHaskellCPPCommand="$(basename $HaskellCPPCmd)"
        SettingsHaskellCPPFlags="$HaskellCPPArgs"
        SettingsLdCommand="$(basename $LdCmd)"
        SettingsMergeObjectsCommand="$(basename $MergeObjsCmd)"
        SettingsMergeObjectsFlags="$MergeObjsArgs"
        SettingsArCommand="$(basename $ArCmd)"
        SettingsDllWrapCommand="$(basename $DllWrapCmd)"
        SettingsWindresCommand="$(basename $WindresCmd)"
        SettingsTouchCommand='$$topdir/bin/touchy.exe'
    else
        SettingsCCompilerCommand="$CC"
        SettingsHaskellCPPCommand="$HaskellCPPCmd"
        SettingsHaskellCPPFlags="$HaskellCPPArgs"
        SettingsLdCommand="$LdCmd"
        SettingsMergeObjectsCommand="$MergeObjsCmd"
        SettingsMergeObjectsFlags="$MergeObjsArgs"
        SettingsArCommand="$ArCmd"
        SettingsRanlibCommand="$RanlibCmd"
        if test -z "$DllWrapCmd"
        then
            SettingsDllWrapCommand="/bin/false"
        else
            SettingsDllWrapCommand="$DllWrapCmd"
        fi
        if test -z "$WindresCmd"
        then
            SettingsWindresCommand="/bin/false"
        else
            SettingsWindresCommand="$WindresCmd"
        fi
       SettingsTouchCommand='touch'
    fi
    if test -z "$LibtoolCmd"
    then
      SettingsLibtoolCommand="libtool"
    else
      SettingsLibtoolCommand="$LibtoolCmd"
    fi
    if test -z "$ClangCmd"
    then
        SettingsClangCommand="clang"
    else
        SettingsClangCommand="$ClangCmd"
    fi
    if test -z "$LlcCmd"
    then
      SettingsLlcCommand="llc"
    else
      SettingsLlcCommand="$LlcCmd"
    fi
    if test -z "$OptCmd"
    then
      SettingsOptCommand="opt"
    else
      SettingsOptCommand="$OptCmd"
    fi
    if test -z "$OtoolCmd"
    then
      SettingsOtoolCommand="otool"
    else
      SettingsOtoolCommand="$OtoolCmd"
    fi
    if test -z "$InstallNameToolCmd"
    then
      SettingsInstallNameToolCommand="install_name_tool"
    else
      SettingsInstallNameToolCommand="$InstallNameToolCmd"
    fi
    SettingsCCompilerFlags="$CONF_CC_OPTS_STAGE2"
    SettingsCxxCompilerFlags="$CONF_CXX_OPTS_STAGE2"
    SettingsCCompilerLinkFlags="$CONF_GCC_LINKER_OPTS_STAGE2"
    SettingsCCompilerSupportsNoPie="$CONF_GCC_SUPPORTS_NO_PIE"
    SettingsLdFlags="$CONF_LD_LINKER_OPTS_STAGE2"
    SettingsUseDistroMINGW="$EnableDistroToolchain"
    AC_SUBST(SettingsCCompilerCommand)
    AC_SUBST(SettingsHaskellCPPCommand)
    AC_SUBST(SettingsHaskellCPPFlags)
    AC_SUBST(SettingsCCompilerFlags)
    AC_SUBST(SettingsCxxCompilerFlags)
    AC_SUBST(SettingsCCompilerLinkFlags)
    AC_SUBST(SettingsCCompilerSupportsNoPie)
    AC_SUBST(SettingsLdCommand)
    AC_SUBST(SettingsLdFlags)
    AC_SUBST(SettingsMergeObjectsCommand)
    AC_SUBST(SettingsMergeObjectsFlags)
    AC_SUBST(SettingsArCommand)
    AC_SUBST(SettingsRanlibCommand)
    AC_SUBST(SettingsOtoolCommand)
    AC_SUBST(SettingsInstallNameToolCommand)
    AC_SUBST(SettingsDllWrapCommand)
    AC_SUBST(SettingsWindresCommand)
    AC_SUBST(SettingsLibtoolCommand)
    AC_SUBST(SettingsTouchCommand)
    AC_SUBST(SettingsClangCommand)
    AC_SUBST(SettingsLlcCommand)
    AC_SUBST(SettingsOptCommand)
    AC_SUBST(SettingsUseDistroMINGW)
])