Do the Windows oldnames workaround through the C++ GNULIB_NAMESPACE.
[gnulib.git] / m4 / jm-winsz1.m4
blob3c2b2c5dcc4a24b5eee3c7eb0c3c0870a5d067a2
1 # serial 12
3 # Copyright (C) 1996, 1999, 2001-2002, 2004, 2006, 2009-2020 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.
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
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   ])
28 AC_DEFUN([gl_WINSIZE_IN_PTEM],
30    AC_REQUIRE([AC_SYS_POSIX_TERMIOS])
31    AC_CACHE_CHECK([whether use of struct winsize requires sys/ptem.h],
32      [gl_cv_sys_struct_winsize_needs_sys_ptem_h],
33      [gl_cv_sys_struct_winsize_needs_sys_ptem_h=yes
34       if test $ac_cv_sys_posix_termios = yes; then
35         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <termios.h>]],
36           [[struct winsize x;
37             if (sizeof x > 0) return 0;]])],
38           [gl_cv_sys_struct_winsize_needs_sys_ptem_h=no])
39       fi
40       if test $gl_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
41         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/ptem.h>]],
42           [[struct winsize x;
43             if (sizeof x > 0) return 0;]])],
44           [], [gl_cv_sys_struct_winsize_needs_sys_ptem_h=no])
45       fi])
46    if test $gl_cv_sys_struct_winsize_needs_sys_ptem_h = yes; then
47      AC_DEFINE([WINSIZE_IN_PTEM], [1],
48        [Define if sys/ptem.h is required for struct winsize.])
49    fi