2 dnl Copyright (C) 2002-2003, 2005-2006, 2009-2011 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([gl_FUNC_GETPASS],
11 dnl Persuade Solaris <unistd.h> and <stdlib.h> to declare getpass().
12 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
14 AC_REPLACE_FUNCS([getpass])
15 AC_CHECK_DECLS_ONCE([getpass])
16 if test $ac_cv_func_getpass = no; then
21 # Provide the GNU getpass() implementation. It supports passwords of
22 # arbitrary length (not just 8 bytes as on HP-UX).
23 AC_DEFUN([gl_FUNC_GETPASS_GNU],
25 dnl Persuade Solaris <unistd.h> and <stdlib.h> to declare getpass().
26 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
28 AC_CHECK_DECLS_ONCE([getpass])
29 dnl TODO: Detect when GNU getpass() is already found in glibc.
32 dnl We must choose a different name for our function, since on ELF systems
33 dnl an unusable getpass() in libc.so would override our getpass() if it is
34 dnl compiled into a shared library.
35 AC_DEFINE([getpass], [gnu_getpass],
36 [Define to a replacement function name for getpass().])
39 # Prerequisites of lib/getpass.c.
40 AC_DEFUN([gl_PREREQ_GETPASS], [
41 AC_CHECK_HEADERS_ONCE([stdio_ext.h termios.h])
42 AC_CHECK_FUNCS_ONCE([__fsetlocking tcgetattr tcsetattr])
43 AC_CHECK_DECLS([__fsetlocking],,,
46 #include <stdio_ext.h>
48 AC_CHECK_DECLS_ONCE([fflush_unlocked])
49 AC_CHECK_DECLS_ONCE([flockfile])
50 AC_CHECK_DECLS_ONCE([fputs_unlocked])
51 AC_CHECK_DECLS_ONCE([funlockfile])
52 AC_CHECK_DECLS_ONCE([putc_unlocked])