update Mon Mar 15 12:37:00 PDT 2010
[pkgsrc.git] / mk / pam.buildlink3.mk
1 # $NetBSD: pam.buildlink3.mk,v 1.11 2009/03/20 19:25:01 joerg Exp $
2 #
3 # This Makefile fragment is meant to be included by packages that
4 # require a PAM implementation.
5 #
6 # User-settable variables:
7 #
8 # PAM_DEFAULT
9 #       The preferred PAM implementation.
10 #
11 #       Possible: linux-pam openpam solaris-pam
12 #       Default: (from the base system, fallback: linux-pam)
13 #
14 # Package-settable variables:
15 #
16 # PAM_ACCEPTED
17 #       The PAM implementations that this package can use.
18 #
19 #       Possible: (see PAM_DEFAULT)
20 #       Default: all
21 #
22 # System-provided variables:
23 #
24 # PAM_TYPE
25 #       The PAM implementation that will be used for this package.
26 #
27 # PAMBASE
28 #       The directory where the PAM implementation is installed.
29 #
30
31 PAM_BUILDLINK3_MK:=     ${PAM_BUILDLINK3_MK}+
32
33 .include "bsd.fast.prefs.mk"
34
35 .if !empty(PAM_BUILDLINK3_MK:M+)
36 #
37 # This is an exhaustive list of all of the PAM implementations
38 # that may be used with PAM.buildlink3.mk, in order of precedence.
39 #
40 # OS conditionals can exclude implementations not available on
41 # some platforms.
42 #
43 .if ${OPSYS} != "Interix"
44 _PAM_PKGS+=     linux-pam
45 .endif
46
47 .if ${OPSYS} != "Interix"
48 _PAM_PKGS+=     openpam
49 .endif
50
51 # builtin only, so no conditional needed
52 _PAM_PKGS+=     solaris-pam
53
54 BUILDLINK_BUILTIN_MK.linux-pam=         ../../security/PAM/builtin.mk
55 BUILDLINK_BUILTIN_MK.openpam=           ../../security/openpam/builtin.mk
56 BUILDLINK_BUILTIN_MK.solaris-pam=       ../../mk/solaris-pam.builtin.mk
57
58 # If we have a particular PAM implementation in the base system, then
59 # default to using that PAM type.  Otherwise, default to "linux-pam".
60 #
61 .  for _pam_ in ${_PAM_PKGS}
62 .    if exists(${BUILDLINK_BUILTIN_MK.${_pam_}})
63 CHECK_BUILTIN.${_pam_}:=        yes
64 .      include "${BUILDLINK_BUILTIN_MK.${_pam_}}"
65 .      if defined(IS_BUILTIN.${_pam_}) && \
66                 !empty(IS_BUILTIN.${_pam_}:M[yY][eE][sS])
67 PAM_DEFAULT?=   ${_pam_}
68 .      endif
69 CHECK_BUILTIN.${_pam_}:=        no
70 .    endif
71 .  endfor
72 PAM_DEFAULT?=   linux-pam
73 PAM_ACCEPTED?=  ${_PAM_PKGS}
74
75 _PAM_DEFAULT=   ${PAM_DEFAULT}
76 _PAM_ACCEPTED=  ${PAM_ACCEPTED}
77
78 _PAM_TYPE?=     ${_PAM_DEFAULT}
79
80 .  if !empty(_PAM_ACCEPTED:M${_PAM_TYPE})
81 PAM_TYPE=       ${_PAM_TYPE}
82 .  else
83 PAM_TYPE=       none
84 .  endif
85 PAMBASE=        ${BUILDLINK_PREFIX.${PAM_TYPE}}
86
87 BUILD_DEFS+=            PAM_DEFAULT
88 BUILD_DEFS_EFFECTS+=    PAMBASE PAM_TYPE
89 .endif  # PAM_BUILDLINK3_MK
90
91 .if ${PAM_TYPE} == "none"
92 PKG_FAIL_REASON=        \
93         "${_PAM_TYPE} is not an acceptable PAM type for ${PKGNAME}."
94 .elif ${PAM_TYPE} == "linux-pam"
95 .  include "../../security/PAM/buildlink3.mk"
96 .elif ${PAM_TYPE} == "openpam"
97 .  include "../../security/openpam/buildlink3.mk"
98 .elif ${PAM_TYPE} == "solaris-pam"
99 BUILDLINK_TREE+=        solaris-pam -solaris-pam
100 .endif