Skip to content

Commit 84025f4

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 d0a54ef commit 84025f4

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

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
@@ -299,7 +299,24 @@ AC_CONFIG_COMMANDS_PRE(OCAML_QUOTED_STRING_ID)
299299

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

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

0 commit comments

Comments
 (0)