-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-85277: Fix building without stropts.h or empty stropts.h
#143521
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
base: main
Are you sure you want to change the base?
Conversation
configure.ac
Outdated
| #if !defined(I_PUSH) | ||
| #error I_PUSH | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use AC_CHECK_DECL instead of a program.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
configure.ac
Outdated
| AC_COMPILE_IFELSE([ | ||
| AC_LANG_PROGRAM([[ | ||
| AC_CHECK_DECL([I_PUSH], [ | ||
| AC_DEFINE([HAVE_STROPTS_H], [1], [Define to 1 if you have the <stropts.h> header file.]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please properly wrap the calls. E.g., use the 2-space indents for inner blocks. Have a look at https://github.com/python/cpython/pull/142380/files#r2615800453 and the code I commented.
picnixz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a NEWS entry as well.
|
There is still some style issue. I will write a suggestion when I am on a laptop. |
| AC_CHECK_DECL([I_PUSH], [AC_DEFINE([HAVE_STROPTS_H], [1], [Define to 1 if you have the <stropts.h> header file.])], [], [ | ||
| #ifdef HAVE_SYS_TYPES_H | ||
| #include <sys/types.h> | ||
| #endif | ||
| #include <stropts.h> | ||
| ]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| AC_CHECK_DECL([I_PUSH], [AC_DEFINE([HAVE_STROPTS_H], [1], [Define to 1 if you have the <stropts.h> header file.])], [], [ | |
| #ifdef HAVE_SYS_TYPES_H | |
| #include <sys/types.h> | |
| #endif | |
| #include <stropts.h> | |
| ]) | |
| AC_CHECK_DECL([I_PUSH], [ | |
| AC_DEFINE( | |
| [HAVE_STROPTS_H], [1], | |
| [Define to 1 if you have the <stropts.h> header file.] | |
| )], [], [ | |
| #ifdef HAVE_SYS_TYPES_H | |
| # include <sys/types.h> | |
| #endif | |
| #include <stropts.h> | |
| ]) |
Hopefully, I got my brackets right. Otherwise, put them when they are needed. m4 has some weird syntax and the way I put my blank lines may also be not supported.
Added a check that not only do we have
stropts.h, butI_PUSHis also defined.I used
I_PUSHbecause it is used in two places (Modules/posixmodule.c,Modules/fcntlmodule.c), the rest of the definitions are only inModules/fcntlmodule.c.Also fix for gh-81541 if building without OpenPTY and without stropts.h.
Other related issues: