Define HAVE_LIMITS_H in options.h rather than config.h.#10097
Define HAVE_LIMITS_H in options.h rather than config.h.#10097kareem-wolfssl wants to merge 1 commit intowolfSSL:masterfrom
Conversation
…depends on this definition and config.h isn't consistently available at runtime. Fixes wolfSSL#9936.
There was a problem hiding this comment.
Pull request overview
This PR moves HAVE_LIMITS_H definition out of generated config.h and into wolfssl/options.h, because types.h depends on HAVE_LIMITS_H while config.h is not reliably available/used by downstream consumers (e.g., Android/arm32 builds).
Changes:
- Autotools: stop generating
HAVE_LIMITS_HviaAC_CHECK_HEADERS(...)and instead emit it intooptions.hby appending-DHAVE_LIMITS_H=1toAM_CPPFLAGSwhen<limits.h>is present. - CMake: define
HAVE_LIMITS_Hincmake/options.h.inand remove it fromcmake/config.in.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| configure.ac | Moves <limits.h> detection to an AM_CPPFLAGS define so it is captured in the generated wolfssl/options.h for consumers. |
| cmake/options.h.in | Adds HAVE_LIMITS_H to the generated wolfssl/options.h for CMake builds. |
| cmake/config.in | Removes HAVE_LIMITS_H from CMake-generated config.h to avoid relying on it at consumer compile time. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #ifndef WOLFSSL_OPTIONS_IGNORE_SYS | ||
| /* Since types.h depends on HAVE_LIMITS_H, we must define it in options.h. */ | ||
| #undef HAVE_LIMITS_H | ||
| #cmakedefine HAVE_LIMITS_H @HAVE_LIMITS_H@ |
There was a problem hiding this comment.
In the autotools-generated options.h, WOLFSSL_OPTIONS_IGNORE_SYS only gates macros that start with '_' (see configure.ac generation logic). Putting HAVE_LIMITS_H under this guard in the CMake options.h template means builds that define WOLFSSL_OPTIONS_IGNORE_SYS will not get HAVE_LIMITS_H, which can reintroduce the types.h sizing failure this PR is trying to fix. Consider moving HAVE_LIMITS_H outside the WOLFSSL_OPTIONS_IGNORE_SYS block (or otherwise aligning the gating behavior with configure’s options.h generation).
| #ifndef WOLFSSL_OPTIONS_IGNORE_SYS | |
| /* Since types.h depends on HAVE_LIMITS_H, we must define it in options.h. */ | |
| #undef HAVE_LIMITS_H | |
| #cmakedefine HAVE_LIMITS_H @HAVE_LIMITS_H@ | |
| /* Since types.h depends on HAVE_LIMITS_H, we must define it in options.h. */ | |
| #undef HAVE_LIMITS_H | |
| #cmakedefine HAVE_LIMITS_H @HAVE_LIMITS_H@ | |
| #ifndef WOLFSSL_OPTIONS_IGNORE_SYS |
Description
Required since types.h depends on this definition and config.h isn't consistently available at runtime.
Fixes #9936.
Testing
Tested build and confirmed HAVE_LIMITS_H definition moved as expected.
Checklist