diff options
author | GHC GitLab CI <ghc-ci@gitlab-haskell.org> | 2020-08-09 09:35:47 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-09-04 22:26:25 -0400 |
commit | 07bdcac38c90e79db9e4327f87c5400630dfe74b (patch) | |
tree | f8a20b2a435bc58c03356efd293fe939ddb9b58f /aclocal.m4 | |
parent | c1e54439be3d38a1f972ac772cca7eec5e1519a9 (diff) | |
download | haskell-07bdcac38c90e79db9e4327f87c5400630dfe74b.tar.gz |
configure: Avoid hard-coded ld path on Windows
The fix to #17962 ended up regressing on Windows as it failed to
replicate the logic responsible for overriding the toolchain paths on
Windows. This resulted in a hard-coded path to a directory that likely
doesn't exist on the user's system (#18550).
Diffstat (limited to 'aclocal.m4')
-rw-r--r-- | aclocal.m4 | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/aclocal.m4 b/aclocal.m4 index 1921304ed7..b1f52cb7e1 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -532,6 +532,10 @@ AC_DEFUN([FP_SETTINGS], 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" @@ -545,6 +549,8 @@ AC_DEFUN([FP_SETTINGS], SettingsHaskellCPPCommand="$(basename $HaskellCPPCmd)" SettingsHaskellCPPFlags="$HaskellCPPArgs" SettingsLdCommand="$(basename $LdCmd)" + SettingsMergeObjectsCommand="$(basename $MergeObjsCmd)" + SettingsMergeObjectsFlags="$MergeObjsArgs" SettingsArCommand="$(basename $ArCmd)" SettingsDllWrapCommand="$(basename $DllWrapCmd)" SettingsWindresCommand="$(basename $WindresCmd)" @@ -554,6 +560,8 @@ AC_DEFUN([FP_SETTINGS], SettingsHaskellCPPCommand="$HaskellCPPCmd" SettingsHaskellCPPFlags="$HaskellCPPArgs" SettingsLdCommand="$LdCmd" + SettingsMergeObjectsCommand="$MergeObjsCmd" + SettingsMergeObjectsFlags="$MergeObjsArgs" SettingsArCommand="$ArCmd" SettingsRanlibCommand="$RanlibCmd" if test -z "$DllWrapCmd" @@ -609,6 +617,8 @@ AC_DEFUN([FP_SETTINGS], AC_SUBST(SettingsCCompilerSupportsNoPie) AC_SUBST(SettingsLdCommand) AC_SUBST(SettingsLdFlags) + AC_SUBST(SettingsMergeObjectsCommand) + AC_SUBST(SettingsMergeObjectsFlags) AC_SUBST(SettingsArCommand) AC_SUBST(SettingsRanlibCommand) AC_SUBST(SettingsDllWrapCommand) @@ -2625,7 +2635,7 @@ AC_DEFUN([CHECK_FOR_GOLD_T22266],[ ]) $CC -c -o conftest.a.o conftest.a.c || AC_MSG_ERROR([Failed to compile test]) - $SettingsMergeObjectsCommand $SettingsMergeObjectsFlags -T conftest.t conftest.a.o -o conftest.ar.o || AC_MSG_ERROR([Failed to merge test object]) + $MergeObjsCmd $MergeObjsArgs -T conftest.t conftest.a.o -o conftest.ar.o || AC_MSG_ERROR([Failed to merge test object]) $CC -c -o conftest.main.o conftest.main.c || AC_MSG_ERROR([Failed to compile test driver]) $CC conftest.ar.o conftest.main.o -o conftest || AC_MSG_ERROR([Failed to link test driver]) @@ -2645,33 +2655,30 @@ AC_DEFUN([CHECK_FOR_GOLD_T22266],[ # ------------------ # Find which linker to use to merge object files. # +# See Note [Merging object files for GHCi] in GHC.Driver.Pipeline. AC_DEFUN([FIND_MERGE_OBJECTS],[ AC_REQUIRE([FIND_LD]) - if test -z "$SettingsMergeObjectsCommand"; then - SettingsMergeObjectsCommand="$LD" + if test -z "$MergeObjsCmd"; then + MergeObjsCmd="$LD" fi - if test -z "$SettingsMergeObjectsFlags"; then - SettingsMergeObjectsFlags="-r" + if test -z "$MergeObjsArgs"; then + MergeObjsArgs="-r" fi - CHECK_FOR_GOLD_T22266($SettingsMergeObjectsCommand) + CHECK_FOR_GOLD_T22266($MergeObjsCmd) if test "$result" = "1"; then - AC_MSG_NOTICE([$SettingsMergeObjectsCommand is broken due to binutils 22266, looking for another linker...]) - SettingsMergeObjectsCommand="" - AC_CHECK_TARGET_TOOL([SettingsMergeObjectsCommand], [ld]) - CHECK_FOR_GOLD_T22266($SettingsMergeObjectsCommand) + AC_MSG_NOTICE([$MergeObjsCmd is broken due to binutils 22266, looking for another linker...]) + MergeObjsCmd="" + AC_CHECK_TARGET_TOOL([MergeObjsCmd], [ld]) + CHECK_FOR_GOLD_T22266($MergeObjsCmd) if test "$result" = "1"; then - AC_MSG_ERROR([Linker is affected by binutils 22266 but couldn't find another unaffected linker. Please set the SettingsMergeObjectsCommand variable to a functional linker.]) + AC_MSG_ERROR([Linker is affected by binutils 22266 but couldn't find another unaffected linker. Please set the MergeObjsCmd variable to a functional linker.]) fi fi - if test "$windows" = YES -a "$EnableDistroToolchain" = "NO" -a "$WORD_SIZE" = 64; then - SettingsMergeObjectsFlags="$SettingsMergeObjectsFlags --oformat=pe-bigobj-x86-64" - fi - - AC_SUBST(SettingsMergeObjectsCommand) - AC_SUBST(SettingsMergeObjectsFlags) + AC_SUBST([MergeObjsCmd]) + AC_SUBST([MergeObjsArgs]) ]) # FIND_PYTHON |