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

« back to all changes in this revision

Viewing changes to config/x_ac_getpwnam.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_getpwnam.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_GETPWNAM
 
9
#
 
10
#  DESCRIPTION:
 
11
#    Check what forms of getpwnam() & getpwnam_r() are supported.
 
12
##*****************************************************************************
 
13
 
 
14
AC_DEFUN([X_AC_GETPWNAM], [
 
15
  AC_CHECK_FUNCS(getpwnam)
 
16
  _X_AC_GETPWNAM_R_AIX
 
17
  _X_AC_GETPWNAM_R_POSIX
 
18
  _X_AC_GETPWNAM_R_SUN
 
19
])
 
20
 
 
21
AC_DEFUN([_X_AC_GETPWNAM_R_AIX], [
 
22
  AC_CACHE_CHECK(
 
23
    [for getpwnam_r (AIX)],
 
24
    [x_ac_cv_have_getpwnam_r_aix], [
 
25
    AC_LINK_IFELSE([
 
26
      AC_LANG_PROGRAM([[
 
27
#undef _ALL_SOURCE                      /* for overriding POSIX getpwnam_r */
 
28
#define _THREAD_SAFE 1
 
29
#define _UNIX95 1
 
30
#define _XOPEN_SOURCE_EXTENDED 1
 
31
#include <pwd.h>
 
32
]],
 
33
[[
 
34
int rv;
 
35
char *user;
 
36
struct passwd pw;
 
37
char pw_buf [1024];
 
38
rv = getpwnam_r (user, &pw, pw_buf, sizeof (pw_buf)); ]]
 
39
      )],
 
40
      AS_VAR_SET(x_ac_cv_have_getpwnam_r_aix, yes),
 
41
      AS_VAR_SET(x_ac_cv_have_getpwnam_r_aix, no)
 
42
    )]
 
43
  )
 
44
  AS_IF([test AS_VAR_GET(x_ac_cv_have_getpwnam_r_aix) = yes],
 
45
    AC_DEFINE([HAVE_GETPWNAM_R_AIX], [1],
 
46
      [Define to 1 if you have the `getpwnam_r' function from AIX.]
 
47
    )
 
48
  )]
 
49
)
 
50
 
 
51
AC_DEFUN([_X_AC_GETPWNAM_R_POSIX], [
 
52
  AC_CACHE_CHECK(
 
53
    [for getpwnam_r (POSIX)],
 
54
    [x_ac_cv_have_getpwnam_r_posix], [
 
55
    AC_LINK_IFELSE([
 
56
      AC_LANG_PROGRAM([[
 
57
#define _POSIX_PTHREAD_SEMANTICS 1      /* for SunOS */
 
58
#include <pwd.h>
 
59
]],
 
60
[[
 
61
int rv;
 
62
char *user;
 
63
struct passwd pw, *pw_ptr;
 
64
char pw_buf [1024];
 
65
rv = getpwnam_r (user, &pw, pw_buf, sizeof (pw_buf), &pw_ptr); ]]
 
66
      )],
 
67
      AS_VAR_SET(x_ac_cv_have_getpwnam_r_posix, yes),
 
68
      AS_VAR_SET(x_ac_cv_have_getpwnam_r_posix, no)
 
69
    )]
 
70
  )
 
71
  AS_IF([test AS_VAR_GET(x_ac_cv_have_getpwnam_r_posix) = yes],
 
72
    AC_DEFINE([HAVE_GETPWNAM_R_POSIX], [1],
 
73
      [Define to 1 if you have the `getpwnam_r' function from POSIX.]
 
74
    )
 
75
  )]
 
76
)
 
77
 
 
78
AC_DEFUN([_X_AC_GETPWNAM_R_SUN], [
 
79
  AC_CACHE_CHECK(
 
80
    [for getpwnam_r (SunOS)],
 
81
    [x_ac_cv_have_getpwnam_r_sun], [
 
82
    AC_LINK_IFELSE([
 
83
      AC_LANG_PROGRAM([[
 
84
#undef _POSIX_PTHREAD_SEMANTICS         /* for overriding POSIX getpwnam_r */
 
85
#include <pwd.h>
 
86
]],
 
87
[[
 
88
char *user;
 
89
struct passwd pw, *pw_ptr;
 
90
char pw_buf [1024];
 
91
pw_ptr = getpwnam_r (user, &pw, pw_buf, sizeof (pw_buf)); ]]
 
92
      )],
 
93
      AS_VAR_SET(x_ac_cv_have_getpwnam_r_sun, yes),
 
94
      AS_VAR_SET(x_ac_cv_have_getpwnam_r_sun, no)
 
95
    )]
 
96
  )
 
97
  AS_IF([test AS_VAR_GET(x_ac_cv_have_getpwnam_r_sun) = yes],
 
98
    AC_DEFINE([HAVE_GETPWNAM_R_SUN], [1],
 
99
      [Define to 1 if you have the `getpwnam_r' function from SunOS.]
 
100
    )
 
101
  )]
 
102
)