Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / mk / pf.buildlink3.mk
blob6e590339c037216a9daa36d6251d684617dd7570
1 # $NetBSD: pf.buildlink3.mk,v 1.1 2008/06/26 20:58:48 peter Exp $
3 # Makefile fragment for packages using pf.
5 # The following variables are set by this file:
7 # PFVAR_H The path to the pfvar.h header file.
8 # PFCTL The path to the pfctl program.
9 # PF_VERSION The detected PF version (as in OpenBSD).
12 .if !defined(PF_BUILDLINK3_MK)
13 PF_BUILDLINK3_MK= #defined
15 .include "../../mk/bsd.fast.prefs.mk"
17 # Platforms where pf is available on.
18 ONLY_FOR_PLATFORM?= NetBSD-[3-9]*-* OpenBSD-[3-9]*-* FreeBSD-[5-9]*-* \
19 DragonFly-*-*
21 # Detect the pfvar.h header.
22 .if exists(/usr/include/net/pfvar.h)
23 _PFVAR_H= /usr/include/net/pfvar.h
24 .elif exists(/usr/include/net/pf/pfvar.h)
25 _PFVAR_H= /usr/include/net/pf/pfvar.h
26 .else
27 PKG_FAIL_REASON+= "Couldn't find pfvar.h header; please make sure that this header is available in /usr/include/net."
28 .endif
30 PFVAR_H?= ${_PFVAR_H}
31 PFCTL?= /sbin/pfctl
33 # Compute the version number of the PF API by checking for the presence
34 # of symbols added in newer versions and store the result in ${PF_VERSION}.
36 # Default to the first version with PF, which was OpenBSD 3.0.
37 PF_VERSION= 3.0
39 .if !empty(PFVAR_H)
40 # OpenBSD 4.7: pf_state_rm_src_node added
41 _PF_4_7!= ${GREP} -c pf_state_rm_src_node ${PFVAR_H} || ${TRUE}
42 # OpenBSD 4.6: pf_normalize_mss added
43 _PF_4_6!= ${GREP} -c pf_normalize_mss ${PFVAR_H} || ${TRUE}
44 # OpenBSD 4.5: pf_send_deferred_syn added
45 _PF_4_5!= ${GREP} -c pf_send_deferred_syn ${PFVAR_H} || ${TRUE}
46 # OpenBSD 4.4: pf_match_tag added
47 _PF_4_4!= ${GREP} -c pf_match_tag ${PFVAR_H} || ${TRUE}
48 # OpenBSD 4.3: pf_match_addr_range added
49 _PF_4_3!= ${GREP} -c pf_match_addr_range ${PFVAR_H} || ${TRUE}
50 # OpenBSD 4.2: pf_statelist added
51 _PF_4_2!= ${GREP} -c pf_statelist ${PFVAR_H} || ${TRUE}
52 # OpenBSD 4.1: PF_OSFP_INET6 added
53 _PF_4_1!= ${GREP} -c PF_OSFP_INET6 ${PFVAR_H} || ${TRUE}
54 # OpenBSD 3.8: pf_socket_lookup added
55 _PF_3_8!= ${GREP} -c pf_socket_lookup ${PFVAR_H} || ${TRUE}
56 # OpenBSD 3.7: pf_threshold added
57 _PF_3_7!= ${GREP} -c pf_threshold ${PFVAR_H} || ${TRUE}
58 # OpenBSD 3.6: pf_cksum_fixup added
59 _PF_3_6!= ${GREP} -c pf_cksum_fixup ${PFVAR_H} || ${TRUE}
60 # OpenBSD 3.5: pfi_lookup_if added
61 _PF_3_5!= ${GREP} -c pfi_lookup_if ${PFVAR_H} || ${TRUE}
63 . if ${_PF_4_7} != "0"
64 PF_VERSION= 4.7
65 . elif ${_PF_4_6} != "0"
66 PF_VERSION= 4.6
67 . elif ${_PF_4_5} != "0"
68 PF_VERSION= 4.5
69 . elif ${_PF_4_4} != "0"
70 PF_VERSION= 4.4
71 . elif ${_PF_4_3} != "0"
72 PF_VERSION= 4.3
73 . elif ${_PF_4_2} != "0"
74 PF_VERSION= 4.2
75 . elif ${_PF_4_1} != "0"
76 PF_VERSION= 4.1
77 . elif ${_PF_3_8} != "0"
78 PF_VERSION= 3.8
79 . elif ${_PF_3_7} != "0"
80 PF_VERSION= 3.7
81 . elif ${_PF_3_6} != "0"
82 PF_VERSION= 3.6
83 . elif ${_PF_3_5} != "0"
84 PF_VERSION= 3.5
85 . endif
86 .endif
88 .endif # PF_BUILDLINK3_MK