Move more declarations into <unistd.h>.
[gnulib.git] / m4 / getlogin_r.m4
1 #serial 4
2
3 # Copyright (C) 2005, 2006, 2007 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_GETLOGIN_R],
15 [
16   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
17   AC_CHECK_FUNCS_ONCE([getlogin_r])
18   if test $ac_cv_func_getlogin_r = no; then
19     AC_LIBOBJ([getlogin_r])
20     gl_PREREQ_GETLOGIN_R
21     if test $ac_cv_have_decl_getlogin_r = yes; then
22       HAVE_DECL_GETLOGIN_R=1
23     else
24       HAVE_DECL_GETLOGIN_R=0
25     fi
26   fi
27 ])
28
29 AC_DEFUN([gl_PREREQ_GETLOGIN_R],
30 [
31   AC_CHECK_DECLS_ONCE([getlogin])
32   AC_CHECK_DECLS_ONCE([getlogin_r])
33 ])