update Sun Jun 6 12:37:00 PDT 2010
[pkgsrc.git] / net / bind96 / builtin.mk
1 # $NetBSD: builtin.mk,v 1.1.1.1 2009/01/04 00:21:36 adrianp Exp $
2
3 BUILTIN_PKG:=   bind
4
5 BUILTIN_FIND_FILES_VAR:=        EXE_NAMED
6 BUILTIN_FIND_FILES.EXE_NAMED=   /usr/sbin/named
7 BUILTIN_FIND_LIBS:=             bind
8
9 .include "../../mk/buildlink3/bsd.builtin.mk"
10
11 ###
12 ### Figure out the version of BIND if an ISC BIND named exists on the
13 ### system.
14 ###
15 .if !defined(BUILTIN_VERSION.bind) && \
16     empty(EXE_NAMED:M__nonexistent__) && \
17     empty(EXE_NAMED:M${LOCALBASE}/*)
18 BUILTIN_VERSION.bind!=  \
19         ${EXE_NAMED} -v 2>/dev/null | ${HEAD} -1 |                      \
20         ${AWK} 'BEGIN { v = "4.9.11"; }                                 \
21                 /^BIND / { v = $$2; sub("-.*", "", v); }                \
22                 /^named / { v = $$2; sub("-.*", "", v); }               \
23                 END { print v; }'
24 .endif
25 MAKEVARS+=      BUILTIN_VERSION.bind
26
27 ###
28 ### Determine if there is a built-in implementation of the package and
29 ### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
30 ###
31 .if !defined(IS_BUILTIN.bind)
32 IS_BUILTIN.bind=        no
33 .  if defined(BUILTIN_VERSION.bind)
34 IS_BUILTIN.bind=        yes
35 .  endif
36 .endif
37 MAKEVARS+=      IS_BUILTIN.bind
38
39 ###
40 ### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
41 ### a package name to represent the built-in package.
42 ###
43 .if !defined(BUILTIN_PKG.bind) && \
44     !empty(IS_BUILTIN.bind:M[yY][eE][sS]) && \
45     defined(BUILTIN_VERSION.bind)
46 BUILTIN_PKG.bind=       bind-${BUILTIN_VERSION.bind}
47 .endif
48 MAKEVARS+=      BUILTIN_PKG.bind
49
50 ###
51 ### Determine whether we should use the built-in implementation if it
52 ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
53 ###
54 .if !defined(USE_BUILTIN.bind)
55 .  if ${PREFER.bind} == "pkgsrc"
56 USE_BUILTIN.bind=       no
57 .  else
58 USE_BUILTIN.bind=       ${IS_BUILTIN.bind}
59 .    if defined(BUILTIN_PKG.bind) && \
60         !empty(IS_BUILTIN.bind:M[yY][eE][sS])
61 USE_BUILTIN.bind=       yes
62 .      for dep in ${BUILDLINK_API_DEPENDS.bind}
63 .        if !empty(USE_BUILTIN.bind:M[yY][eE][sS])
64 USE_BUILTIN.bind!=                                                      \
65         if ${PKG_ADMIN} pmatch ${dep:Q} ${BUILTIN_PKG.bind:Q}; then     \
66                 ${ECHO} yes;                                            \
67         else                                                            \
68                 ${ECHO} no;                                             \
69         fi
70 .        endif
71 .      endfor
72 .    endif
73 .  endif  # PREFER.bind
74 .endif
75 MAKEVARS+=      USE_BUILTIN.bind
76
77 ###
78 ### The section below only applies if we are not including this file
79 ### solely to determine whether a built-in implementation exists.
80 ###
81 CHECK_BUILTIN.bind?=   no
82 .if !empty(CHECK_BUILTIN.bind:M[nN][oO])
83
84 .  if !empty(USE_BUILTIN.bind:M[yY][eE][sS])
85 .    if !empty(BUILTIN_LIB_FOUND.bind:M[yY][eE][sS])
86 BUILDLINK_LDADD.bind?=  -lbind
87 .    endif
88 .  elif !empty(USE_BUILTIN.bind:M[nN][oO])
89 BUILDLINK_LDADD.bind?=  -lbind
90 .  endif
91
92 .endif  # CHECK_BUILTIN.bind