From 12a0c93433a0b1d7e8019fc35a63476db39327fa Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 24 Oct 2012 16:44:34 +0200 Subject: Fix ttyname problem on Android. * configure.ac: Define macro and conditional HAVE_ANDROID_SYSTEM. * m4/gnupg-ttyname.m4: Force use of replacement on Android. * src/ttyname_r.c: Ditto. -- Android's bionic lib has no working ttyname_r() nor ttyname(). Using them anyway will print FIX ME! implement ttyname_r() bionic/libc/bionic/stubs.c:466 Thus we force the use of our replacement code which simply return "/dev/tty". --- m4/gnupg-ttyname.m4 | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'm4') diff --git a/m4/gnupg-ttyname.m4 b/m4/gnupg-ttyname.m4 index d9a0e2e0..c76115a4 100644 --- a/m4/gnupg-ttyname.m4 +++ b/m4/gnupg-ttyname.m4 @@ -27,6 +27,9 @@ # The macro REPLACE_TTYNAME_R is defined if ttyname_r is a replacement # function. This macro is useful for the definition of the prototype. # +# If the macro "have_android_system" has a value of "yes", ttyname_r +# will also be replaced by our own function. +# AC_DEFUN([gnupg_REPLACE_TTYNAME_R], [ AC_CHECK_HEADERS([unistd.h]) @@ -60,6 +63,12 @@ AC_DEFUN([gnupg_REPLACE_TTYNAME_R], if test $gnupg_cv_func_ttyname_r_posix = no; then AC_LIBOBJ([ttyname_r]) AC_DEFINE([REPLACE_TTYNAME_R],[1]) + elif test "$have_android_system" = yes; then + # Android has ttyname and ttyname_r but they are only stubs and + # print an annoying warning message. Thus we need to replace + # ttyname_r with our own dummy function. + AC_LIBOBJ([ttyname_r]) + AC_DEFINE([REPLACE_TTYNAME_R],[1]) else AC_DEFINE([HAVE_POSIXDECL_TTYNAME_R], [1], [Define if the ttyname_r function has a POSIX compliant declaration.]) -- cgit v1.2.3