realloc: more improvements for realloc (p, 0)
[gnulib.git] / m4 / getlogin.m4
blob8bbae8ed49c7cd9b64781bbdeb30c2cd863cae23
1 # getlogin.m4
2 # serial 7
3 dnl Copyright (C) 2010-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7 dnl This file is offered as-is, without any warranty.
9 AC_DEFUN([gl_FUNC_GETLOGIN],
11   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
12   AC_CHECK_DECLS_ONCE([getlogin])
13   if test $ac_cv_have_decl_getlogin = no; then
14     HAVE_DECL_GETLOGIN=0
15   fi
16   AC_CHECK_FUNCS_ONCE([getlogin])
17   if test $ac_cv_func_getlogin = no; then
18     HAVE_GETLOGIN=0
19   fi
22 dnl Determines the library needed by the implementation of the
23 dnl getlogin and getlogin_r functions.
24 AC_DEFUN([gl_LIB_GETLOGIN],
26   AC_REQUIRE([AC_CANONICAL_HOST])
27   case $host_os in
28     mingw* | windows*)
29       GETLOGIN_LIB='-ladvapi32' ;;
30     *)
31       GETLOGIN_LIB= ;;
32   esac
33   AC_SUBST([GETLOGIN_LIB])
34   dnl For backward compatibility.
35   LIB_GETLOGIN="$GETLOGIN_LIB"
36   AC_SUBST([LIB_GETLOGIN])