phunix/crypto/external/bsd/heimdal/dist/cf/check-getpwnam_r-posix.m4
Lionel Sambuc 0a6a1f1d05 NetBSD re-synchronization of the source tree
This brings our tree to NetBSD 7.0, as found on -current on the
10-10-2015.

This updates:
 - LLVM to 3.6.1
 - GCC to GCC 5.1
 - Replace minix/commands/zdump with usr.bin/zdump
 - external/bsd/libelf has moved to /external/bsd/elftoolchain/
 - Import ctwm
 - Drop sprintf from libminc

Change-Id: I149836ac18e9326be9353958bab9b266efb056f0
2016-01-13 20:32:14 +01:00

41 lines
1.3 KiB
Plaintext

dnl Id
dnl
dnl check for getpwnam_r, and if it's posix or not
AC_DEFUN([AC_CHECK_GETPWNAM_R_POSIX],[
AC_FIND_FUNC_NO_LIBS(getpwnam_r,c_r)
if test "$ac_cv_func_getpwnam_r" = yes; then
AC_CACHE_CHECK(if getpwnam_r is posix,ac_cv_func_getpwnam_r_posix,
ac_libs="$LIBS"
LIBS="$LIBS $LIB_getpwnam_r"
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#define _POSIX_PTHREAD_SEMANTICS
#include <pwd.h>
int main(int argc, char **argv)
{
struct passwd pw, *pwd;
return getpwnam_r("", &pw, 0, 0, &pwd) < 0;
}
]])],[ac_cv_func_getpwnam_r_posix=yes],[ac_cv_func_getpwnam_r_posix=no],[:])
LIBS="$ac_libs")
AC_CACHE_CHECK(if _POSIX_PTHREAD_SEMANTICS is needed,ac_cv_func_getpwnam_r_posix_def,
ac_libs="$LIBS"
LIBS="$LIBS $LIB_getpwnam_r"
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <pwd.h>
int main(int argc, char **argv)
{
struct passwd pw, *pwd;
return getpwnam_r("", &pw, 0, 0, &pwd) < 0;
}
]])],[ac_cv_func_getpwnam_r_posix_def=no],[ac_cv_func_getpwnam_r_posix_def=yes],[:])
LIBS="$ac_libs")
if test "$ac_cv_func_getpwnam_r_posix" = yes; then
AC_DEFINE(POSIX_GETPWNAM_R, 1, [Define if getpwnam_r has POSIX flavour.])
fi
if test "$ac_cv_func_getpwnam_r_posix" = yes -a "$ac_cv_func_getpwnam_r_posix_def" = yes; then
AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to get POSIX getpwnam_r in some systems.])
fi
fi
])