1 # $NetBSD: builtin.mk,v 1.1.1.1 2009/01/04 00:21:36 adrianp Exp $
5 BUILTIN_FIND_FILES_VAR:= EXE_NAMED
6 BUILTIN_FIND_FILES.EXE_NAMED= /usr/sbin/named
7 BUILTIN_FIND_LIBS:= bind
9 .include "../../mk/buildlink3/bsd.builtin.mk"
12 ### Figure out the version of BIND if an ISC BIND named exists on the
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); } \
25 MAKEVARS+= BUILTIN_VERSION.bind
28 ### Determine if there is a built-in implementation of the package and
29 ### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
31 .if !defined(IS_BUILTIN.bind)
33 . if defined(BUILTIN_VERSION.bind)
37 MAKEVARS+= IS_BUILTIN.bind
40 ### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
41 ### a package name to represent the built-in package.
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}
48 MAKEVARS+= BUILTIN_PKG.bind
51 ### Determine whether we should use the built-in implementation if it
52 ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
54 .if !defined(USE_BUILTIN.bind)
55 . if ${PREFER.bind} == "pkgsrc"
58 USE_BUILTIN.bind= ${IS_BUILTIN.bind}
59 . if defined(BUILTIN_PKG.bind) && \
60 !empty(IS_BUILTIN.bind:M[yY][eE][sS])
62 . for dep in ${BUILDLINK_API_DEPENDS.bind}
63 . if !empty(USE_BUILTIN.bind:M[yY][eE][sS])
65 if ${PKG_ADMIN} pmatch ${dep:Q} ${BUILTIN_PKG.bind:Q}; then \
75 MAKEVARS+= USE_BUILTIN.bind
78 ### The section below only applies if we are not including this file
79 ### solely to determine whether a built-in implementation exists.
81 CHECK_BUILTIN.bind?= no
82 .if !empty(CHECK_BUILTIN.bind:M[nN][oO])
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
88 . elif !empty(USE_BUILTIN.bind:M[nN][oO])
89 BUILDLINK_LDADD.bind?= -lbind
92 .endif # CHECK_BUILTIN.bind