Add check for getlogin_r()

This commit is contained in:
Nicolas Williams
2017-10-12 23:39:59 -05:00
committed by Nico Williams
parent 784637709b
commit a988692434
2 changed files with 17 additions and 1 deletions

View File

@@ -6,7 +6,7 @@ dnl
AC_DEFUN([AC_FUNC_GETLOGIN], [
AC_CHECK_FUNCS(getlogin setlogin)
AC_CHECK_FUNCS(getlogin getlogin_r setlogin)
if test "$ac_cv_func_getlogin" = yes; then
AC_CACHE_CHECK(if getlogin is posix, ac_cv_func_getlogin_posix, [
if test "$ac_cv_func_getlogin" = yes -a "$ac_cv_func_setlogin" = yes; then
@@ -15,8 +15,18 @@ else
ac_cv_func_getlogin_posix=yes
fi
])
AC_CACHE_CHECK(if getlogin_r is posix, ac_cv_func_getlogin_r_posix, [
if test "$ac_cv_func_getlogin_r" = yes -a "$ac_cv_func_setlogin" = yes; then
ac_cv_func_getlogin_r_posix=no
else
ac_cv_func_getlogin_r_posix=yes
fi
])
if test "$ac_cv_func_getlogin_posix" = yes; then
AC_DEFINE(POSIX_GETLOGIN, 1, [Define if getlogin has POSIX flavour (and not BSD).])
fi
if test "$ac_cv_func_getlogin_r_posix" = yes; then
AC_DEFINE(POSIX_GETLOGIN_R, 1, [Define if getlogin_r has POSIX flavour (and not BSD).])
fi
fi
])

View File

@@ -427,6 +427,9 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg }
/* Define to 1 if you have the `getlogin' function. */
/* #define HAVE_GETLOGIN 1 */
/* Define to 1 if you have the `getlogin_r' function. */
/* #define HAVE_GETLOGIN_R 1 */
/* Define if you have a working getmsg. */
/* #undef HAVE_GETMSG */
@@ -1357,6 +1360,9 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg }
/* Define if getlogin has POSIX flavour (and not BSD). */
/* #define POSIX_GETLOGIN 1 */
/* Define if getlogin_r has POSIX flavour (and not BSD). */
/* #define POSIX_GETLOGIN_R 1 */
/* Define if getpwnam_r has POSIX flavour. */
/* #define POSIX_GETPWNAM_R 1 */