*** empty log message ***
[coreutils.git] / m4 / jm-winsz1.m4
blobce5eca00e30fa70d6ca00b96011b1563837a4535
1 #serial 8
3 # Copyright (C) 1996, 1999, 2001, 2002, 2004 Free Software Foundation, Inc.
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
8 dnl From Jim Meyering and Paul Eggert.
9 AC_DEFUN([gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H],
10 [AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
11  AC_CACHE_CHECK([whether use of TIOCGWINSZ requires termios.h],
12                 jm_cv_sys_tiocgwinsz_needs_termios_h,
13   [jm_cv_sys_tiocgwinsz_needs_termios_h=no
15    if test $ac_cv_sys_posix_termios = yes; then
16      AC_EGREP_CPP([yes],
17      [#include <sys/types.h>
18 #      include <termios.h>
19 #      ifdef TIOCGWINSZ
20          yes
21 #      endif
22      ], jm_cv_sys_tiocgwinsz_needs_termios_h=yes)
23    fi
24   ])
27 AC_DEFUN([gl_WINSIZE_IN_PTEM],
28   [AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
29    AC_CACHE_CHECK([whether use of struct winsize requires sys/ptem.h],
30      jm_cv_sys_struct_winsize_needs_sys_ptem_h,
31      [jm_cv_sys_struct_winsize_needs_sys_ptem_h=yes
32       if test $ac_cv_sys_posix_termios = yes; then
33         AC_TRY_COMPILE([#include <termios.h>]
34           [struct winsize x;],
35           [jm_cv_sys_struct_winsize_needs_sys_ptem_h=no])
36       fi
37       if test $jm_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
38         AC_TRY_COMPILE([#include <sys/ptem.h>],
39           [struct winsize x;],
40           [], [jm_cv_sys_struct_winsize_needs_sys_ptem_h=no])
41       fi])
42    if test $jm_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
43      AC_DEFINE([WINSIZE_IN_PTEM], 1,
44        [Define if sys/ptem.h is required for struct winsize.])
45    fi])