autoconf: utilize HAVE_SYS_IOCTL_COMPAT_H HAVE_TERMIO_H

This commit is contained in:
Darryl L. Miles 2025-07-17 20:57:25 +01:00 committed by R. Timothy Edwards
parent 92b4d6a1f7
commit 4aee95e092
2 changed files with 16 additions and 3 deletions

View File

@ -44,10 +44,17 @@ typedef struct {
/* all of the state associated with a tty terminal */ /* all of the state associated with a tty terminal */
#if !defined(SYSV) && !defined(CYGWIN) && !defined(__OpenBSD__) && !defined(EMSCRIPTEN) #if !defined(SYSV) && !defined(CYGWIN) && !defined(__OpenBSD__) && !defined(EMSCRIPTEN)
#if defined(HAVE_SYS_IOCTL_COMPAT_H) || defined(HAVE_SGTTY_H)
#if defined(HAVE_SYS_IOCTL_COMPAT_H)
#include <sys/ioctl_compat.h> /* replaced sgtty.h */
#elif defined(HAVE_SGTTY_H)
#include <sgtty.h>/* legacy - struct sgttyb{} defn */
#endif
typedef struct { typedef struct {
struct sgttyb tx_i_sgtty; struct sgttyb tx_i_sgtty;
struct tchars tx_i_tchars; struct tchars tx_i_tchars;
} txTermState; } txTermState;
#endif /* HAVE_SYS_IOCTL_COMPAT_H || HAVE_SGTTY_H */
#endif /* SYSV */ #endif /* SYSV */
extern bool TxGetInputEvent(bool block, bool returnOnSigWinch); extern bool TxGetInputEvent(bool block, bool returnOnSigWinch);

View File

@ -38,9 +38,9 @@
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
#ifdef HAVE_TERMIOS_H #if defined(HAVE_TERMIOS_H)
#include <termios.h> #include <termios.h>
#else #elif defined(HAVE_SYS_IOCTL_COMPAT_H)
/* unclear which platform(s) require <sys/ioctl_compat.h> and the structure /* unclear which platform(s) require <sys/ioctl_compat.h> and the structure
* of this file is such that it will try to include it by default, better * of this file is such that it will try to include it by default, better
* to invert the #if and only select this on the known platforms that need * to invert the #if and only select this on the known platforms that need
@ -48,11 +48,17 @@
* many possible solutions to make this work by default: * many possible solutions to make this work by default:
* HAVE_SYS_IOCTL_COMPAT_H ? HAVE_TERMIOS_H ? !defined(linux) at top (MaxOSX is BSD type) * HAVE_SYS_IOCTL_COMPAT_H ? HAVE_TERMIOS_H ? !defined(linux) at top (MaxOSX is BSD type)
*/ */
#include <sys/ioctl_compat.h> #include <sys/ioctl_compat.h> /* replaced sgtty.h */
#elif defined(HAVE_SGTTY_H)
#include <sgtty.h> /* legacy - struct sgttyb{} defn */
#endif #endif
#else #else
#if defined(HAVE_TERMIO_H)
#include <termio.h> #include <termio.h>
#endif #endif
#endif /* !SYSV && !CYGWIN */
#endif /* _MAGIC__UTILS__MAGSGTTY_H */ #endif /* _MAGIC__UTILS__MAGSGTTY_H */