copied from automake-1.1l
[gnulib.git] / m4 / winsz.m4
1 dnl From Jim Meyering.
2
3 # serial 1
4
5 AC_DEFUN(AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL,
6 [AC_REQUIRE([AM_SYS_POSIX_TERMIOS])
7  AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
8                 am_cv_sys_tiocgwinsz_needs_sys_ioctl_h,
9   [am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
10
11   gwinsz_in_termios_h=no
12   if test $am_cv_sys_posix_termios = yes; then
13     AC_EGREP_CPP([yes],
14     [#include <sys/types.h>
15 #     include <termios.h>
16 #     ifdef TIOCGWINSZ
17         yes
18 #     endif
19     ], gwinsz_in_termios_h=yes)
20   fi
21
22   if test $gwinsz_in_termios_h = no; then
23     AC_EGREP_CPP([yes],
24     [#include <sys/types.h>
25 #     include <sys/ioctl.h>
26 #     ifdef TIOCGWINSZ
27         yes
28 #     endif
29     ], am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
30   fi
31   ])
32   if test $am_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
33     AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
34   fi
35 ])