~ubuntu-branches/ubuntu/vivid/munge/vivid

« back to all changes in this revision

Viewing changes to config/x_ac_getgrent.m4

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2011-02-28 20:41:12 UTC
  • mfrom: (6.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20110228204112-2lc8ss9geeusv5uo
Tags: 0.5.10-1
* New upstream release 
* Updated copyright, homepage, watch thanks to Chris Dunlap
* Standards version upgraded to 3.9.1.0 (no changes) 
* Switch to dpkg-source 3.0 (quilt) format
* Added explicit dependency by the same version of libmunge for munge

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
##*****************************************************************************
 
2
## $Id: x_ac_getgrent.m4 889 2011-01-20 01:41:36Z chris.m.dunlap $
 
3
##*****************************************************************************
 
4
#  AUTHOR:
 
5
#    Chris Dunlap <cdunlap@llnl.gov>
 
6
#
 
7
#  SYNOPSIS:
 
8
#    X_AC_GETGRENT
 
9
#
 
10
#  DESCRIPTION:
 
11
#    Check what forms of getgrent() & getgrent_r() are supported.
 
12
#
 
13
#  NOTES:
 
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
 
17
#    compiler warning).
 
18
#
 
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
##*****************************************************************************
 
23
 
 
24
AC_DEFUN([X_AC_GETGRENT], [
 
25
  AC_CHECK_FUNCS(getgrent)
 
26
  _X_AC_GETGRENT_R_AIX
 
27
  _X_AC_GETGRENT_R_GNU
 
28
  _X_AC_GETGRENT_R_SUN
 
29
])
 
30
 
 
31
AC_DEFUN([_X_AC_GETGRENT_R_AIX], [
 
32
  AC_CACHE_CHECK(
 
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"
 
36
    ac_c_werror_flag=yes
 
37
    AC_LINK_IFELSE([
 
38
      AC_LANG_PROGRAM([[
 
39
#define _THREAD_SAFE 1
 
40
#include <grp.h>
 
41
#include <stdio.h>
 
42
]],
 
43
[[
 
44
int rv;
 
45
struct group gr;
 
46
char gr_buf [1024];
 
47
FILE *gr_fp;
 
48
rv = getgrent_r (&gr, gr_buf, sizeof (gr_buf), &gr_fp); ]]
 
49
      )],
 
50
      AS_VAR_SET(x_ac_cv_have_getgrent_r_aix, yes),
 
51
      AS_VAR_SET(x_ac_cv_have_getgrent_r_aix, no)
 
52
    )
 
53
    ac_c_werror_flag="$_x_ac_getgrent_r_aix_c_werror_flag"]
 
54
  )
 
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.]
 
58
    )
 
59
  )]
 
60
)
 
61
 
 
62
AC_DEFUN([_X_AC_GETGRENT_R_GNU], [
 
63
  AC_CACHE_CHECK(
 
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"
 
67
    ac_c_werror_flag=yes
 
68
    AC_LINK_IFELSE([
 
69
      AC_LANG_PROGRAM([[
 
70
#define _GNU_SOURCE 1
 
71
#include <grp.h>
 
72
]],
 
73
[[
 
74
int rv;
 
75
struct group gr, *gr_ptr;
 
76
char gr_buf [1024];
 
77
rv = getgrent_r (&gr, gr_buf, sizeof (gr_buf), &gr_ptr); ]]
 
78
      )],
 
79
      AS_VAR_SET(x_ac_cv_have_getgrent_r_gnu, yes),
 
80
      AS_VAR_SET(x_ac_cv_have_getgrent_r_gnu, no)
 
81
    )
 
82
    ac_c_werror_flag="$_x_ac_getgrent_r_gnu_c_werror_flag"]
 
83
  )
 
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.]
 
87
    )
 
88
  )]
 
89
)
 
90
 
 
91
AC_DEFUN([_X_AC_GETGRENT_R_SUN], [
 
92
  AC_CACHE_CHECK(
 
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"
 
96
    ac_c_werror_flag=yes
 
97
    AC_LINK_IFELSE([
 
98
      AC_LANG_PROGRAM([[
 
99
#include <grp.h>
 
100
]],
 
101
[[
 
102
struct group gr, *gr_ptr;
 
103
char gr_buf [1024];
 
104
gr_ptr = getgrent_r (&gr, gr_buf, sizeof (gr_buf)); ]]
 
105
      )],
 
106
      AS_VAR_SET(x_ac_cv_have_getgrent_r_sun, yes),
 
107
      AS_VAR_SET(x_ac_cv_have_getgrent_r_sun, no)
 
108
    )
 
109
    ac_c_werror_flag="$_x_ac_getgrent_r_sun_c_werror_flag"]
 
110
  )
 
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.]
 
114
    )
 
115
  )]
 
116
)