-#serial 1
+#serial 7
-# Copyright (C) 2005 Free Software Foundation, Inc.
+# Copyright (C) 2005-2007, 2009-2010 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
dnl Provide getlogin_r when the system lacks it.
dnl
-AC_DEFUN([gl_GETLOGIN_R_SUBSTITUTE],
+AC_DEFUN([gl_FUNC_GETLOGIN_R],
[
- gl_PREREQ_GETLOGIN_R
- AC_LIBSOURCE([getlogin_r.h])
- AC_LIBOBJ([getlogin_r])
-])
+ AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-AC_DEFUN([gl_GETLOGIN_R],
-[
- AC_REPLACE_FUNCS([getlogin_r])
- if test $ac_cv_func_strcasecmp = no; then
- gl_GETLOGIN_R_SUBSTITUTE
+ dnl Persuade glibc <unistd.h> to declare getlogin_r().
+ dnl Persuade Solaris <unistd.h> to provide the POSIX compliant declaration of
+ dnl getlogin_r().
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+ AC_CHECK_FUNCS_ONCE([getlogin_r])
+ if test $ac_cv_func_getlogin_r = no; then
+ AC_LIBOBJ([getlogin_r])
+ gl_PREREQ_GETLOGIN_R
+ AC_CHECK_DECLS_ONCE([getlogin_r])
+ if test $ac_cv_have_decl_getlogin_r = no; then
+ HAVE_DECL_GETLOGIN_R=0
+ fi
fi
])
AC_DEFUN([gl_PREREQ_GETLOGIN_R],
[
- AC_CHECK_HEADERS_ONCE([unistd.h])
- AC_CHECK_DECLS_ONCE([getlogin getlogin_r])
+ AC_CHECK_DECLS_ONCE([getlogin])
])