Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix building without ``stropts.h`` or empty ``stropts.h``
4 changes: 2 additions & 2 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -9384,13 +9384,13 @@ os_openpty_impl(PyObject *module)
if (_Py_set_inheritable(master_fd, 0, NULL) < 0)
goto posix_error;

#if !defined(__CYGWIN__) && !defined(__ANDROID__) && !defined(HAVE_DEV_PTC)
#if defined(HAVE_STROPTS_H) && !defined(HAVE_DEV_PTC)
ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */
ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm */
#ifndef __hpux
ioctl(slave_fd, I_PUSH, "ttcompat"); /* push ttcompat */
#endif /* __hpux */
#endif /* HAVE_CYGWIN */
#endif /* defined(HAVE_STROPTS_H) && !defined(HAVE_DEV_PTC) */
#endif /* HAVE_OPENPTY */

return Py_BuildValue("(ii)", master_fd, slave_fd);
Expand Down
295 changes: 152 additions & 143 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3010,7 +3010,7 @@ AC_CHECK_HEADERS([ \
io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/fs.h linux/limits.h linux/memfd.h \
linux/netfilter_ipv4.h linux/random.h linux/soundcard.h linux/sched.h \
linux/tipc.h linux/wait.h netdb.h net/ethernet.h netinet/in.h netpacket/packet.h poll.h process.h pthread.h pty.h \
sched.h setjmp.h shadow.h signal.h spawn.h stropts.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \
sched.h setjmp.h shadow.h signal.h spawn.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \
sys/endian.h sys/epoll.h sys/event.h sys/eventfd.h sys/file.h sys/ioctl.h sys/kern_control.h \
sys/loadavg.h sys/lock.h sys/memfd.h sys/mkdev.h sys/mman.h sys/modem.h sys/param.h sys/pidfd.h sys/poll.h \
sys/random.h sys/resource.h sys/select.h sys/sendfile.h sys/socket.h sys/soundcard.h sys/stat.h \
Expand All @@ -3021,6 +3021,14 @@ AC_CHECK_HEADERS([ \
AC_HEADER_DIRENT
AC_HEADER_MAJOR

# On Linux, stropts.h may be empty
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>
])
Copy link
Copy Markdown
Member

@picnixz picnixz Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.


# bluetooth/bluetooth.h has been known to not compile with -std=c99.
# http://permalink.gmane.org/gmane.linux.bluez.kernel/22294
SAVE_CFLAGS=$CFLAGS
Expand Down
Loading