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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
# $NetBSD: features-vars.mk,v 1.11 2007/11/20 17:19:59 rillig Exp $
#
# The platforms that are supported by pkgsrc differ in the amount of
# functions they provide in the C library (libc). Functions that are
# typically available on NetBSD are provided in the libnbcomat package.
#
# This file defines a set of "features" that some packages require.
# Whenever a package makes use of them, it should list the features in
# the USE_FEATURES variable. (It serves a similar purpose as USE_TOOLS.)
#
# The *.c files that use the features must be patched a little. When
# there are missing features, the C preprocessor macro HAVE_NBCOMPAT_H
# will be defined to 1. In this case, the headers from the nbcompat
# directory must be included.
#
# === Example ===
#
# In the package Makefile:
#
# USE_FEATURES= err
#
# In the C files using the err*() or warn*() functions:
#
# #if defined(HAVE_NBCOMPAT_H)
# #include <nbcompat/cdefs.h> /* needed for the other headers */
# #include <nbcompat/err.h>
# #else
# #include <err.h>
# #endif
#
# === Package-settable variables ===
#
# USE_FEATURES
# Lists the system features required by the package.
#
# Possible:
# * err: The functions err, verr, errx, verrx.
# * warn: The functions warn, vwarn, warnx, vwarnx.
# * fts_close, fts_open, fts_read, fts_set: Functions
# for filesystem traversal.
# * getopt_long: The GNU version of getopt.
# * getprogname, setprogname
# * glob
# * regcomp
# * snprintf, vsnprintf
# * utimes
# * nbcompat: All of the above.
#
# Default value: undefined
#
# === Variables defined by this file ===
#
# MISSING_FEATURES
# The features listed in USE_FEATURES that are missing on the
# current system. Also includes "inet6" if the system doesn't
# support IPv6.
#
# Keywords: feature features
#
_VARGROUPS+= features
_USER_VARS.features= # none
_PKG_VARS.features= USE_FEATURES
_SYS_VARS.features= MISSING_FEATURES
MISSING_FEATURES= # empty
USE_FEATURES?= # none
#
# Handle "inet6" feature specially -- we always add it to
# MISSING_FEATURES if the operating system doesn't support IPv6,
# regardless of whether or not "inet6" is a requested feature
# in USE_FEATURES.
#
.if defined(_OPSYS_HAS_INET6) && !empty(_OPSYS_HAS_INET6:M[nN][oO])
MISSING_FEATURES+= inet6
.endif
.for _feature_ in err warn
. if !empty(USE_FEATURES:M${_feature_})
. if (${OPSYS} != NetBSD) && (${OPSYS} != FreeBSD) && (${OPSYS} != DragonFly)
MISSING_FEATURES+= ${_feature_}
. endif
. endif
.endfor
.for _feature_ in fts_close fts_open fts_read fts_set
. if !empty(USE_FEATURES:M${_feature_})
. if !exists(/usr/include/fts.h)
MISSING_FEATURES+= ${_feature_}
. endif
. endif
.endfor
.for _feature_ in getopt_long
. if !empty(USE_FEATURES:M${_feature_})
. if !exists(/usr/include/getopt.h)
MISSING_FEATURES+= ${_feature_}
. endif
. endif
.endfor
.for _feature_ in getprogname setprogname
. if !empty(USE_FEATURES:M${_feature_})
. if (${OPSYS} != NetBSD) && (${OPSYS} != FreeBSD) && (${OPSYS} != DragonFly)
MISSING_FEATURES+= ${_feature_}
. endif
. endif
.endfor
.for _feature_ in glob
. if !empty(USE_FEATURES:M${_feature_})
. if !exists(/usr/include/glob.h)
MISSING_FEATURES+= ${_feature_}
. endif
. endif
.endfor
.for _feature_ in regcomp
. if !empty(USE_FEATURES:M${_feature_})
. if !exists(/usr/include/regex.h)
MISSING_FEATURES+= ${_feature_}
. endif
. endif
.endfor
.for _feature_ in snprintf vsnprintf
. if !empty(USE_FEATURES:M${_feature_})
. if ${OPSYS} == "IRIX"
MISSING_FEATURES+= ${_feature_}
. endif
. endif
.endfor
.for _feature_ in utimes
. if !empty(USE_FEATURES:M${_feature_})
. if ${OPSYS} == "Interix"
MISSING_FEATURES+= ${_feature_}
. endif
. endif
.endfor
.if !empty(USE_FEATURES:Mnbcompat)
MISSING_FEATURES+= nbcompat
.endif
|