libcody, c++tools: Only use GCC-specific flags the compiler accepts
Patch ensures libcody and c++tools only use GCC-specific flags if supported by the compiler.
This patch updates the build process for libcody and c++tools to conditionally apply GCC-specific compiler flags like -fno-exceptions, -fno-rtti, -MMD, -MP, and -MF. Previously, these flags were passed unconditionally, causing build failures on host compilers that did not support them. The changes introduce a configure-time check for flag support and adjust Makefiles to use these flags only when accepted. Additionally, libcody’s build system now includes config.h from internal.hh, resolving dependency issues.
- proposer
Submits a patch to make the use of GCC-specific compiler flags conditional on compiler support for `libcody` and `c++tools`.
“-fno-exceptions -fno-rtti and -MMD -MP -MF were passed unconditionally, and libcody used -include config.h, so host compilers without these options could not build these directories.”
In Details
This patch series modifies the build configuration for libcody and c++tools to enhance portability. It addresses the unconditional use of GCC-specific compiler flags (-fno-exceptions, -fno-rtti, -MMD, -MP, -MF) which could break builds on non-GCC compilers or older GCC versions. A new ACX_PROG_CXX_FLAGS macro is introduced to perform configure-time checks for compiler flag acceptance. The patch also refactors libcody's include mechanism, moving from -include config.h to #include "config.h" within internal.hh to resolve build order dependencies.
- libcody
- Likely a component or library within the GNU toolchain, possibly related to C++ standard library implementation or tools.
- c++tools
- A collection of tools related to C++ development within the GNU toolchain.
- -fno-exceptions
- A GCC flag that disables exception handling support, potentially reducing code size and improving performance in projects that do not use exceptions.
- -fno-rtti
- A GCC flag that disables Run-Time Type Information, used for C++ dynamic casting and exception handling, which can reduce code size.
- -MMD -MP -MF
- Flags used by GCC for generating dependency files (
.dfiles) during compilation, which are crucial for build systems like Make to track source file dependencies. - configure
- A script generated by Autoconf that checks the system environment and configures the build process for a software package.
- Makefile
- A file used by the
makebuild automation tool to define build targets, dependencies, and commands.