Add files from parent branch HEAD:
[pkgsrc.git] / mk / resolv.buildlink3.mk
1 # $NetBSD: dlopen.buildlink3.mk,v 1.15 2007/06/04 08:10:32 rillig Exp $
2 #
3 # This Makefile fragment is included by package Makefiles and
4 # buildlink3.mk files for the packages that need a thread-safe
5 # DNS resolver..
6 #
7 # It defines the variables RESOLV_LDFLAGS and RESOLV_LIBS,
8 # which are also exported into the CONFIGURE_ENV and MAKE_ENV environments.
9 #
10 # Package-settable variables:
11 #
12 # RESOLV_AUTO_VARS
13 #       When set to "yes", the necessary flags are added automatically
14 #       to LDFLAGS and friends.
15 #
16 #       Default: no
17 #
18 # Keywords: resolv
19 #
20
21 RESOLV_BUILDLINK3_MK:=  ${RESOLV_BUILDLINK3_MK}+
22
23 .include "../../mk/bsd.fast.prefs.mk"
24
25 RESOLV_AUTO_VARS?=      no
26 CHECK_BUILTIN.resolv=   no
27
28 .if ${OPSYS} == "DragonFly" || ${OPSYS} == "FreeBSD"
29 USE_BUILTIN.resolv?=    yes
30
31 BUILDLINK_LDFLAGS.resolv=       # empty, in libc
32 .elif (${OPSYS} == "NetBSD" && empty(OS_VERSION:M[012].*)) || \
33     (${OPSYS} == "Darwin" && empty(OS_VERSION:M[0123467].*))
34 USE_BUILTIN.resolv?=    yes
35
36 # BIND 9 resolver
37 BUILDLINK_LDFLAGS.resolv=       -lresolv
38 .else
39 USE_BUILTIN.resolv?=    no
40 .endif
41
42 .if !empty(USE_BUILTIN.resolv:M[yY][eE][sS])
43 BUILDLINK_PACKAGES:=            ${BUILDLINK_PACKAGES:Nresolv}
44 BUILDLINK_PACKAGES+=            resolv
45 BUILDLINK_ORDER:=               ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}resolv
46 BUILDLINK_AUTO_VARS.resolv=     ${RESOLV_AUTO_VARS}
47 .else
48 .  include "../../net/bind9/buildlink3.mk"
49
50 BUILDLINK_AUTO_VARS.bind=       ${RESOLV_AUTO_VARS}
51 BUILDLINK_LDFLAGS.resolv=       ${BUILDLINK_LDFLAGS.bind}
52 BUILDLINK_LIBS.resolv=          ${BUILDLINK_LIBS.bind}
53 .endif
54
55 .if !empty(RESOLV_BUILDLINK3_MK:M+)
56 #
57 # Define user-visible RESOLV_{LDFLAGS,LIBS} as compiler options used
58 # to link code that needs a thread-safe DNS resolver.
59 #
60 RESOLV_LDFLAGS= ${BUILDLINK_LDFLAGS.resolv}
61 RESOLV_LIBS=    ${BUILDLINK_LIBS.resolv}
62 CONFIGURE_ENV+= RESOLV_LDFLAGS=${RESOLV_LDFLAGS:Q}
63 CONFIGURE_ENV+= RESOLV_LIBS=${RESOLV_LIBS:Q}
64 MAKE_ENV+=      RESOLV_LDFLAGS=${RESOLV_LDFLAGS:Q}
65 MAKE_ENV+=      RESOLV_LIBS=${RESOLV_LIBS:Q}
66 .endif  # RESOLV_BUILDLINK3_MK