Skip to content

Commit cc5d3e3

Browse files
committed
Fix building without stropts.h
1 parent 8565ddd commit cc5d3e3

File tree

3 files changed

+60
-9
lines changed

3 files changed

+60
-9
lines changed

Modules/posixmodule.c

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

9387-
#if !defined(__CYGWIN__) && !defined(__ANDROID__) && !defined(HAVE_DEV_PTC)
9387+
#if defined(HAVE_STROPTS_H) && !defined(HAVE_DEV_PTC)
93889388
ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */
93899389
ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm */
93909390
#ifndef __hpux
93919391
ioctl(slave_fd, I_PUSH, "ttcompat"); /* push ttcompat */
93929392
#endif /* __hpux */
9393-
#endif /* HAVE_CYGWIN */
9393+
#endif /* defined(HAVE_STROPTS_H) && !defined(HAVE_DEV_PTC) */
93949394
#endif /* HAVE_OPENPTY */
93959395

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

configure

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

configure.ac

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

3024+
# On Linux, stropts.h may be empty
3025+
AC_MSG_CHECKING([for stropts.h])
3026+
AC_COMPILE_IFELSE([
3027+
AC_LANG_PROGRAM([[
3028+
#include <sys/types.h>
3029+
#include <stropts.h>
3030+
]], [[
3031+
#if !defined(I_PUSH)
3032+
#error I_PUSH
3033+
#endif
3034+
]]
3035+
)],
3036+
[
3037+
AC_MSG_RESULT([yes])
3038+
AC_DEFINE([HAVE_STROPTS_H], [1], [Define to 1 if you have the <stropts.h> header file.])
3039+
],
3040+
[AC_MSG_RESULT([no])])
3041+
30243042
# bluetooth/bluetooth.h has been known to not compile with -std=c99.
30253043
# http://permalink.gmane.org/gmane.linux.bluez.kernel/22294
30263044
SAVE_CFLAGS=$CFLAGS

0 commit comments

Comments
 (0)