stat: Update regarding AIX.
[gnulib.git] / m4 / getpass.m4
1 # getpass.m4 serial 11
2 dnl Copyright (C) 2002-2003, 2005-2006, 2009-2010 Free Software Foundation,
3 dnl 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
8 # Provide a getpass() function if the system doesn't have it.
9 AC_DEFUN([gl_FUNC_GETPASS],
10 [
11   AC_REPLACE_FUNCS([getpass])
12   AC_CHECK_DECLS_ONCE([getpass])
13   if test $ac_cv_func_getpass = no; then
14     gl_PREREQ_GETPASS
15   fi
16 ])
17
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],
21 [
22   AC_CHECK_DECLS_ONCE([getpass])
23   dnl TODO: Detect when GNU getpass() is already found in glibc.
24   AC_LIBOBJ([getpass])
25   gl_PREREQ_GETPASS
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().])
31 ])
32
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],,,
38     [#include <stdio.h>
39      #if HAVE_STDIO_EXT_H
40       #include <stdio_ext.h>
41      #endif])
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])
47   :
48 ])