striconveh: Simplify last commit.
[gnulib.git] / m4 / getlogin_r.m4
1 #serial 7
2
3 # Copyright (C) 2005-2007, 2009-2010 Free Software Foundation, Inc.
4 #
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 dnl From Derek Price
10 dnl
11 dnl Provide getlogin_r when the system lacks it.
12 dnl
13
14 AC_DEFUN([gl_FUNC_GETLOGIN_R],
15 [
16   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
17
18   dnl Persuade glibc <unistd.h> to declare getlogin_r().
19   dnl Persuade Solaris <unistd.h> to provide the POSIX compliant declaration of
20   dnl getlogin_r().
21   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
22
23   AC_CHECK_FUNCS_ONCE([getlogin_r])
24   if test $ac_cv_func_getlogin_r = no; then
25     AC_LIBOBJ([getlogin_r])
26     gl_PREREQ_GETLOGIN_R
27     AC_CHECK_DECLS_ONCE([getlogin_r])
28     if test $ac_cv_have_decl_getlogin_r = no; then
29       HAVE_DECL_GETLOGIN_R=0
30     fi
31   fi
32 ])
33
34 AC_DEFUN([gl_PREREQ_GETLOGIN_R],
35 [
36   AC_CHECK_DECLS_ONCE([getlogin])
37 ])