summaryrefslogtreecommitdiff
path: root/net/libpcap
diff options
context:
space:
mode:
Diffstat (limited to 'net/libpcap')
-rw-r--r--net/libpcap/builtin.mk121
1 files changed, 73 insertions, 48 deletions
diff --git a/net/libpcap/builtin.mk b/net/libpcap/builtin.mk
index d77c3eb4373..a3aae31647e 100644
--- a/net/libpcap/builtin.mk
+++ b/net/libpcap/builtin.mk
@@ -1,67 +1,92 @@
-# $NetBSD: builtin.mk,v 1.9 2005/01/11 21:19:24 xtraeme Exp $
+# $NetBSD: builtin.mk,v 1.10 2005/06/01 18:03:07 jlam Exp $
-_LIBPCAP_PKGSRC_PKGNAME= libpcap-0.8.3
-_LIBPCAP_PCAP_H= /usr/include/pcap.h
+BUILTIN_PKG:= libpcap
+BUILTIN_FIND_FILES_VAR:= H_LIBPCAP
+BUILTIN_FIND_FILES.H_LIBPCAP= /usr/include/pcap.h
+
+.include "../../mk/buildlink3/bsd.builtin.mk"
+
+###
+### Determine if there is a built-in implementation of the package and
+### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
+###
.if !defined(IS_BUILTIN.libpcap)
IS_BUILTIN.libpcap= no
-. if exists(${_LIBPCAP_PCAP_H})
+. if empty(H_LIBPCAP:M${LOCALBASE}/*) && exists(${H_LIBPCAP})
IS_BUILTIN.libpcap= yes
+. endif
+.endif
+MAKEVARS+= IS_BUILTIN.libpcap
+###
+### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
+### a package name to represent the built-in package.
+###
+.if !defined(BUILTIN_PKG.libpcap) && \
+ !empty(IS_BUILTIN.libpcap:M[yY][eE][sS]) && \
+ exists(${H_LIBPCAP})
# libpcap>=0.8.3: MODE_MON added
-_PCAP_083!= \
- ${GREP} -c MODE_MON ${_LIBPCAP_PCAP_H} || ${TRUE}
+_BLTN_PCAP_083!= \
+ ${GREP} -c MODE_MON ${H_LIBPCAP} || ${TRUE}
# libpcap>=0.8.1: pcap_get_selectable_fd added
-_PCAP_081!= \
- ${GREP} -c pcap_get_selectable_fd ${_LIBPCAP_PCAP_H} || ${TRUE}
+_BLTN_PCAP_081!= \
+ ${GREP} -c pcap_get_selectable_fd ${H_LIBPCAP} || ${TRUE}
# libpcap>=0.8.0: pcap_datalink_val_to_description added
-_PCAP_080!= \
- ${GREP} -c pcap_datalink_val_to_description \
- ${_LIBPCAP_PCAP_H} || ${TRUE}
+_BLTN_PCAP_080!= \
+ ${GREP} -c pcap_datalink_val_to_description ${H_LIBPCAP} || ${TRUE}
# libpcap>=0.7.0: pcap_setnonblock added
-_PCAP_070!= \
- ${GREP} -c pcap_setnonblock ${_LIBPCAP_PCAP_H} || ${TRUE}
+_BLTN_PCAP_070!= \
+ ${GREP} -c pcap_setnonblock ${H_LIBPCAP} || ${TRUE}
# libpcap>=0.6.0: prototype change for pcap_freecode
-_PCAP_060!= \
- ${GREP} -c pcap_freecode.struct.bpf_program \
- ${_LIBPCAP_PCAP_H} || ${TRUE}
+_BLTN_PCAP_060!= \
+ ${GREP} -c pcap_freecode.struct.bpf_program ${H_LIBPCAP} || ${TRUE}
# libpcap>=0.5.0: pcap_compile_nopcap added
-_PCAP_050!= \
- ${GREP} -c pcap_compile_nopcap ${_LIBPCAP_PCAP_H} || ${TRUE}
+_BLTN_PCAP_050!= \
+ ${GREP} -c pcap_compile_nopcap ${H_LIBPCAP} || ${TRUE}
-.if ${_PCAP_083} == "1"
-BUILTIN_PKG.libpcap= libpcap-0.8.3
-.elif ${_PCAP_081} == "1"
-BUILTIN_PKG.libpcap= libpcap-0.8.1
-.elif ${_PCAP_080} == "1"
-BUILTIN_PKG.libpcap= libpcap-0.8.0
-.elif ${_PCAP_070} == "1"
-BUILTIN_PKG.libpcap= libpcap-0.7.0
-.elif ${_PCAP_060} == "1"
-BUILTIN_PKG.libpcap= libpcap-0.6.0
-.elif ${_PCAP_050} == "1"
-BUILTIN_PKG.libpcap= libpcap-0.5.0
-.else
-BUILTIN_PKG.libpcap= libpcap-0.4.0
+. if ${_BLTN_PCAP_083} == "1"
+BUILTIN_VERSION.libpcap= 0.8.3
+. elif ${_BLTN_PCAP_081} == "1"
+BUILTIN_VERSION.libpcap= 0.8.1
+. elif ${_BLTN_PCAP_080} == "1"
+BUILTIN_VERSION.libpcap= 0.8.0
+. elif ${_BLTN_PCAP_070} == "1"
+BUILTIN_VERSION.libpcap= 0.7.0
+. elif ${_BLTN_PCAP_060} == "1"
+BUILTIN_VERSION.libpcap= 0.6.0
+. elif ${_BLTN_PCAP_050} == "1"
+BUILTIN_VERSION.libpcap= 0.5.0
+. else
+BUILTIN_VERSION.libpcap= 0.4.0
+. endif
+BUILTIN_PKG.libpcap= libpcap-${BUILTIN_VERSION.libpcap}
.endif
+MAKEVARS+= BUILTIN_PKG.libpcap
-.endif # exists({_LIBPCAP_PCAP_H})
-
+###
+### Determine whether we should use the built-in implementation if it
+### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
+###
.if !defined(USE_BUILTIN.libpcap)
-USE_BUILTIN.libpcap?= ${IS_BUILTIN.libpcap}
-
-. if defined(BUILTIN_PKG.libpcap)
+. if ${PREFER.libpcap} == "pkgsrc"
+USE_BUILTIN.libpcap= no
+. else
+USE_BUILTIN.libpcap= ${IS_BUILTIN.libpcap}
+. if defined(BUILTIN_PKG.libpcap) && \
+ !empty(IS_BUILTIN.libpcap:M[yY][eE][sS])
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"; \
+. for _dep_ in ${BUILDLINK_DEPENDS.libpcap}
+. if !empty(USE_BUILTIN.libpcap:M[yY][eE][sS])
+USE_BUILTIN.libpcap!= \
+ if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.libpcap:Q}; then \
+ ${ECHO} yes; \
else \
- ${ECHO} "no"; \
+ ${ECHO} no; \
fi
-. endif
-. endfor
-. endif
-.endif # USE_BUILTIN.libpcap
-.endif # IS_BUILTIN.libpcap
+. endif
+. endfor
+. endif
+. endif # PREFER.libpcap
+.endif
+MAKEVARS+= USE_BUILTIN.libpcap