summaryrefslogtreecommitdiff
path: root/net/libpcap/builtin.mk
blob: c8ebcf0b7e2154555d5dc849ddfb365ca9ecb1e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# $NetBSD: builtin.mk,v 1.5 2005/01/11 19:55:29 xtraeme Exp $

_LIBPCAP_H=	/usr/include/pcap.h

.if !defined(IS_BUILTIN.libpcap)
IS_BUILTIN.libpcap=	no
.  if exists(${_LIBPCAP_H})
IS_BUILTIN.libpcap!=							\
	if ${GREP} -q PCAP_VERSION_MAJOR ${_LIBPCAP_H}; then		\
		${ECHO} "yes";						\
	else								\
		${ECHO} "no";						\
	fi
.    if !empty(IS_BUILTIN.libpcap:M[yY][eE][sS])
#
# Create an appropriate name for the built-in package distributed
# with the system.  This package name can be used to check against
# BUILDLINK_DEPENDS.<pkg> to see if we need to install the pkgsrc
# version or if the built-in one is sufficient.
#
.      if !defined(_LIPCAP_VERSION)
_LIBPCAP_VERSIONS=	0.8.3  0.7.2
_LIBPCAP_0.8.3=		NetBSD-2.99.9* NetBSD-2.99.1[0-9]* NetBSD-[3-9]*
_LIBPCAP_0.7.2=		NetBSD-1.[56]* NetBSD-2.0* NetBSD-2.99.[1-8]
.        for _libpcap_version_ in ${_LIBPCAP_VERSIONS}
.          for _pattern_ in ${_LIBPCAP_${_libpcap_version_}}
.            if !empty(MACHINE_PLATFORM:M${_pattern_})
_LIBPCAP_VERSION?=	${_libpcap_version_}
.            endif
.          endfor
.        endfor
_LIBPCAP_VERSION?=	0.7.2
.      endif
BUILTIN_PKG.libpcap=	libpcap-${_LIBPCAP_VERSION}
MAKEFLAGS+=		BUILTIN_PKG.libpcap=${BUILTIN_PKG.libpcap}
.    endif
.  endif
MAKEFLAGS+=	IS_BUILTIN.libpcap=${IS_BUILTIN.libpcap}
.endif

.if !defined(USE_BUILTIN.libpcap)
USE_BUILTIN.libpcap?=	${IS_BUILTIN.libpcap}

.  if defined(BUILTIN_PKG.libpcap)
USE_BUILTIN.libpcap=	yes
.    for _depend_ in ${BUILDLINK_DEPENDS.libpcap}
.      if !empty(USE_BUILTIN.libpcap:M[yY][eE][sS])
USE_BUILTIN.libpcap!=	\
	if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.libpcap}; then \
		${ECHO} "yes";						\
	else								\
		${ECHO} "no";						\
	fi
.      endif
.    endfor
.  endif
.endif	# USE_BUILTIN.libpcap

CHECK_BUILTIN.libpcap?=	no
.if !empty(CHECK_BUILTIN.libpcap:M[nN][oO])

.if !empty(USE_BUILTIN.libpcap:M[nN][oO])
BUILDLINK_DEPENDS.libpcap+=	libpcap>=0.8.3
.endif

.endif	# CHECK_BUILTIN.libpcap