2 dnl Copyright (C) 2002-2003, 2005-2006, 2009-2010 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 AC_REPLACE_FUNCS([getpass])
12 AC_CHECK_DECLS_ONCE([getpass])
13 if test $ac_cv_func_getpass = no; then
18 # Provide the GNU getpass() implementation. It supports passwords of
19 # arbitrary length (not just 8 bytes as on HP-UX).
20 AC_DEFUN([gl_FUNC_GETPASS_GNU],
22 AC_CHECK_DECLS_ONCE([getpass])
23 dnl TODO: Detect when GNU getpass() is already found in glibc.
26 dnl We must choose a different name for our function, since on ELF systems
27 dnl an unusable getpass() in libc.so would override our getpass() if it is
28 dnl compiled into a shared library.
29 AC_DEFINE([getpass], [gnu_getpass],
30 [Define to a replacement function name for getpass().])
33 # Prerequisites of lib/getpass.c.
34 AC_DEFUN([gl_PREREQ_GETPASS], [
35 AC_CHECK_HEADERS_ONCE([stdio_ext.h termios.h])
36 AC_CHECK_FUNCS_ONCE([__fsetlocking tcgetattr tcsetattr])
37 AC_CHECK_DECLS([__fsetlocking],,,
40 #include <stdio_ext.h>
42 AC_CHECK_DECLS_ONCE([fflush_unlocked])
43 AC_CHECK_DECLS_ONCE([flockfile])
44 AC_CHECK_DECLS_ONCE([fputs_unlocked])
45 AC_CHECK_DECLS_ONCE([funlockfile])
46 AC_CHECK_DECLS_ONCE([putc_unlocked])