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