[Git][ghc/ghc][master] configure: Allow override of CrossCompiling

Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 81577fe7 by Ben Gamari at 2025-08-02T04:29:39-04:00 configure: Allow override of CrossCompiling As noted in #26236, the current inference logic is a bit simplistic. In particular, there are many cases (e.g. building for a new libc) where the target and host triples may differ yet we are still able to run the produced artifacts as native code. Closes #26236. - - - - - 1 changed file: - configure.ac Changes: ===================================== configure.ac ===================================== @@ -351,15 +351,23 @@ fi dnl ** Building a cross compiler? dnl -------------------------------------------------------------- -CrossCompiling=NO -# If 'host' and 'target' differ, then this means we are building a cross-compiler. -if test "$target" != "$host" ; then - CrossCompiling=YES - cross_compiling=yes # This tells configure that it can accept just 'target', - # otherwise you get - # configure: error: cannot run C compiled programs. - # If you meant to cross compile, use `--host'. +dnl We allow the user to override this since the target/host check +dnl can get this wrong in some particular cases. See #26236. +if test -z "$CrossCompiling" ; then + CrossCompiling=NO + # If 'host' and 'target' differ, then this means we are building a cross-compiler. + if test "$target" != "$host" ; then + CrossCompiling=YES + fi +fi +if test "$CrossCompiling" = "YES"; then + # This tells configure that it can accept just 'target', + # otherwise you get + # configure: error: cannot run C compiled programs. + # If you meant to cross compile, use `--host'. + cross_compiling=yes fi + if test "$BuildPlatform" != "$HostPlatform" ; then AC_MSG_ERROR([ You've selected: View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/81577fe7c1913c53608bf03e48f84507... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/81577fe7c1913c53608bf03e48f84507... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Marge Bot (@marge-bot)