Bump to 1.14.1
[platform/upstream/augeas.git] / m4 / getpass.m4
1 # getpass.m4 serial 14
2 dnl Copyright (C) 2002-2003, 2005-2006, 2009-2016 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   dnl Persuade Solaris <unistd.h> and <stdlib.h> to declare getpass().
12   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
13
14   AC_CHECK_FUNCS([getpass])
15   AC_CHECK_DECLS_ONCE([getpass])
16   if test $ac_cv_func_getpass = yes; then
17     HAVE_GETPASS=1
18   else
19     HAVE_GETPASS=0
20   fi
21 ])
22
23 # Provide the GNU getpass() implementation. It supports passwords of
24 # arbitrary length (not just 8 bytes as on HP-UX).
25 AC_DEFUN([gl_FUNC_GETPASS_GNU],
26 [
27   dnl Persuade Solaris <unistd.h> and <stdlib.h> to declare getpass().
28   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
29
30   AC_CHECK_DECLS_ONCE([getpass])
31   dnl TODO: Detect when GNU getpass() is already found in glibc.
32   REPLACE_GETPASS=1
33
34   if test $REPLACE_GETPASS = 1; then
35     dnl We must choose a different name for our function, since on ELF systems
36     dnl an unusable getpass() in libc.so would override our getpass() if it is
37     dnl compiled into a shared library.
38     AC_DEFINE([getpass], [gnu_getpass],
39       [Define to a replacement function name for getpass().])
40   fi
41 ])
42
43 # Prerequisites of lib/getpass.c.
44 AC_DEFUN([gl_PREREQ_GETPASS], [
45   AC_CHECK_HEADERS_ONCE([stdio_ext.h termios.h])
46   AC_CHECK_FUNCS_ONCE([__fsetlocking tcgetattr tcsetattr])
47   AC_CHECK_DECLS([__fsetlocking],,,
48     [[#include <stdio.h>
49       #if HAVE_STDIO_EXT_H
50        #include <stdio_ext.h>
51       #endif]])
52   AC_CHECK_DECLS_ONCE([fflush_unlocked])
53   AC_CHECK_DECLS_ONCE([flockfile])
54   AC_CHECK_DECLS_ONCE([fputs_unlocked])
55   AC_CHECK_DECLS_ONCE([funlockfile])
56   AC_CHECK_DECLS_ONCE([putc_unlocked])
57   :
58 ])