Add check for getpw*_r()
This commit is contained in:

committed by
Nico Williams

parent
a988692434
commit
e2685c5b7c
@@ -1,6 +1,6 @@
|
||||
dnl $Id$
|
||||
dnl
|
||||
dnl check for getpwnam_r, and if it's posix or not
|
||||
dnl check for getpwnam_r, and if it's posix or not; also check for getpwuid_r
|
||||
|
||||
AC_DEFUN([AC_CHECK_GETPWNAM_R_POSIX],[
|
||||
AC_FIND_FUNC_NO_LIBS(getpwnam_r,c_r)
|
||||
@@ -38,3 +38,37 @@ if test "$ac_cv_func_getpwnam_r_posix" = yes -a "$ac_cv_func_getpwnam_r_posix_de
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([AC_CHECK_GETPWUID_R_POSIX],[
|
||||
AC_FIND_FUNC_NO_LIBS(getpwuid_r,c_r)
|
||||
if test "$ac_cv_func_getpwuid_r" = yes; then
|
||||
AC_CACHE_CHECK(if getpwuid_r is posix,ac_cv_func_getpwuid_r_posix,
|
||||
ac_libs="$LIBS"
|
||||
LIBS="$LIBS $LIB_getpwuid_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 getpwuid_r(0, &pw, 0, 0, &pwd) < 0;
|
||||
}
|
||||
]])],[ac_cv_func_getpwuid_r_posix=yes],[ac_cv_func_getpwuid_r_posix=no],[:])
|
||||
LIBS="$ac_libs")
|
||||
AC_CACHE_CHECK(if _POSIX_PTHREAD_SEMANTICS is needed,ac_cv_func_getpwuid_r_posix_def,
|
||||
ac_libs="$LIBS"
|
||||
LIBS="$LIBS $LIB_getpwuid_r"
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <pwd.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct passwd pw, *pwd;
|
||||
return getpwuid_r("", &pw, 0, 0, &pwd) < 0;
|
||||
}
|
||||
]])],[ac_cv_func_getpwuid_r_posix_def=no],[ac_cv_func_getpwuid_r_posix_def=yes],[:])
|
||||
LIBS="$ac_libs")
|
||||
if test "$ac_cv_func_getpwuid_r_posix" = yes; then
|
||||
AC_DEFINE(POSIX_GETPWUID_R, 1, [Define if getpwuid_r has POSIX flavour.])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
@@ -454,6 +454,9 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg }
|
||||
/* Define to 1 if you have the `getpwnam_r' function. */
|
||||
/* #define HAVE_GETPWNAM_R 1 */
|
||||
|
||||
/* Define to 1 if you have the `getpwuid_r' function. */
|
||||
/* #define HAVE_GETPWUID_R 1 */
|
||||
|
||||
/* Define to 1 if you have the `getrlimit' function. */
|
||||
/* #define HAVE_GETRLIMIT 1 */
|
||||
|
||||
@@ -1366,6 +1369,9 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg }
|
||||
/* Define if getpwnam_r has POSIX flavour. */
|
||||
/* #define POSIX_GETPWNAM_R 1 */
|
||||
|
||||
/* Define if getpwnam_r has POSIX flavour. */
|
||||
/* #define POSIX_GETPWUID_R 1 */
|
||||
|
||||
/* Define if you have the readline package. */
|
||||
#define READLINE 1
|
||||
|
||||
|
Reference in New Issue
Block a user