3 # Copyright (C) 1996, 1999, 2001-2002, 2004, 2006, 2009-2020 Free Software
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
9 dnl From Jim Meyering and Paul Eggert.
10 AC_DEFUN([gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H],
11 [AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
12 AC_CACHE_CHECK([whether use of TIOCGWINSZ requires termios.h],
13 [gl_cv_sys_tiocgwinsz_needs_termios_h],
14 [gl_cv_sys_tiocgwinsz_needs_termios_h=no
16 if test $ac_cv_sys_posix_termios = yes; then
18 [#include <sys/types.h>
23 ], [gl_cv_sys_tiocgwinsz_needs_termios_h=yes])
28 AC_DEFUN([gl_WINSIZE_IN_PTEM],
30 AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
31 AC_CACHE_CHECK([whether use of struct winsize requires sys/ptem.h],
32 [gl_cv_sys_struct_winsize_needs_sys_ptem_h],
33 [gl_cv_sys_struct_winsize_needs_sys_ptem_h=yes
34 if test $ac_cv_sys_posix_termios = yes; then
35 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <termios.h>]],
37 if (sizeof x > 0) return 0;]])],
38 [gl_cv_sys_struct_winsize_needs_sys_ptem_h=no])
40 if test $gl_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
41 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/ptem.h>]],
43 if (sizeof x > 0) return 0;]])],
44 [], [gl_cv_sys_struct_winsize_needs_sys_ptem_h=no])
46 if test $gl_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
47 AC_DEFINE([WINSIZE_IN_PTEM], [1],
48 [Define if sys/ptem.h is required for struct winsize.])