Skip to content

Commit 9f5f16b

Browse files
committed
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.) can be discovered automatically by `configure`
1 parent 495a789 commit 9f5f16b

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

configure

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,24 @@ AC_CONFIG_COMMANDS_PRE(OCAML_QUOTED_STRING_ID)
301301

302302
AC_CANONICAL_BUILD
303303
AC_CANONICAL_HOST
304+
# Allow "ocaml" as target OS for freestanding compiler by temporarily rewriting
305+
# the target OS to "none" to generate the canonical target
306+
real_target_alias="$target_alias"
307+
AS_CASE([$target_alias],
308+
[*-*-*-ocaml],
309+
[ac_save_IFS=$IFS
310+
IFS='-'
311+
set x $target_alias
312+
target_alias="$2-$3-none"
313+
IFS=$ac_save_IFS],
314+
[*-*-ocaml],
315+
[ac_save_IFS=$IFS
316+
IFS='-'
317+
set x $target_alias
318+
target_alias="$2-none"
319+
IFS=$ac_save_IFS])
304320
AC_CANONICAL_TARGET
321+
target_alias="$real_target_alias"
305322

306323
# Override cross_compiling and ac_tool_prefix variables since the C toolchain is
307324
# used to generate target code when building a cross compiler

0 commit comments

Comments
 (0)