1264663Simp#
2264663Simp# $FreeBSD$
3264663Simp#
4265399Simp# Generic mechanism to deal with WITH and WITHOUT options and turn
5265399Simp# them into MK_ options.
6264663Simp#
7273454Sjmg# For each option FOO in __DEFAULT_YES_OPTIONS, MK_FOO is set to
8265399Simp# "yes", unless WITHOUT_FOO is defined, in which case it is set to
9265399Simp# "no".
10264663Simp#
11273454Sjmg# For each option FOO in __DEFAULT_NO_OPTIONS, MK_FOO is set to "no",
12265399Simp# unless WITH_FOO is defined, in which case it is set to "yes".
13264663Simp#
14265399Simp# If both WITH_FOO and WITHOUT_FOO are defined, WITHOUT_FOO wins and
15265399Simp# MK_FOO is set to "no" regardless of which list it was in.
16264663Simp#
17265399Simp# Both __DEFAULT_YES_OPTIONS and __DEFAULT_NO_OPTIONS are undef'd
18265399Simp# after all this processing, allowing this file to be included
19265399Simp# multiple times with different lists.
20265399Simp#
21279898Simp# Other parts of the build system will set BROKEN_OPTIONS to a list
22279898Simp# of options that are broken on this platform. This will not be unset
23279898Simp# before returning. Clients are expected to always += this variable.
24279898Simp#
25265399Simp# Users should generally define WITH_FOO or WITHOUT_FOO, but the build
26265399Simp# system should use MK_FOO={yes,no} when it needs to override the
27265399Simp# user's desires or default behavior.
28265399Simp#
29265399Simp
30265399Simp#
31265399Simp# MK_* options which default to "yes".
32265399Simp#
33264663Simp.for var in ${__DEFAULT_YES_OPTIONS}
34264663Simp.if !defined(MK_${var})
35265399Simp.if defined(WITHOUT_${var})			# WITHOUT always wins
36264663SimpMK_${var}:=	no
37264663Simp.else
38264663SimpMK_${var}:=	yes
39264663Simp.endif
40278457Simp.else
41278457Simp.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
42278457Simp.error "Illegal value for MK_${var}: ${MK_${var}}"
43264663Simp.endif
44278457Simp.endif # !defined(MK_${var})
45264663Simp.endfor
46264663Simp.undef __DEFAULT_YES_OPTIONS
47264663Simp
48264663Simp#
49264663Simp# MK_* options which default to "no".
50264663Simp#
51264663Simp.for var in ${__DEFAULT_NO_OPTIONS}
52264663Simp.if !defined(MK_${var})
53265737Simp.if defined(WITH_${var}) && !defined(WITHOUT_${var}) # WITHOUT always wins
54264663SimpMK_${var}:=	yes
55264663Simp.else
56264663SimpMK_${var}:=	no
57264663Simp.endif
58278457Simp.else
59278457Simp.if ${MK_${var}} != "yes" && ${MK_${var}} != "no"
60278457Simp.error "Illegal value for MK_${var}: ${MK_${var}}"
61264663Simp.endif
62278457Simp.endif # !defined(MK_${var})
63264663Simp.endfor
64264663Simp.undef __DEFAULT_NO_OPTIONS
65279898Simp
66279898Simp#
67279898Simp# MK_* options which are always no, usually because they are
68279898Simp# unsupported/badly broken on this architecture.
69279898Simp#
70279898Simp.for var in ${BROKEN_OPTIONS}
71279898SimpMK_${var}:=	no
72279898Simp.endfor
73284050Ssjg
74284050Ssjg.for vv in ${__DEFAULT_DEPENDENT_OPTIONS}
75284050Ssjg.if defined(WITH_${vv:H}) && defined(WITHOUT_${vv:H})
76284050SsjgMK_${vv:H}?= no
77284050Ssjg.elif defined(WITH_${vv:H})
78284050SsjgMK_${vv:H}?= yes
79284050Ssjg.elif defined(WITHOUT_${vv:H})
80284050SsjgMK_${vv:H}?= no
81284050Ssjg.else
82284050SsjgMK_${vv:H}?= ${MK_${vv:T}}
83284050Ssjg.endif
84284705SsjgMK_${vv:H}:= ${MK_${vv:H}}
85284050Ssjg.endfor
86284050Ssjg.undef __DEFAULT_DEPENDENT_OPTIONS
87