[php-src] PR #19259: Fix GH-19250 (Invalid conftest for rl_pending_input)
| From: | nielsdos | Date: | Sun, 27 Jul 2025 09:19:18 +0000 |
| Subject: | [php-src] PR #19259: Fix GH-19250 (Invalid conftest for rl_pending_input) | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-32625@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/19259
Author: nielsdos
The 'rl_pending_input' is a variable in Readline library and checking it with
PHP_CHECK_LIBRARY wouldn't find it on some systems.
Library check works on most systems but not on the mentioned AIX in the bug as it exports variables
and functions differently whereas the linker couldn't resolve the variable as a function.
This should fix the build on systems where this caused issues, such as AIX.
The <readline/readline.h> is not self-contained header and needs to also have <stdio.h>
included before to have FILE type available. This fixes the issue on unpatched default readline
installations, such as macOS.
Checking this variable ensures that the found library is the correct library and also that it is of
minimum version needed by current PHP code (https://bugs.php.net/48608).
The library check:
```c
| char rl_pending_input ();
| int main (void) {
| return rl_pending_input ();
| }
```
The declaration check:
```c
| #include <stdio.h>
| #include <readline/readline.h>
| int main (void) {
| #ifndef rl_pending_input
| #ifdef __cplusplus
| (void) rl_pending_input;
| #else
| (void) rl_pending_input;
| #endif
| #endif
| ;
| return 0;
| }
```
Closes https://bugs.php.net/51558