build: Skip gmp.h check in cross-compiler builds
Prevents build failures in cross-compiler scenarios by skipping unnecessary GMP header checks.
This commit addresses an issue in GCC’s configure script that caused failures when a cross-compiler was used to build a native compiler (host != build). The problem occurred because a check for gmp.h was unconditionally performed during the nested configure run for the build machine, which lacked the necessary include paths. The fix guards this check with GENERATOR_FILE, ensuring it’s skipped when appropriate and allowing the build to proceed correctly without requiring GMP headers on the build machine.
In Details
The gcc/configure script's check for gmp.h compilation capability, introduced by commit 8383ac6fcda, incorrectly triggered during cross-compilation builds where host != build. In such scenarios, gcc/configure runs a nested configure for the build system, which clears GMPINC and sets GENERATOR_FILE. The gmp.h check, however, unconditionally includes gmp.h without considering GMPINC, leading to a failure if gmp.h is not found on the build host. This patch guards the gmp.h check with GENERATOR_FILE, similar to how system.h is handled, resolving the issue.
- cross-compiler
- A compiler that runs on one operating system or architecture but produces executables for a different operating system or architecture.
- host
- The system where the compiler is being built and run.
- build machine
- The system for which the target code is being compiled; in a cross-compilation scenario, this is the target architecture/OS.
- configure script
- A script generated by Autoconf that checks system characteristics and capabilities, preparing the build environment for a software package.
- GMP
- The GNU Multiple Precision Arithmetic Library, a free library for arbitrary-precision arithmetic.
- GMPINC
- A preprocessor define used by GCC's build system to specify include paths for the GMP library.
- GENERATOR_FILE
- A preprocessor define used during GCC's build process to indicate that certain system headers should not be included, typically to avoid dependencies on the host system's libraries.