1
##*****************************************************************************
2
## $Id: x_ac_getgrent.m4 889 2011-01-20 01:41:36Z chris.m.dunlap $
3
##*****************************************************************************
5
# Chris Dunlap <cdunlap@llnl.gov>
11
# Check what forms of getgrent() & getgrent_r() are supported.
14
# The C "Werror" flag is enabled to treat compiler warnings as errors.
15
# This is needed since the getgrent_r() prototypes for AIX and GNU differ
16
# only in the pointer type of the 4th argument (which is reported as a
19
# AC_LINK_IFELSE is used instead of AC_COMPILE_IFELSE since these tests
20
# compile successfully on BSD systems without getgrent_r() implementations.
21
# The missing getgrent_r() is detected when linking.
22
##*****************************************************************************
24
AC_DEFUN([X_AC_GETGRENT], [
25
AC_CHECK_FUNCS(getgrent)
31
AC_DEFUN([_X_AC_GETGRENT_R_AIX], [
33
[for getgrent_r (AIX)],
34
[x_ac_cv_have_getgrent_r_aix], [
35
_x_ac_getgrent_r_aix_c_werror_flag="$ac_c_werror_flag"
39
#define _THREAD_SAFE 1
48
rv = getgrent_r (&gr, gr_buf, sizeof (gr_buf), &gr_fp); ]]
50
AS_VAR_SET(x_ac_cv_have_getgrent_r_aix, yes),
51
AS_VAR_SET(x_ac_cv_have_getgrent_r_aix, no)
53
ac_c_werror_flag="$_x_ac_getgrent_r_aix_c_werror_flag"]
55
AS_IF([test AS_VAR_GET(x_ac_cv_have_getgrent_r_aix) = yes],
56
AC_DEFINE([HAVE_GETGRENT_R_AIX], [1],
57
[Define to 1 if you have the `getgrent_r' function from AIX.]
62
AC_DEFUN([_X_AC_GETGRENT_R_GNU], [
64
[for getgrent_r (GNU)],
65
[x_ac_cv_have_getgrent_r_gnu], [
66
_x_ac_getgrent_r_gnu_c_werror_flag="$ac_c_werror_flag"
75
struct group gr, *gr_ptr;
77
rv = getgrent_r (&gr, gr_buf, sizeof (gr_buf), &gr_ptr); ]]
79
AS_VAR_SET(x_ac_cv_have_getgrent_r_gnu, yes),
80
AS_VAR_SET(x_ac_cv_have_getgrent_r_gnu, no)
82
ac_c_werror_flag="$_x_ac_getgrent_r_gnu_c_werror_flag"]
84
AS_IF([test AS_VAR_GET(x_ac_cv_have_getgrent_r_gnu) = yes],
85
AC_DEFINE([HAVE_GETGRENT_R_GNU], [1],
86
[Define to 1 if you have the `getgrent_r' function from GNU.]
91
AC_DEFUN([_X_AC_GETGRENT_R_SUN], [
93
[for getgrent_r (SunOS)],
94
[x_ac_cv_have_getgrent_r_sun], [
95
_x_ac_getgrent_r_sun_c_werror_flag="$ac_c_werror_flag"
102
struct group gr, *gr_ptr;
104
gr_ptr = getgrent_r (&gr, gr_buf, sizeof (gr_buf)); ]]
106
AS_VAR_SET(x_ac_cv_have_getgrent_r_sun, yes),
107
AS_VAR_SET(x_ac_cv_have_getgrent_r_sun, no)
109
ac_c_werror_flag="$_x_ac_getgrent_r_sun_c_werror_flag"]
111
AS_IF([test AS_VAR_GET(x_ac_cv_have_getgrent_r_sun) = yes],
112
AC_DEFINE([HAVE_GETGRENT_R_SUN], [1],
113
[Define to 1 if you have the `getgrent_r' function from SunOS.]