maint: update copyright
[gnulib.git] / m4 / jm-winsz1.m4
1 # serial 11
2
3 # Copyright (C) 1996, 1999, 2001-2002, 2004, 2006, 2009-2014 Free Software
4 # Foundation, 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.
8
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
15
16    if test $ac_cv_sys_posix_termios = yes; then
17      AC_EGREP_CPP([yes],
18      [#include <sys/types.h>
19 #      include <termios.h>
20 #      ifdef TIOCGWINSZ
21          yes
22 #      endif
23      ], gl_cv_sys_tiocgwinsz_needs_termios_h=yes)
24    fi
25   ])
26 ])
27
28 AC_DEFUN([gl_WINSIZE_IN_PTEM],
29   [AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
30    AC_CACHE_CHECK([whether use of struct winsize requires sys/ptem.h],
31      gl_cv_sys_struct_winsize_needs_sys_ptem_h,
32      [gl_cv_sys_struct_winsize_needs_sys_ptem_h=yes
33       if test $ac_cv_sys_posix_termios = yes; then
34         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <termios.h>]],
35           [[struct winsize x;
36             if (sizeof x > 0) return 0;]])],
37           [gl_cv_sys_struct_winsize_needs_sys_ptem_h=no])
38       fi
39       if test $gl_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
40         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/ptem.h>]],
41           [[struct winsize x;
42             if (sizeof x > 0) return 0;]])],
43           [], [gl_cv_sys_struct_winsize_needs_sys_ptem_h=no])
44       fi])
45    if test $gl_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
46      AC_DEFINE([WINSIZE_IN_PTEM], [1],
47        [Define if sys/ptem.h is required for struct winsize.])
48    fi])