RFR: JDK-8034788 Rewrite toolchain.m4 to support multiple toolchains per platform

Magnus Ihse Bursie magnus.ihse.bursie at oracle.com
Wed Feb 12 14:58:18 UTC 2014

We need to be able to handle different toolchains on the same platform, 
e.g. both gcc and clang on macosx. We have felt the need for this for 
quite some time, but it has become pressing due to the clang on macosx 
issue. (We are on a path to replace gcc with clang as official build 
platform on macosx, but we need to handle both toolchains during a 
transition period.

To do this properly requires a complete reorganisation and cleanup of 

This is, as you can see, quite a large change in the configure system. 
Unfortunately, due to the bad state of the code in toolchain.m4, it was 
hard to do it in smaller steps. I have still tried to keep the changes 
small. For instance:
* Full clang functionality was not a goal for this patch.
* Fixing all issues in toolchain.m4 was not a goal for this patch. 
(Although I've sprinkled the code with FIXME that I intend to address as 
soon as possible.)

Both of these will be addressed in follow-up patches.

In this step, the priority has been to:
1) introduce the toolchain type concept,
2) cleanup toolchain.m4 to be able support this, and
3) move flag handling out of toolchain.m4

This is a (somewhat cleaned up) log from the commits to my internal 
working repo, it gives a hint on what kind of changes/refactorisations 
that were performed:
* Separate flag handling from toolchain.m4 into new file flags.m4.
* Remove all non-flags handling from flags code (this has aldready been 
handled elsewhere).
* Clean up flags.m4 heavily. Rename functions FLAGS_*. Group setting of 
flags by flag type. Simplify logic if possible. Adapt to new toolchain type.
* Adapt configure.ac to how stuff have moved and splitted.
* Remove old COMPILER_TYPE and COMPILER_NAME, fully replace with 
* Print toolchain and improved compiler version info in 
* Move AC_SUBST to where variables were set up.
* Move TOOLCHAIN_SETUP_MSVCR_DLL etc into new function 
LIB_SETUP_ON_WINDOWS in libraries.m4.
* Fix compiler version output for microsoft compiler.
* Fix version parsing for solstudio.
* Reorder and rename functions in toolchain.m4.
* Move strip and mcs flags setup to flags.m4.
* Break out Windows compiler platform check from 
* Make sure --with-tools-dir override everything, even on windows.
* Add/update documentation for all functions in toolchain.m4
* Add/improve implementation comments.
* Add lots of FIXME:s for stuff needing fixes (but not this time around).
* Remove AS_IF
* Fix broken indentation.
* Fix bug in printing in BASIC_FIXUP_EXECUTABLE.

Bug: https://bugs.openjdk.java.net/browse/JDK-8034788


More information about the build-dev mailing list