RFR: 8323672: Suppress unwanted autoconf added flags in CC and CXX [v7]

Erik Joelsson erikj at openjdk.org
Fri Jan 19 14:03:29 UTC 2024


On Fri, 19 Jan 2024 01:22:27 GMT, Julian Waters <jwaters at openjdk.org> wrote:

> I found out that the issue of having AC_PROG_CC and AC_PROG_CXX being called by AC_REQUIRE can be solved by directly overwriting them in util.m4, rather than providing our own UTIL_PROG_CC and so on. Unsure how satisfactory this is, but I have here a stripped down version of both that omits:
> 
> For AC_PROG_CC
> 
> * The default check from a list of compilers if the compilers to search for list is empty, this now means AC_PROG_CC has to always be called with the argument at all times. We always do this, so shouldn't be a problem
> * The check whether the compiler supports GNU C. This shouldn't be relevant
> * The ill fated check that adds -std=gnu11. This was the one that the other issue wanted to get rid of
> 
> For AC_PROG_CXX
> 
> * Similarly, the default check from a list of compilers if the compilers to search for list is empty, and the check for CCC if it is set (We don't use CCC as fair as I can tell), this now means AC_PROG_CXX has to always be called with the argument at all times. We again always do this, so shouldn't be a problem
> * The check whether the compiler supports GNU C++. This shouldn't be relevant
> * The ill fated check that adds -std=gnu++11. This is also the one that the other issue wanted to get rid of
> 
> Notably, I left the check that checks if the compiler accepts -g in there, as I was unsure if we need it or not. I also tried removing the check for the object file extension, but apparently autoconf needs that to function properly. The exe file extension check is misleadingly named, because in actuality all of AC_PROG_CC and AC_PROG_CXX's functionality is in it,and it's also likely required for autoconf to work properly

This does look like an interesting solution and far smaller than I had anticipated. The risk is that we start depending on autoconf internals that may change in future versions. We would also need to validate this solution against all currently supported versions. At least I'm assuming that macros starting with `_` aren't part of the public API.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/17401#issuecomment-1900476220


More information about the build-dev mailing list