*** empty log message ***
[coreutils.git] / m4 / jm-winsz1.m4
blob0fcb46c754fef8e3412d15d52a1ce5a78c7ab44f
1 #serial 6
2 dnl From Jim Meyering and Paul Eggert.
3 AC_DEFUN([jm_HEADER_TIOCGWINSZ_IN_TERMIOS_H],
4 [AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
5  AC_CACHE_CHECK([whether use of TIOCGWINSZ requires termios.h],
6                 jm_cv_sys_tiocgwinsz_needs_termios_h,
7   [jm_cv_sys_tiocgwinsz_needs_termios_h=no
9    if test $ac_cv_sys_posix_termios = yes; then
10      AC_EGREP_CPP([yes],
11      [#include <sys/types.h>
12 #      include <termios.h>
13 #      ifdef TIOCGWINSZ
14          yes
15 #      endif
16      ], jm_cv_sys_tiocgwinsz_needs_termios_h=yes)
17    fi
18   ])
21 AC_DEFUN([jm_WINSIZE_IN_PTEM],
22   [AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
23    AC_CACHE_CHECK([whether use of struct winsize requires sys/ptem.h],
24      jm_cv_sys_struct_winsize_needs_sys_ptem_h,
25      [jm_cv_sys_struct_winsize_needs_sys_ptem_h=yes
26       if test $ac_cv_sys_posix_termios = yes; then
27         AC_TRY_COMPILE([#include <termios.h>]
28           [struct winsize x;],
29           [jm_cv_sys_struct_winsize_needs_sys_ptem_h=no])
30       fi
31       if test $jm_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
32         AC_TRY_COMPILE([#include <sys/ptem.h>],
33           [struct winsize x;],
34           [], [jm_cv_sys_struct_winsize_needs_sys_ptem_h=no])
35       fi])
36    if test $jm_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
37      AC_DEFINE([WINSIZE_IN_PTEM], 1,
38        [Define if sys/ptem.h is required for struct winsize.])
39    fi])