diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 17:47:29 +0000 |
commit | 4f5791ebd03eaec1c7da0865a383175b05102712 (patch) | |
tree | 8ce7b00f7a76baa386372422adebbe64510812d4 /third_party/heimdal/cf/check-getpwnam_r-posix.m4 | |
parent | Initial commit. (diff) | |
download | samba-4f5791ebd03eaec1c7da0865a383175b05102712.tar.xz samba-4f5791ebd03eaec1c7da0865a383175b05102712.zip |
Adding upstream version 2:4.17.12+dfsg.upstream/2%4.17.12+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/heimdal/cf/check-getpwnam_r-posix.m4')
-rw-r--r-- | third_party/heimdal/cf/check-getpwnam_r-posix.m4 | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/third_party/heimdal/cf/check-getpwnam_r-posix.m4 b/third_party/heimdal/cf/check-getpwnam_r-posix.m4 new file mode 100644 index 0000000..0e9167f --- /dev/null +++ b/third_party/heimdal/cf/check-getpwnam_r-posix.m4 @@ -0,0 +1,74 @@ +dnl $Id$ +dnl +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) +if test "$ac_cv_func_getpwnam_r" = yes; then + AC_CACHE_CHECK(if getpwnam_r is posix,ac_cv_func_getpwnam_r_posix, + ac_libs="$LIBS" + LIBS="$LIBS $LIB_getpwnam_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 getpwnam_r("", &pw, 0, 0, &pwd) < 0; +} +]])],[ac_cv_func_getpwnam_r_posix=yes],[ac_cv_func_getpwnam_r_posix=no],[:]) +LIBS="$ac_libs") + AC_CACHE_CHECK(if _POSIX_PTHREAD_SEMANTICS is needed,ac_cv_func_getpwnam_r_posix_def, + ac_libs="$LIBS" + LIBS="$LIBS $LIB_getpwnam_r" + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <pwd.h> +int main(int argc, char **argv) +{ + struct passwd pw, *pwd; + return getpwnam_r("", &pw, 0, 0, &pwd) < 0; +} +]])],[ac_cv_func_getpwnam_r_posix_def=no],[ac_cv_func_getpwnam_r_posix_def=yes],[:]) +LIBS="$ac_libs") +if test "$ac_cv_func_getpwnam_r_posix" = yes; then + AC_DEFINE(POSIX_GETPWNAM_R, 1, [Define if getpwnam_r has POSIX flavour.]) +fi +if test "$ac_cv_func_getpwnam_r_posix" = yes -a "$ac_cv_func_getpwnam_r_posix_def" = yes; then + AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1, [Define to get POSIX getpwnam_r in some systems.]) +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 +]) |