| 1 |
# tcgetattr.m4 |
| 2 |
# serial 1 |
| 3 |
dnl Copyright (C) 2002-2024 Free Software Foundation, Inc. |
| 4 |
dnl This file is free software; the Free Software Foundation |
| 5 |
dnl gives unlimited permission to copy and/or distribute it, |
| 6 |
dnl with or without modifications, as long as this notice is preserved. |
| 7 |
dnl This file is offered as-is, without any warranty. |
| 8 |
|
| 9 |
AC_DEFUN([gl_HAVE_TCGETATTR], |
| 10 |
[ |
| 11 |
dnl We can't use AC_CHECK_FUNC here, because tcgetattr() is defined as a |
| 12 |
dnl static inline function when compiling for Android 4.4 or older. |
| 13 |
AC_CACHE_CHECK([for tcgetattr], [gl_cv_func_tcgetattr], |
| 14 |
[AC_LINK_IFELSE( |
| 15 |
[AC_LANG_PROGRAM( |
| 16 |
[[#include <termios.h> |
| 17 |
struct termios x; |
| 18 |
]], |
| 19 |
[[return tcgetattr(0,&x);]]) |
| 20 |
], |
| 21 |
[gl_cv_func_tcgetattr=yes], |
| 22 |
[gl_cv_func_tcgetattr=no]) |
| 23 |
]) |
| 24 |
if test $gl_cv_func_tcgetattr = yes; then |
| 25 |
HAVE_TCGETATTR=1 |
| 26 |
else |
| 27 |
HAVE_TCGETATTR=0 |
| 28 |
fi |
| 29 |
AC_DEFINE_UNQUOTED([HAVE_TCGETATTR], [$HAVE_TCGETATTR], |
| 30 |
[Define to 1 if the system has the 'tcgetattr' function.]) |
| 31 |
]) |