1ebfedea0SLionel Sambucdnl Id 2ebfedea0SLionel Sambucdnl 3ebfedea0SLionel Sambucdnl check for getpwnam_r, and if it's posix or not 4ebfedea0SLionel Sambuc 5ebfedea0SLionel SambucAC_DEFUN([AC_CHECK_GETPWNAM_R_POSIX],[ 6ebfedea0SLionel SambucAC_FIND_FUNC_NO_LIBS(getpwnam_r,c_r) 7ebfedea0SLionel Sambucif test "$ac_cv_func_getpwnam_r" = yes; then 8ebfedea0SLionel Sambuc AC_CACHE_CHECK(if getpwnam_r is posix,ac_cv_func_getpwnam_r_posix, 9ebfedea0SLionel Sambuc ac_libs="$LIBS" 10ebfedea0SLionel Sambuc LIBS="$LIBS $LIB_getpwnam_r" 11ebfedea0SLionel Sambuc AC_RUN_IFELSE([AC_LANG_SOURCE([[ 12ebfedea0SLionel Sambuc#define _POSIX_PTHREAD_SEMANTICS 13ebfedea0SLionel Sambuc#include <pwd.h> 14ebfedea0SLionel Sambucint main(int argc, char **argv) 15ebfedea0SLionel Sambuc{ 16ebfedea0SLionel Sambuc struct passwd pw, *pwd; 17*0a6a1f1dSLionel Sambuc return getpwnam_r("", &pw, 0, 0, &pwd) < 0; 18ebfedea0SLionel Sambuc} 19ebfedea0SLionel Sambuc]])],[ac_cv_func_getpwnam_r_posix=yes],[ac_cv_func_getpwnam_r_posix=no],[:]) 20ebfedea0SLionel SambucLIBS="$ac_libs") 21*0a6a1f1dSLionel Sambuc AC_CACHE_CHECK(if _POSIX_PTHREAD_SEMANTICS is needed,ac_cv_func_getpwnam_r_posix_def, 22*0a6a1f1dSLionel Sambuc ac_libs="$LIBS" 23*0a6a1f1dSLionel Sambuc LIBS="$LIBS $LIB_getpwnam_r" 24*0a6a1f1dSLionel Sambuc AC_RUN_IFELSE([AC_LANG_SOURCE([[ 25*0a6a1f1dSLionel Sambuc#include <pwd.h> 26*0a6a1f1dSLionel Sambucint main(int argc, char **argv) 27*0a6a1f1dSLionel Sambuc{ 28*0a6a1f1dSLionel Sambuc struct passwd pw, *pwd; 29*0a6a1f1dSLionel Sambuc return getpwnam_r("", &pw, 0, 0, &pwd) < 0; 30*0a6a1f1dSLionel Sambuc} 31*0a6a1f1dSLionel Sambuc]])],[ac_cv_func_getpwnam_r_posix_def=no],[ac_cv_func_getpwnam_r_posix_def=yes],[:]) 32*0a6a1f1dSLionel SambucLIBS="$ac_libs") 33ebfedea0SLionel Sambucif test "$ac_cv_func_getpwnam_r_posix" = yes; then 34ebfedea0SLionel Sambuc AC_DEFINE(POSIX_GETPWNAM_R, 1, [Define if getpwnam_r has POSIX flavour.]) 35ebfedea0SLionel Sambucfi 36*0a6a1f1dSLionel Sambucif test "$ac_cv_func_getpwnam_r_posix" = yes -a "$ac_cv_func_getpwnam_r_posix_def" = yes; then 37*0a6a1f1dSLionel Sambuc AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to get POSIX getpwnam_r in some systems.]) 38*0a6a1f1dSLionel Sambucfi 39ebfedea0SLionel Sambucfi 40ebfedea0SLionel Sambuc]) 41