GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
build

Build: Preserve *_FOR_BUILD environment variables.

The build process now consistently preserves *_FOR_BUILD environment variables, enabling custom build tool configurations.

Environment variables like CC_FOR_BUILD (C compiler for the build architecture) were not being consistently preserved during the configuration process, particularly when the build and host architectures were the same. This commit ensures that these *_FOR_BUILD variables are always preserved, enabling users to specify custom build tools. Without the patch, the configure script would incorrectly default to using the host compiler even when a specific CC_FOR_BUILD was provided.

In Details

The configure.ac script was modified to consistently preserve *_FOR_BUILD environment variables. Previously, these variables were only preserved when build != host. Now, AC_SUBST ensures variables like CC_FOR_BUILD are correctly substituted in the generated Makefiles in all cases. This allows users to override the default build tools without unintended fallback.

For Context

When compiling software, especially in complex scenarios like cross-compilation, it's often necessary to specify different tools for the architecture you're building *on* versus the architecture you're building *for*. Environment variables like CC_FOR_BUILD allow users to specify the C compiler for the build architecture. This commit ensures that these environment variables are consistently honored during the configuration process, providing greater flexibility and control over the build environment.

Filed Under: buildconfigurecross-compilation