af05a8b72d
"pcap/pcap.h". We must therfore use "pcap/pcap.h" to detect the version of the "pcap" library on this platform.
104 lines
3.2 KiB
Makefile
104 lines
3.2 KiB
Makefile
# $NetBSD: builtin.mk,v 1.15 2009/09/13 13:07:11 tron Exp $
|
|
|
|
BUILTIN_PKG:= libpcap
|
|
|
|
.include "../../mk/bsd.fast.prefs.mk"
|
|
|
|
BUILTIN_FIND_FILES_VAR:= H_LIBPCAP
|
|
.if empty(MACHINE_PLATFORM:MDarwin-??.*-*)
|
|
BUILTIN_FIND_FILES.H_LIBPCAP= /usr/include/pcap.h
|
|
.else
|
|
BUILTIN_FIND_FILES.H_LIBPCAP= /usr/include/pcap/pcap.h
|
|
.endif
|
|
|
|
.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 empty(H_LIBPCAP:M__nonexistent__) && empty(H_LIBPCAP:M${LOCALBASE}/*)
|
|
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]) && \
|
|
empty(H_LIBPCAP:M__nonexistent__)
|
|
# libpcap>=0.9.3: pcap_setdirection added (don't use pcap_inject, this
|
|
# was hacked into the NetBSD version of 0.8.3)
|
|
_BLTN_PCAP_093!= \
|
|
${GREP} -c pcap_setdirection ${H_LIBPCAP} || ${TRUE}
|
|
# libpcap>=0.8.3: MODE_MON added
|
|
_BLTN_PCAP_083!= \
|
|
${GREP} -c MODE_MON ${H_LIBPCAP} || ${TRUE}
|
|
# libpcap>=0.8.1: pcap_get_selectable_fd added
|
|
_BLTN_PCAP_081!= \
|
|
${GREP} -c pcap_get_selectable_fd ${H_LIBPCAP} || ${TRUE}
|
|
# libpcap>=0.8.0: pcap_datalink_val_to_description added
|
|
_BLTN_PCAP_080!= \
|
|
${GREP} -c pcap_datalink_val_to_description ${H_LIBPCAP} || ${TRUE}
|
|
# libpcap>=0.7.0: pcap_setnonblock added
|
|
_BLTN_PCAP_070!= \
|
|
${GREP} -c pcap_setnonblock ${H_LIBPCAP} || ${TRUE}
|
|
# libpcap>=0.6.0: prototype change for pcap_freecode
|
|
_BLTN_PCAP_060!= \
|
|
${GREP} -c pcap_freecode.struct.bpf_program ${H_LIBPCAP} || ${TRUE}
|
|
# libpcap>=0.5.0: pcap_compile_nopcap added
|
|
_BLTN_PCAP_050!= \
|
|
${GREP} -c pcap_compile_nopcap ${H_LIBPCAP} || ${TRUE}
|
|
|
|
. if ${_BLTN_PCAP_093} == "1"
|
|
BUILTIN_VERSION.libpcap= 0.9.3nb1
|
|
. elif ${_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
|
|
|
|
###
|
|
### 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)
|
|
. 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 _dep_ in ${BUILDLINK_API_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; \
|
|
fi
|
|
. endif
|
|
. endfor
|
|
. endif
|
|
. endif # PREFER.libpcap
|
|
.endif
|
|
MAKEVARS+= USE_BUILTIN.libpcap
|