2 dnl Copyright (C) 2002-2003, 2005-2006, 2009-2018 Free Software Foundation,
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.
8 # Provide a getpass() function if the system doesn't have it.
9 AC_DEFUN_ONCE([gl_FUNC_GETPASS],
11 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
13 dnl Persuade Solaris <unistd.h> and <stdlib.h> to declare getpass().
14 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
16 AC_CHECK_FUNCS_ONCE([getpass])
17 if test $ac_cv_func_getpass = no; then
22 # Provide the GNU getpass() implementation. It supports passwords of
23 # arbitrary length (not just 8 bytes as on HP-UX).
24 AC_DEFUN([gl_FUNC_GETPASS_GNU],
26 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
27 AC_REQUIRE([gl_FUNC_GETPASS])
29 if test $ac_cv_func_getpass = yes; then
30 AC_CACHE_CHECK([for getpass without length limitations],
31 [gl_cv_func_getpass_good],
32 [AC_EGREP_CPP([Lucky GNU user],
35 #ifdef __GNU_LIBRARY__
36 #if (__GLIBC__ >= 2) && !defined __UCLIBC__
41 [gl_cv_func_getpass_good=yes],
42 [gl_cv_func_getpass_good=no])
44 if test $gl_cv_func_getpass_good != yes; then
50 # Prerequisites of lib/getpass.c.
51 AC_DEFUN([gl_PREREQ_GETPASS], [
52 AC_CHECK_HEADERS_ONCE([stdio_ext.h termios.h])
53 AC_CHECK_FUNCS_ONCE([__fsetlocking])
54 AC_CHECK_DECLS([__fsetlocking],,,
57 #include <stdio_ext.h>
59 AC_CHECK_DECLS_ONCE([fflush_unlocked])
60 AC_CHECK_DECLS_ONCE([flockfile])
61 AC_CHECK_DECLS_ONCE([fputs_unlocked])
62 AC_CHECK_DECLS_ONCE([funlockfile])
63 AC_CHECK_DECLS_ONCE([putc_unlocked])
65 dnl We can't use AC_CHECK_FUNC here, because tcgetattr() is defined as a
66 dnl static inline function when compiling for Android 4.4 or older.
67 AC_CACHE_CHECK([for tcgetattr], [gl_cv_func_tcgetattr],
70 [[#include <termios.h>
73 [[return tcgetattr(0,&x);]])
75 [gl_cv_func_tcgetattr=yes],
76 [gl_cv_func_tcgetattr=no])
78 if test $gl_cv_func_tcgetattr = yes; then
83 AC_DEFINE_UNQUOTED([HAVE_TCGETATTR], [$HAVE_TCGETATTR],
84 [Define to 1 if the system has the 'tcgetattr' function.])
86 dnl We can't use AC_CHECK_FUNC here, because tcsetattr() is defined as a
87 dnl static inline function when compiling for Android 4.4 or older.
88 AC_CACHE_CHECK([for tcsetattr], [gl_cv_func_tcsetattr],
91 [[#include <termios.h>
94 [[return tcsetattr(0,0,&x);]])
96 [gl_cv_func_tcsetattr=yes],
97 [gl_cv_func_tcsetattr=no])
99 if test $gl_cv_func_tcsetattr = yes; then
104 AC_DEFINE_UNQUOTED([HAVE_TCSETATTR], [$HAVE_TCSETATTR],
105 [Define to 1 if the system has the 'tcsetattr' function.])