Sven Tennie pushed to branch wip/supersven/correctly_propagate_host-build-target at Glasgow Haskell Compiler / GHC

WARNING: The push did not contain any new commits, but force pushed to delete the commits and changes below.

Deleted commits:

1 changed file:

Changes:

  • distrib/configure.ac.in
    ... ... @@ -24,6 +24,10 @@ dnl works as expected, since we're slightly modifying how Autoconf
    24 24
     dnl interprets build/host/target and how this interacts with $CC tests
    
    25 25
     test -n "$target_alias" && ac_tool_prefix=$target_alias-
    
    26 26
     
    
    27
    +# Propagate $LD (if exists) to ghc-toolchain. Otherwise, ghc-toolchain tends to
    
    28
    +# emit `-fuse-ld` for cross-compilers.
    
    29
    +USER_LD="$LD"
    
    30
    +
    
    27 31
     dnl Various things from the source distribution configure
    
    28 32
     bootstrap_build=@BuildPlatform@
    
    29 33
     bootstrap_host=@HostPlatform@
    
    ... ... @@ -149,12 +153,38 @@ AC_SUBST([EnableStrictGhcToolchainCheck])
    149 153
     
    
    150 154
     dnl ** Which gcc to use?
    
    151 155
     dnl --------------------------------------------------------------
    
    156
    +
    
    157
    +dnl AC_PROG_CC sets CFLAGS to `-g -O2` if the env var is empty.
    
    158
    +dnl Same goes for AC_PROG_CXX and CXXFLAGS. Setting the vars prevents this.
    
    159
    +dnl (`-g` increases binary sizes with debugging symbols. `-O2` may optimize
    
    160
    +dnl symbols away, confusing the RTS linker.)
    
    161
    +: ${CFLAGS=""}
    
    162
    +: ${CXXFLAGS=""}
    
    163
    +
    
    152 164
     AC_PROG_CC([cc gcc clang])
    
    153 165
     AC_PROG_CXX([c++ g++ clang++])
    
    154 166
     # Work around #24324
    
    155 167
     MOVE_TO_FLAGS([CC],[CFLAGS])
    
    156 168
     MOVE_TO_FLAGS([CXX],[CXXFLAGS])
    
    157 169
     
    
    170
    +dnl Save the original user-provided environment variables immediately
    
    171
    +dnl before any m4 macros modify them. These will be passed to ghc-toolchain
    
    172
    +dnl so it can make independent decisions and reach the same conclusions as autoconf.
    
    173
    +USER_CONF_CC_OPTS_STAGE2="$CFLAGS"
    
    174
    +USER_CONF_CXX_OPTS_STAGE2="$CXXFLAGS"
    
    175
    +USER_CONF_GCC_LINKER_OPTS_STAGE2="$LDFLAGS"
    
    176
    +USER_CPP_ARGS="$CPPFLAGS"
    
    177
    +USER_HS_CPP_ARGS="$HaskellCPPArgs"
    
    178
    +USER_JS_CPP_ARGS="$JavaScriptCPPArgs"
    
    179
    +USER_CMM_CPP_ARGS="$CmmCPPArgs"
    
    180
    +
    
    181
    +dnl Initialize CONF_* variables with user-provided environment variables
    
    182
    +dnl so that subsequent configure checks modify them and both autoconf and
    
    183
    +dnl ghc-toolchain see the same values
    
    184
    +CONF_CC_OPTS_STAGE2="$CFLAGS"
    
    185
    +CONF_CXX_OPTS_STAGE2="$CXXFLAGS"
    
    186
    +CONF_GCC_LINKER_OPTS_STAGE2="$LDFLAGS"
    
    187
    +
    
    158 188
     dnl ** figure out how to invoke the C preprocessor (i.e. `gcc -E`)
    
    159 189
     AC_PROG_CPP
    
    160 190