1*15bc7eafSchristosdnl Id 2*15bc7eafSchristosdnl 3*15bc7eafSchristosdnl check for getpwuid_r, and if it's posix or not 4*15bc7eafSchristos 5*15bc7eafSchristosAC_DEFUN([AC_CHECK_GETPWUID_R_POSIX],[ 6*15bc7eafSchristosAC_FIND_FUNC_NO_LIBS(getpwuid_r,c_r) 7*15bc7eafSchristosif test "$ac_cv_func_getpwuid_r" = yes; then 8*15bc7eafSchristos AC_CACHE_CHECK(if getpwuid_r is posix,ac_cv_func_getpwuid_r_posix, 9*15bc7eafSchristos ac_libs="$LIBS" 10*15bc7eafSchristos LIBS="$LIBS $LIB_getpwuid_r" 11*15bc7eafSchristos AC_RUN_IFELSE([AC_LANG_SOURCE([[ 12*15bc7eafSchristos#define _POSIX_PTHREAD_SEMANTICS 13*15bc7eafSchristos#include <pwd.h> 14*15bc7eafSchristosint main(int argc, char **argv) 15*15bc7eafSchristos{ 16*15bc7eafSchristos struct passwd pw, *pwd; 17*15bc7eafSchristos return getpwuid_r(0, &pw, 0, 0, &pwd) < 0; 18*15bc7eafSchristos} 19*15bc7eafSchristos]])],[ac_cv_func_getpwuid_r_posix=yes],[ac_cv_func_getpwuid_r_posix=no],[:]) 20*15bc7eafSchristosLIBS="$ac_libs") 21*15bc7eafSchristos AC_CACHE_CHECK(if _POSIX_PTHREAD_SEMANTICS is needed,ac_cv_func_getpwuid_r_posix_def, 22*15bc7eafSchristos ac_libs="$LIBS" 23*15bc7eafSchristos LIBS="$LIBS $LIB_getpwuid_r" 24*15bc7eafSchristos AC_RUN_IFELSE([AC_LANG_SOURCE([[ 25*15bc7eafSchristos#include <pwd.h> 26*15bc7eafSchristosint main(int argc, char **argv) 27*15bc7eafSchristos{ 28*15bc7eafSchristos struct passwd pw, *pwd; 29*15bc7eafSchristos return getpwuid_r(0, &pw, 0, 0, &pwd) < 0; 30*15bc7eafSchristos} 31*15bc7eafSchristos]])],[ac_cv_func_getpwuid_r_posix_def=no],[ac_cv_func_getpwuid_r_posix_def=yes],[:]) 32*15bc7eafSchristosLIBS="$ac_libs") 33*15bc7eafSchristosif test "$ac_cv_func_getpwuid_r_posix" = yes; then 34*15bc7eafSchristos AC_DEFINE(POSIX_GETPWUID_R, 1, [Define if getpwuid_r has POSIX flavour.]) 35*15bc7eafSchristosfi 36*15bc7eafSchristosif test "$ac_cv_func_getpwuid_r_posix" = yes -a "$ac_cv_func_getpwuid_r_posix_def" = yes; then 37*15bc7eafSchristos AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to get POSIX getpwuid_r in some systems.]) 38*15bc7eafSchristosfi 39*15bc7eafSchristosfi 40*15bc7eafSchristos]) 41