Skip to content

Fix GH-19250: Invalid conftest for rl_pending_input #19259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

nielsdos
Copy link
Member

@nielsdos nielsdos commented Jul 27, 2025

This is a backport of 0b25e26:


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:

| char rl_pending_input ();
| int main (void) {
|     return rl_pending_input ();
| }

The declaration check:

| #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

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
@nielsdos nielsdos changed the title Fix GH-19250 (Invalid conftest for rl_pending_input) Fix GH-19250: Invalid conftest for rl_pending_input Jul 27, 2025
@nielsdos nielsdos closed this in 17df11e Jul 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid conftest for rl_pending_input when compiling with -flto(=thin) | ext/readline/config.m4, PHP <= 8.3
3 participants