immutable: Add tests.
[gnulib.git] / m4 / jm-winsz2.m4
blobed839cb879998d50e9419824883dd95a3cb6237c
1 # serial 8
3 # Copyright (C) 1996, 1999, 2001, 2004, 2009-2021 Free Software Foundation,
4 # Inc.
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 AC_DEFUN([gl_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL],
10 [AC_REQUIRE([gl_HEADER_TIOCGWINSZ_IN_TERMIOS_H])
11  AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
12                 [gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h],
13   [gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
15    if test $gl_cv_sys_tiocgwinsz_needs_termios_h = no; then
16      AC_EGREP_CPP([yes],
17        [#include <sys/types.h>
18 #        include <sys/ioctl.h>
19 #        ifdef TIOCGWINSZ
20            yes
21 #        endif
22        ], [gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes])
23    fi
24   ])
25   if test $gl_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
26     AC_DEFINE([GWINSZ_IN_SYS_IOCTL], [1],
27       [Define if your system defines TIOCGWINSZ in sys/ioctl.h.])
28   fi