Skip to content

Commit 2756d56

Browse files
authored
gh-85277: Fix building without stropts.h or empty stropts.h (#143521)
1 parent 2114da9 commit 2756d56

File tree

4 files changed

+167
-146
lines changed

4 files changed

+167
-146
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix building without ``stropts.h`` or empty ``stropts.h``

Modules/posixmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9397,13 +9397,13 @@ os_openpty_impl(PyObject *module)
93979397
if (_Py_set_inheritable(master_fd, 0, NULL) < 0)
93989398
goto posix_error;
93999399

9400-
#if !defined(__CYGWIN__) && !defined(__ANDROID__) && !defined(HAVE_DEV_PTC)
9400+
#if defined(HAVE_STROPTS_H) && !defined(HAVE_DEV_PTC)
94019401
ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */
94029402
ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm */
94039403
#ifndef __hpux
94049404
ioctl(slave_fd, I_PUSH, "ttcompat"); /* push ttcompat */
94059405
#endif /* __hpux */
9406-
#endif /* HAVE_CYGWIN */
9406+
#endif /* defined(HAVE_STROPTS_H) && !defined(HAVE_DEV_PTC) */
94079407
#endif /* HAVE_OPENPTY */
94089408

94099409
return Py_BuildValue("(ii)", master_fd, slave_fd);

configure

Lines changed: 153 additions & 143 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3011,7 +3011,7 @@ AC_CHECK_HEADERS([ \
30113011
io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/fs.h linux/limits.h linux/memfd.h \
30123012
linux/netfilter_ipv4.h linux/random.h linux/soundcard.h linux/sched.h \
30133013
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 \
3014-
sched.h setjmp.h shadow.h signal.h spawn.h stropts.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \
3014+
sched.h setjmp.h shadow.h signal.h spawn.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \
30153015
sys/endian.h sys/epoll.h sys/event.h sys/eventfd.h sys/file.h sys/ioctl.h sys/kern_control.h \
30163016
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 \
30173017
sys/random.h sys/resource.h sys/select.h sys/sendfile.h sys/socket.h sys/soundcard.h sys/stat.h \
@@ -3022,6 +3022,16 @@ AC_CHECK_HEADERS([ \
30223022
AC_HEADER_DIRENT
30233023
AC_HEADER_MAJOR
30243024

3025+
# On Linux, stropts.h may be empty
3026+
AC_CHECK_DECL([I_PUSH], [
3027+
AC_DEFINE([HAVE_STROPTS_H], [1],
3028+
[Define to 1 if you have the <stropts.h> header file.])], [], [
3029+
#ifdef HAVE_SYS_TYPES_H
3030+
# include <sys/types.h>
3031+
#endif
3032+
#include <stropts.h>
3033+
])
3034+
30253035
# bluetooth/bluetooth.h has been known to not compile with -std=c99.
30263036
# http://permalink.gmane.org/gmane.linux.bluez.kernel/22294
30273037
SAVE_CFLAGS=$CFLAGS

0 commit comments

Comments
 (0)