source: heimdal/trunk/cf/check-getpwnam_r-posix.m4@ 4

Last change on this file since 4 was 1, checked in by Paul Smedley, 10 years ago

Initial commit of Heimdal 1.5.3

File size: 1.3 KB
Line 
1dnl $Id$
2dnl
3dnl check for getpwnam_r, and if it's posix or not
4
5AC_DEFUN([AC_CHECK_GETPWNAM_R_POSIX],[
6AC_FIND_FUNC_NO_LIBS(getpwnam_r,c_r)
7if test "$ac_cv_func_getpwnam_r" = yes; then
8 AC_CACHE_CHECK(if getpwnam_r is posix,ac_cv_func_getpwnam_r_posix,
9 ac_libs="$LIBS"
10 LIBS="$LIBS $LIB_getpwnam_r"
11 AC_RUN_IFELSE([AC_LANG_SOURCE([[
12#define _POSIX_PTHREAD_SEMANTICS
13#include <pwd.h>
14int main(int argc, char **argv)
15{
16 struct passwd pw, *pwd;
17 return getpwnam_r("", &pw, 0, 0, &pwd) < 0;
18}
19]])],[ac_cv_func_getpwnam_r_posix=yes],[ac_cv_func_getpwnam_r_posix=no],[:])
20LIBS="$ac_libs")
21 AC_CACHE_CHECK(if _POSIX_PTHREAD_SEMANTICS is needed,ac_cv_func_getpwnam_r_posix_def,
22 ac_libs="$LIBS"
23 LIBS="$LIBS $LIB_getpwnam_r"
24 AC_RUN_IFELSE([AC_LANG_SOURCE([[
25#include <pwd.h>
26int main(int argc, char **argv)
27{
28 struct passwd pw, *pwd;
29 return getpwnam_r("", &pw, 0, 0, &pwd) < 0;
30}
31]])],[ac_cv_func_getpwnam_r_posix_def=no],[ac_cv_func_getpwnam_r_posix_def=yes],[:])
32LIBS="$ac_libs")
33if test "$ac_cv_func_getpwnam_r_posix" = yes; then
34 AC_DEFINE(POSIX_GETPWNAM_R, 1, [Define if getpwnam_r has POSIX flavour.])
35fi
36if test "$ac_cv_func_getpwnam_r_posix" = yes -a "$ac_cv_func_getpwnam_r_posix_def" = yes; then
37 AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to get POSIX getpwnam_r in some systems.])
38fi
39fi
40])
Note: See TracBrowser for help on using the repository browser.