From 204dd050b9d50013eeb4137dc84e7cb678a7315a Mon Sep 17 00:00:00 2001 From: Samuel Hym Date: Thu, 22 Feb 2024 13:37:28 +0100 Subject: [PATCH 03/14] Use `target` instead of `host` to detect the C toolchain When building a cross-compiler, the runtime will run on the target, not the host so: - set `cross_compiling` by comparing `build` to `target` (rather than to `host`), as this variable will be used later - use `target` to set up the tool prefix, - as the libtool configuration will configure a `build` to `host` toolchain, temporarily assign `host*` values to `target*` values --- configure | Bin 682393 -> 682949 bytes configure.ac | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/configure b/configure index 9f16ca87352a88b5e995631c15fd8914f6b2ebfc..f81f4ca213b710395b61b64d1380318d4d80867d 100755 GIT binary patch delta 1998 zcmZ`(drVbz9N+yt?u9D~^12Qaj&QXR!UV#QN5pXGe6e(h`QUQ6_W&nu=Unc&0<{Wr zD<>GO8vK+s2i9!ONBq(FHF{hNafq|VoH5JU!?YZcjAl&@>UX)nUodan?QEa>`F_s# z{XIu7rw)#$?*GVC)z(thsCd1qOOc#j-7p+Z{W*{7R<&A5)?AY8bog}L?eKV&8nsz! zl)b84?N$uQP&KC_`RWv@L<%UJb+W2Ss$or$_8E$caZ;_KDPGyfRI;~L@kvgd1!<~N zG^u)@>UPb9kerEusLU3Ks(7txjpS1dpVXXepHY#uX0tt(X$v*os<;hBvde};(>>O= zdymC~8kGz+TUI=jXQ4e9(jmK5*+{q6sB}-8>Ch7ioYsxGab`&J;7ijZcm~ph0aI~I z5R;zYOxrmuo&>9j|1VP}X|$OmN!hr`N;5`Hp1Ap?(RA&&X)65x1(f-^xhyQ0)1w(= zxdl8gomu7I0!t;ZJwKOzJrW(hzrdtQTD3?x@xW)&S1G|1oF}<2d&V z0MXK5amo3CP0_59hg(n2Y;C8)fgU;wM8tvmlQcC0q52Vq>Rs&=oWH^-Tei z`Kx(_XiAjJlFp9jyr&%H3jX8{)RMsY^aj)_T=pC2JFx&qUPN8uP;w5SB5^=Xub~m4 z+4KhLS|s8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mh+Xf$?@_le2C`FFORhIoM|f8_?x^nPZhpZ1FzgRz{}A7 u&lW!p@=K}(wVRsnJ~JiB)J%E(6z`yWe|`NKZk-hCq*})%*Pn5(>G=<2b2Q8V diff --git a/configure.ac b/configure.ac index 2e3a11f60c..0862b381ff 100644 --- a/configure.ac +++ b/configure.ac @@ -288,6 +288,14 @@ AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_CANONICAL_TARGET +# Override cross_compiling and ac_tool_prefix variables since the C toolchain is +# used to generate target code when building a cross compiler +AS_IF([test x"$build" = x"$target"], + [cross_compiling=no], + [cross_compiling=yes]) +AS_IF([test -n "$target_alias"], + [ac_tool_prefix=$target_alias-]) + # Ensure that AC_CONFIG_LINKS will either create symlinks which are compatible # with native Windows (i.e. NTFS symlinks, not WSL or Cygwin-emulated ones) or # use its fallback mechanisms. Native Windows versions of ocamlc/ocamlopt cannot @@ -594,12 +602,22 @@ AC_CHECK_TOOLS([LD],[ld link]) # Also, it has been observed that, on some platforms (e.g. msvc) LT_INIT # alters the CFLAGS variable, so we save its value before calling the macro # and restore it after the call +pushdef([host], target)dnl +pushdef([host_alias], target_alias)dnl +pushdef([host_cpu], target_cpu)dnl +pushdef([host_vendor], target_vendor)dnl +pushdef([host_os], target_os)dnl old_host_os=$host_os AS_IF([test x"$host_os" = "xwindows"],[host_os=mingw]) saved_CFLAGS="$CFLAGS" LT_INIT CFLAGS="$saved_CFLAGS" host_os=$old_host_os +popdef([host_os])dnl +popdef([host_vendor])dnl +popdef([host_cpu])dnl +popdef([host_alias])dnl +popdef([host])dnl AS_CASE([$host], [sparc-sun-solaris*], -- 2.45.2