From 627cf134087f67001306b9480a51f6c5ea082758 Mon Sep 17 00:00:00 2001 From: Samuel Hym Date: Mon, 26 Feb 2024 11:51:11 +0100 Subject: [PATCH 07/14] Allow `ocaml` as a target OS to configure freestanding cross-compilers Allow the use of *-*-ocaml or *-*-*-ocaml target triplets to stand for freestanding cross-compilers by temporarily rewriting the target OS to `none` when generating the canonical target This allows to use *-*-ocaml and *-*-*-ocaml prefixes for cross-compiler specific toolchains, so that all the specific tools (for instance aarch64-solo5-ocaml-gcc, etc.) are automatically discovered --- configure | Bin 682314 -> 682823 bytes configure.ac | 17 +++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/configure b/configure index b393e6e2871a942e0171f1a52b70f75ef74f780a..498bc2042686e7fc202a6ecdfaa1ca6d2c780efc 100755 GIT binary patch delta 551 zcmb7Au}T9$5G64hyAYqSwV3K0acut*y?#&dEm?A?al#Tc8Uibbka`3PGf zpCDMKu(PuF8=Rb?7e!E(x6Hg5-n^N|dGPQQ4DU;Kqd^T0mC`*BI>uB9Kno5{LJrPa z(9s4uhR8b1E@YNKtkbSkWZ=9Hj?%6+Xr$_cp`MYBJG>gWODae>4IMa;o{|61aQCv0LGEUD~e8z zTTP$8oLnUJu%5@31`e*51@l62Dx261{k<^X;#0yeh(n|C<>7x0jx1mLPY!+`Kb@Rb sH>dMqd4KjYD&17JzPbN#R&m=Nml$Qn3ZueUWvnr(jP+T2yz%<{2ER13{Qv*} delta 60 zcmX?pP4mg9ZU F7XS(}7}x*+ diff --git a/configure.ac b/configure.ac index 26de5bed24..6f02258356 100644 --- a/configure.ac +++ b/configure.ac @@ -286,7 +286,24 @@ AC_CONFIG_COMMANDS_PRE(OCAML_QUOTED_STRING_ID) AC_CANONICAL_BUILD AC_CANONICAL_HOST +# Allow "ocaml" as target OS for freestanding compiler by temporarily rewriting +# the target OS to "none" to generate the canonical target +real_target_alias="$target_alias" +AS_CASE([$target_alias], + [*-*-*-ocaml], + [ac_save_IFS=$IFS + IFS='-' + set x $target_alias + target_alias="$2-$3-none" + IFS=$ac_save_IFS], + [*-*-ocaml], + [ac_save_IFS=$IFS + IFS='-' + set x $target_alias + target_alias="$2-none" + IFS=$ac_save_IFS]) AC_CANONICAL_TARGET +target_alias="$real_target_alias" # Override cross_compiling and ac_tool_prefix variables since the C toolchain is # used to generate target code when building a cross compiler -- 2.45.2