diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-05 10:08:23 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-05 10:08:23 +0900 |
commit | c0c4ebc8462f91e7cf41e7404f71dca434b8494e (patch) | |
tree | 764f42c7258a7f83c64a1e75669b5694072cee20 /m4/getpass.m4 | |
parent | dfd19f19c019e044f97e46081a6960614c0cf3f9 (diff) | |
download | wget-c0c4ebc8462f91e7cf41e7404f71dca434b8494e.tar.gz wget-c0c4ebc8462f91e7cf41e7404f71dca434b8494e.tar.bz2 wget-c0c4ebc8462f91e7cf41e7404f71dca434b8494e.zip |
Imported Upstream version 1.20upstream/1.20
Diffstat (limited to 'm4/getpass.m4')
-rw-r--r-- | m4/getpass.m4 | 90 |
1 files changed, 69 insertions, 21 deletions
diff --git a/m4/getpass.m4 b/m4/getpass.m4 index 8e502f0..b0b4278 100644 --- a/m4/getpass.m4 +++ b/m4/getpass.m4 @@ -1,4 +1,4 @@ -# getpass.m4 serial 14 +# getpass.m4 serial 16 dnl Copyright (C) 2002-2003, 2005-2006, 2009-2018 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -6,16 +6,15 @@ dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. # Provide a getpass() function if the system doesn't have it. -AC_DEFUN([gl_FUNC_GETPASS], +AC_DEFUN_ONCE([gl_FUNC_GETPASS], [ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + dnl Persuade Solaris <unistd.h> and <stdlib.h> to declare getpass(). AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - AC_CHECK_FUNCS([getpass]) - AC_CHECK_DECLS_ONCE([getpass]) - if test $ac_cv_func_getpass = yes; then - HAVE_GETPASS=1 - else + AC_CHECK_FUNCS_ONCE([getpass]) + if test $ac_cv_func_getpass = no; then HAVE_GETPASS=0 fi ]) @@ -24,26 +23,34 @@ AC_DEFUN([gl_FUNC_GETPASS], # arbitrary length (not just 8 bytes as on HP-UX). AC_DEFUN([gl_FUNC_GETPASS_GNU], [ - dnl Persuade Solaris <unistd.h> and <stdlib.h> to declare getpass(). - AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) - - AC_CHECK_DECLS_ONCE([getpass]) - dnl TODO: Detect when GNU getpass() is already found in glibc. - REPLACE_GETPASS=1 + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([gl_FUNC_GETPASS]) - if test $REPLACE_GETPASS = 1; then - dnl We must choose a different name for our function, since on ELF systems - dnl an unusable getpass() in libc.so would override our getpass() if it is - dnl compiled into a shared library. - AC_DEFINE([getpass], [gnu_getpass], - [Define to a replacement function name for getpass().]) + if test $ac_cv_func_getpass = yes; then + AC_CACHE_CHECK([for getpass without length limitations], + [gl_cv_func_getpass_good], + [AC_EGREP_CPP([Lucky GNU user], + [ +#include <features.h> +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ >= 2) && !defined __UCLIBC__ + Lucky GNU user + #endif +#endif + ], + [gl_cv_func_getpass_good=yes], + [gl_cv_func_getpass_good=no]) + ]) + if test $gl_cv_func_getpass_good != yes; then + REPLACE_GETPASS=1 + fi fi ]) # Prerequisites of lib/getpass.c. AC_DEFUN([gl_PREREQ_GETPASS], [ AC_CHECK_HEADERS_ONCE([stdio_ext.h termios.h]) - AC_CHECK_FUNCS_ONCE([__fsetlocking tcgetattr tcsetattr]) + AC_CHECK_FUNCS_ONCE([__fsetlocking]) AC_CHECK_DECLS([__fsetlocking],,, [[#include <stdio.h> #if HAVE_STDIO_EXT_H @@ -54,5 +61,46 @@ AC_DEFUN([gl_PREREQ_GETPASS], [ AC_CHECK_DECLS_ONCE([fputs_unlocked]) AC_CHECK_DECLS_ONCE([funlockfile]) AC_CHECK_DECLS_ONCE([putc_unlocked]) - : + + dnl We can't use AC_CHECK_FUNC here, because tcgetattr() is defined as a + dnl static inline function when compiling for Android 4.4 or older. + AC_CACHE_CHECK([for tcgetattr], [gl_cv_func_tcgetattr], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <termios.h> + struct termios x; + ]], + [[return tcgetattr(0,&x);]]) + ], + [gl_cv_func_tcgetattr=yes], + [gl_cv_func_tcgetattr=no]) + ]) + if test $gl_cv_func_tcgetattr = yes; then + HAVE_TCGETATTR=1 + else + HAVE_TCGETATTR=0 + fi + AC_DEFINE_UNQUOTED([HAVE_TCGETATTR], [$HAVE_TCGETATTR], + [Define to 1 if the system has the 'tcgetattr' function.]) + + dnl We can't use AC_CHECK_FUNC here, because tcsetattr() is defined as a + dnl static inline function when compiling for Android 4.4 or older. + AC_CACHE_CHECK([for tcsetattr], [gl_cv_func_tcsetattr], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <termios.h> + struct termios x; + ]], + [[return tcsetattr(0,0,&x);]]) + ], + [gl_cv_func_tcsetattr=yes], + [gl_cv_func_tcsetattr=no]) + ]) + if test $gl_cv_func_tcsetattr = yes; then + HAVE_TCSETATTR=1 + else + HAVE_TCSETATTR=0 + fi + AC_DEFINE_UNQUOTED([HAVE_TCSETATTR], [$HAVE_TCSETATTR], + [Define to 1 if the system has the 'tcsetattr' function.]) ]) |