Sync Mk with ports
[dports.git] / Mk / bsd.options.mk
1 # $FreeBSD$
2 #
3 # These variables are used in port makefiles to define the options for a port.
4 #
5 # OPTIONS_DEFINE                - List of options this ports accept
6 # OPTIONS_DEFINE_${ARCH}        - List of options this ports accept and are
7 #                                 specific to ${ARCH}
8 # OPTIONS_DEFAULT               - List of options activated by default
9 # OPTIONS_DEFAULT_${ARCH}       - List of options activated by default for a
10 #                                 given arch
11 #
12 # ${OPTION}_DESC                - Description of the ${OPTION}
13 #
14 # OPTIONS_SINGLE                - List of single-choice grouped options: 1 and
15 #                                 only 1 among N
16 # OPTIONS_RADIO                 - List of radio-choice grouped options: 0 or 1
17 #                                 among N
18 # OPTIONS_MULTI                 - List of multiple-choice grouped options: at
19 #                                 least 1 among N
20 # OPTIONS_GROUP                 - List of group-choice grouped options: 0 or
21 #                                 more among N
22 #
23 # OPTIONS_SINGLE_${NAME}        - List of OPTIONS grouped as single choice (for
24 #                                 the single named as ${NAME} as defined in
25 #                                 OPTIONS_SINGLE)
26 # OPTIONS_RADIO_${NAME}         - List of OPTIONS grouped as radio choice (for
27 #                                 the radio named as ${NAME} as defined in
28 #                                 OPTIONS_RADIO)
29 # OPTIONS_MULTI_${NAME}         - List of OPTIONS grouped as multiple-choice
30 #                                 (for the multi named as ${NAME} as defined in
31 #                                 OPTIONS_MULTI)
32 # OPTIONS_GROUP_${NAME}         - List of OPTIONS grouped as group-choice (for
33 #                                 the group named as ${NAME} as defined in
34 #                                 OPTIONS_GROUP)
35 #
36 # OPTIONS_EXCLUDE               - List of options unsupported (useful for slave ports)
37 # OPTIONS_EXCLUDE_${ARCH}       - List of options unsupported on a given ${ARCH}
38 # OPTIONS_EXCLUDE_${OPSYS}      - List of options unsupported on a given ${OPSYS}
39 # OPTIONS_EXCLUDE_${OPSYS}_${OSREL:R} - List of options unsupported on a given
40 #                                 ${OPSYS} and major version (8/9/10...)
41 # OPTIONS_SLAVE                 - This is designed for slave ports, it removes an
42 #                                 option from the options list inherited from the
43 #                                 master port and it always adds it to PORT_OPTIONS
44 #                                 meaning activated
45 #
46 # These variables can be used in make.conf to configure options.  They are
47 # processed in the order listed below, i.e. later variables override the effects
48 # of previous variables.  Options saved using the options dialog are processed
49 # right before OPTIONS_SET_FORCE.  When building a port a dialog to configure
50 # options will only appear if there are new options, i.e. options which have not
51 # been configured before either using the option dialog in a previous build or
52 # using the variables below.  You can force the dialog to appear by running
53 # "make config".
54 #
55 # OPTIONS_SET                   - List of options to enable for all ports.
56 # OPTIONS_UNSET                 - List of options to disable for all ports.
57 # ${OPTIONS_NAME}_SET           - List of options to enable for a specific port.
58 # ${OPTIONS_NAME}_UNSET         - List of options to disable for a specific port.
59 #
60 # OPTIONS_SET_FORCE             - List of options to enable for all ports.
61 # OPTIONS_UNSET_FORCE           - List of options to disable for all ports.
62 # ${OPTIONS_NAME}_SET_FORCE     - List of options to enable for a specific port.
63 # ${OPTIONS_NAME}_UNSET_FORCE
64 #                               - List of options to disable for a specific port.
65 #
66 # These variables can be used on the command line. They override the effects of
67 # the make.conf variables above.
68 #
69 # WITH                          - Set options from the command line
70 # WITHOUT                       - Unset options from the command line
71 #
72 #
73 # These variables are strictly informational (read-only).  They indicate the
74 # current state of the selected options; they are space-delimited lists.
75 #
76 # SELECTED_OPTIONS              - list of options set "on"
77 # DESELECTED_OPTIONS            - list of options set "off"
78 #
79 #
80 # The following knobs are there to simplify the handling of OPTIONS in simple
81 # cases :
82 #
83 # OPTIONS_SUB                   When defined it will add to PLIST_SUB:
84 #                               Option enabled  ${opt}=""
85 #                               Option disabled ${opt}="@comment "
86 #
87 # ${opt}_CONFIGURE_ON           When option is enabled, it will add its content to
88 #                               the CONFIGURE_ARGS.
89 # ${opt}_CONFIGURE_OFF          When option is disabled, it will add its content to
90 #                               the CONFIGURE_ARGS.
91 # ${opt}_CONFIGURE_ENABLE       Will add to CONFIGURE_ARGS:
92 #                               Option enabled  --enable-${content}
93 #                               Option disabled --disable-${content}
94 # ${opt}_CONFIGURE_WITH         Will add to CONFIGURE_ARGS:
95 #                               Option enabled  --with-${content}
96 #                               Option disabled --without-${content}
97 #
98 # ${opt}_CMAKE_ON               When option is enabled, it will add its content to
99 #                               the CMAKE_ARGS.
100 # ${opt}_CMAKE_OFF              When option is disabled, it will add its content to
101 #                               the CMAKE_ARGS.
102 #
103 # ${opt}_CMAKE_BOOL             Will add to CMAKE_ARGS:
104 #                               Option enabled  -D${content}:BOOL=true
105 #                               Option disabled -D${content}:BOOL=false
106 # ${opt}_CMAKE_BOOL_OFF         Will add to CMAKE_ARGS:
107 #                               Option enabled  -D${content}:BOOL=false
108 #                               Option disabled -D${content}:BOOL=true
109 #
110 # ${opt}_QMAKE_ON               When option is enabled, it will add its content to
111 #                               the QMAKE_ARGS.
112 # ${opt}_QMAKE_OFF              When option is disabled, it will add its content to
113 #                               the QMAKE_ARGS.
114 #
115 # ${opt}_IMPLIES                When opt is enabled, options named in IMPLIES will
116 #                               get enabled too.
117 # ${opt}_PREVENTS               When opt is enabled, if any options in PREVENTS are
118 #                               also enabled, it will produce an error.
119 # ${opt}_PREVENTS_MSG           Provides a message explaining why the options
120 #                               cannot be selected together.
121 #
122 # ${opt}_USE=   FOO=bar         When option is enabled, it will  enable
123 #                               USE_FOO+= bar
124 #                               If you need more than one option, you can do
125 #                               FOO=bar,baz and you'll get USE_FOO=bar baz
126 # ${opt}_USE_OFF=       FOO=bar When option is disabled, it will enable
127 #                               USE_FOO+= bar
128 #
129 # ${opt}_VARS=  FOO=bar         When option is enabled, it will set
130 #                               FOO= bar
131 # ${opt}_VARS=  FOO+=bar        When option is enabled, it will append
132 #                               FOO+= bar
133 # ${opt}_VARS_OFF=    FOO=bar   When option is disabled, it will set
134 #                               FOO= bar
135 # ${opt}_VARS_OFF=    FOO+=bar  When option is disabled, it will append
136 #                               FOO+= bar
137 #
138 # For each of the depends target PKG FETCH EXTRACT PATCH BUILD LIB RUN,
139 # defining ${opt}_${deptype}_DEPENDS will add its content to the actual
140 # dependency when the option is enabled.  Defining
141 # ${opt}_${deptype}_DEPENDS_OFF will add its content to the actual dependency
142 # when the option is disabled.
143 #
144 # For each of the variables in _OPTIONS_FLAGS below, defining
145 # ${opt}_${variable} will add its content to the actual variable when the
146 # option is enabled.  Defining ${opt}_${variable}_OFF will add its content to
147 # the actual variable when the option is disabled.
148
149 ##
150 # Set all the options available for the ports, beginning with the
151 # global ones and ending with the ones decided by the maintainer.
152
153 .if !defined(OPTIONSMKINCLUDED)
154 OPTIONSMKINCLUDED=      bsd.options.mk
155
156 OPTIONS_NAME?=  ${PKGORIGIN:S/\//_/}
157 OPTIONS_FILE?=  ${PORT_DBDIR}/${OPTIONS_NAME}/options
158
159 _OPTIONS_FLAGS= ALL_TARGET BROKEN CATEGORIES CFLAGS CONFIGURE_ENV CONFLICTS \
160                 CONFLICTS_BUILD CONFLICTS_INSTALL CPPFLAGS CXXFLAGS \
161                 DESKTOP_ENTRIES DISTFILES EXTRA_PATCHES EXTRACT_ONLY \
162                 GH_ACCOUNT GH_PROJECT GH_SUBDIR GH_TAGNAME GH_TUPLE IGNORE \
163                 INFO INSTALL_TARGET LDFLAGS LIBS MAKE_ARGS MAKE_ENV \
164                 MASTER_SITES PATCHFILES PATCH_SITES PLIST_DIRS PLIST_FILES \
165                 PLIST_SUB PORTDOCS PORTEXAMPLES SUB_FILES SUB_LIST \
166                 TEST_TARGET USES
167 _OPTIONS_DEPENDS=       PKG FETCH EXTRACT PATCH BUILD LIB RUN
168
169 # The format here is target_family:priority:target-type
170 _OPTIONS_TARGETS=       fetch:300:pre fetch:500:do fetch:700:post \
171                         extract:300:pre extract:500:do extract:700:post \
172                         patch:300:pre patch:500:do patch:700:post \
173                         configure:300:pre configure:500:do configure:700:post \
174                         build:300:pre build:500:do build:700:post \
175                         install:300:pre install:500:do install:700:post  \
176                         test:300:pre test:500:do test:700:post  \
177                         package:300:pre package:500:do package:700:post \
178                         stage:800:post
179
180 # Set the default values for the global options, as defined by portmgr
181 .if !defined(NOPORTDOCS)
182 PORT_OPTIONS+=  DOCS
183 .else
184 OPTIONS_WARNINGS+=              "NOPORTDOCS"
185 WITHOUT+=                       DOCS
186 OPTIONS_WARNINGS_UNSET+=        DOCS
187 .endif
188
189 .if !defined(WITHOUT_NLS)
190 PORT_OPTIONS+=  NLS
191 .else
192 WITHOUT+=               NLS
193 .endif
194
195 .if !defined(NOPORTEXAMPLES)
196 PORT_OPTIONS+=  EXAMPLES
197 .else
198 OPTIONS_WARNINGS+=              "NOPORTEXAMPLES"
199 WITHOUT+=                       EXAMPLES
200 OPTIONS_WARNINGS_UNSET+=        EXAMPLES
201 .endif
202
203 PORT_OPTIONS+=  IPV6
204
205 # Add per arch options
206 .for opt in ${OPTIONS_DEFINE_${ARCH}}
207 .if empty(OPTIONS_DEFINE:M${opt})
208 OPTIONS_DEFINE+=        ${opt}
209 .endif
210 .endfor
211
212 # Add per arch defaults
213 OPTIONS_DEFAULT+=       ${OPTIONS_DEFAULT_${ARCH}}
214
215 _ALL_EXCLUDE=   ${OPTIONS_EXCLUDE_${ARCH}} ${OPTIONS_EXCLUDE} \
216                 ${OPTIONS_SLAVE} ${OPTIONS_EXCLUDE_${OPSYS}} \
217                 ${OPTIONS_EXCLUDE_${OPSYS}_${OSREL:R}}
218
219 .for opt in ${OPTIONS_DEFINE:O:u}
220 .  if !${_ALL_EXCLUDE:M${opt}}
221 .    for opt_implied in ${${opt}_IMPLIES}
222 .       if ${_ALL_EXCLUDE:M${opt_implied}}
223 _ALL_EXCLUDE+=  ${opt}
224 .       endif
225 .    endfor
226 .  endif
227 .endfor
228
229 # Remove options the port maintainer doesn't want
230 .for opt in ${_ALL_EXCLUDE:O:u}
231 OPTIONS_DEFAULT:=       ${OPTIONS_DEFAULT:N${opt}}
232 OPTIONS_DEFINE:=        ${OPTIONS_DEFINE:N${opt}}
233 PORT_OPTIONS:=          ${PORT_OPTIONS:N${opt}}
234 .  for otype in SINGLE RADIO MULTI GROUP
235 .    for m in ${OPTIONS_${otype}}
236 OPTIONS_${otype}_${m}:= ${OPTIONS_${otype}_${m}:N${opt}}
237 .    endfor
238 .  endfor
239 .endfor
240
241 # Remove empty SINGLE/GROUP/RADIO/MULTI
242 # Can be empty because of exclude/slaves
243 .for otype in SINGLE RADIO MULTI GROUP
244 .  for m in ${OPTIONS_${otype}}
245 .    if empty(OPTIONS_${otype}_${m})
246 OPTIONS_${otype}:=      ${OPTIONS_${otype}:N${m}}
247 .    endif
248 .  endfor
249 .endfor
250
251 # Sort options
252 ALL_OPTIONS:=   ${OPTIONS_DEFINE:O:u}
253 OPTIONS_DEFAULT:=       ${OPTIONS_DEFAULT:O:u}
254
255 # complete list
256 COMPLETE_OPTIONS_LIST=  ${ALL_OPTIONS}
257 .for otype in SINGLE RADIO MULTI GROUP
258 .  for m in ${OPTIONS_${otype}}
259 COMPLETE_OPTIONS_LIST+= ${OPTIONS_${otype}_${m}}
260 .  endfor
261 .endfor
262
263 ## Now create the list of activated options
264 .if defined(OPTIONS_OVERRIDE)
265 # Special case $OPTIONS_OVERRIDE; if it is defined forget about anything done
266 # before
267 NEW_OPTIONS=
268 PORT_OPTIONS:=  ${OPTIONS_OVERRIDE}
269 .else
270 NEW_OPTIONS=    ${COMPLETE_OPTIONS_LIST}
271
272 ## Set default options defined by the port maintainer
273 PORT_OPTIONS+=  ${OPTIONS_DEFAULT}
274
275 ## Set system-wide defined options (set by user in make.conf)
276 .  for opt in ${OPTIONS_SET}
277 .    if !empty(COMPLETE_OPTIONS_LIST:M${opt})
278 PORT_OPTIONS+=  ${opt}
279 NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
280 .    endif
281 .  endfor
282
283 ## Remove the options excluded system-wide (set by user in make.conf)
284 .  for opt in ${OPTIONS_UNSET}
285 PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
286 NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
287 .  endfor
288
289 ## Set the options specified per-port (set by user in make.conf)
290 .  for opt in ${${OPTIONS_NAME}_SET}
291 .    if !empty(COMPLETE_OPTIONS_LIST:M${opt})
292 PORT_OPTIONS+=  ${opt}
293 NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
294 .    endif
295 .  endfor
296
297 ## Unset the options excluded per-port (set by user in make.conf)
298 .  for opt in ${${OPTIONS_NAME}_UNSET}
299 PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
300 NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
301 .  endfor
302
303 ## options files (from dialog)
304 .  if exists(${OPTIONS_FILE}) && !make(rmconfig)
305 .  include "${OPTIONS_FILE}"
306 .  endif
307 .  sinclude "${OPTIONS_FILE}.local"
308
309 ### convert WITH and WITHOUT found in make.conf or reloaded from old optionsfile
310 # XXX once WITH_DEBUG is not magic any more, do remove the :NDEBUG from here.
311 .for opt in ${ALL_OPTIONS:NDEBUG}
312 .if defined(WITH_${opt})
313 OPTIONS_WARNINGS+=      "WITH_${opt}"
314 OPTIONS_WARNINGS_SET+=  ${opt}
315 PORT_OPTIONS+=  ${opt}
316 .endif
317 .if defined(WITHOUT_${opt})
318 OPTIONS_WARNINGS+=      "WITHOUT_${opt}"
319 OPTIONS_WARNINGS_UNSET+=        ${opt}
320 PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
321 .endif
322 .endfor
323
324 _OPTIONS_UNIQUENAME=    ${PKGNAMEPREFIX}${PORTNAME}
325 .for _k in SET UNSET SET_FORCE UNSET_FORCE
326 .if defined(${_OPTIONS_UNIQUENAME}_${_k})
327 WARNING+=       "You are using ${_OPTIONS_UNIQUENAME}_${_k} which is not supported any more, use:"
328 WARNING+=       "${OPTIONS_NAME}_${_k}= ${${_OPTIONS_UNIQUENAME}_${_k}}"
329 .endif
330 .endfor
331
332 .if defined(OPTIONS_WARNINGS)
333 WARNING+=       "You are using the following deprecated options: ${OPTIONS_WARNINGS}"
334 WARNING+=       "If you added them on the command line, you should replace them by"
335 WARNING+=       "WITH=\"${OPTIONS_WARNINGS_SET}\" WITHOUT=\"${OPTIONS_WARNINGS_UNSET}\""
336 WARNING+=       ""
337 WARNING+=       "If they are global options set in your make.conf, you should replace them with:"
338 .if defined(OPTIONS_WARNINGS_SET)
339 WARNING+=       "OPTIONS_SET=${OPTIONS_WARNINGS_SET}"
340 .endif
341 .if defined(OPTIONS_WARNINGS_UNSET)
342 WARNING+=       "OPTIONS_UNSET=${OPTIONS_WARNINGS_UNSET}"
343 .endif
344 WARNING+=       ""
345 WARNING+=       "If they are local to this port, you should use:"
346 .if defined(OPTIONS_WARNINGS_SET)
347 WARNING+=       "${OPTIONS_NAME}_SET=${OPTIONS_WARNINGS_SET}"
348 .endif
349 .if defined(OPTIONS_WARNINGS_UNSET)
350 WARNING+=       "${OPTIONS_NAME}_UNSET=${OPTIONS_WARNINGS_UNSET}"
351 .endif
352 .endif
353
354 ## Finish by using the options set by the port config dialog, if any
355 .  for opt in ${OPTIONS_FILE_SET}
356 .    if !empty(COMPLETE_OPTIONS_LIST:M${opt})
357 PORT_OPTIONS+=  ${opt}
358 NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
359 .    endif
360 .  endfor
361
362 .for opt in ${OPTIONS_FILE_UNSET}
363 PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
364 NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
365 .endfor
366
367 .endif
368
369 ## FORCE
370 ## Set system-wide defined options (set by user in make.conf)
371 .  for opt in ${OPTIONS_SET_FORCE}
372 .    if !empty(COMPLETE_OPTIONS_LIST:M${opt})
373 PORT_OPTIONS+=  ${opt}
374 NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
375 .    endif
376 .  endfor
377
378 ## Remove the options excluded system-wide (set by user in make.conf)
379 .  for opt in ${OPTIONS_UNSET_FORCE}
380 PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
381 NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
382 .  endfor
383
384 ## Set the options specified per-port (set by user in make.conf)
385 .  for opt in ${${OPTIONS_NAME}_SET_FORCE}
386 .    if !empty(COMPLETE_OPTIONS_LIST:M${opt})
387 PORT_OPTIONS+=  ${opt}
388 NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
389 .    endif
390 .  endfor
391
392 ## Unset the options excluded per-port (set by user in make.conf)
393 .  for opt in ${${OPTIONS_NAME}_UNSET_FORCE}
394 PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
395 NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
396 .  endfor
397
398
399 ## Cmdline always win over the rest
400 .for opt in ${WITH}
401 .  if !empty(COMPLETE_OPTIONS_LIST:M${opt})
402 PORT_OPTIONS+=  ${opt}
403 NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
404 .  endif
405 .endfor
406
407 .for opt in ${WITHOUT}
408 PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
409 NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
410 .endfor
411
412 ## Enable options implied by other options
413 # _PREVENTS is handled in bsd.port.mk:pre-check-config
414 ## 1) Build dependency chain in A.B format:
415 _DEPCHAIN=
416 .for opt in ${COMPLETE_OPTIONS_LIST}
417 .  for o in ${${opt}_IMPLIES}
418 _DEPCHAIN+=     ${opt}.$o
419 .  endfor
420 .endfor
421 ## 2) Check each dependency pair and if LHS is in PORT_OPTIONS then add RHS.
422 ##    All of RHS of "RHS.*" (i.e. indirect dependency) are also added for
423 ##    fast convergence.
424 _PORT_OPTIONS:= ${PORT_OPTIONS}
425 .for _count in _0 ${COMPLETE_OPTIONS_LIST}
426 count=  ${_count}
427 ### Check if all of the nested dependency are resolved already.
428 .  if ${count} == _0 || ${_PORT_OPTIONS} != ${PORT_OPTIONS}
429 PORT_OPTIONS:=  ${_PORT_OPTIONS}
430 .    for dc in ${_DEPCHAIN}
431 .      for opt in ${_PORT_OPTIONS}
432 _opt=${opt}
433 ### Add all of direct and indirect dependency only if
434 ### they are not in ${PORT_OPTIONS}.
435 .        if !empty(_opt:M${dc:R})
436 .          for d in ${dc:E} ${_DEPCHAIN:M${dc:E}.*:E}
437 .            if empty(_PORT_OPTIONS:M$d)
438 _PORT_OPTIONS+= $d
439 .            endif
440 .          endfor
441 .        endif
442 .      endfor
443 .    endfor
444 .  endif
445 .endfor
446
447 # Finally, add options required by slave ports
448 PORT_OPTIONS+=  ${OPTIONS_SLAVE}
449
450 # Sort options and eliminate duplicates
451 PORT_OPTIONS:=  ${PORT_OPTIONS:O:u}
452
453 ## Now some compatibility
454 .if empty(PORT_OPTIONS:MDOCS)
455 NOPORTDOCS=     yes
456 .endif
457
458 .if empty(PORT_OPTIONS:MEXAMPLES)
459 NOPORTEXAMPLES= yes
460 .endif
461
462 .if ${PORT_OPTIONS:MDEBUG}
463 WITH_DEBUG=     yes
464 .endif
465
466 .if defined(NO_OPTIONS_SORT)
467 ALL_OPTIONS=    ${OPTIONS_DEFINE}
468 .endif
469
470 .for target in ${_OPTIONS_TARGETS:C/:.*//:u}
471 _OPTIONS_${target}?=
472 .endfor
473
474 .for opt in ${COMPLETE_OPTIONS_LIST} ${_ALL_EXCLUDE:O:u}
475 # PLIST_SUB
476 PLIST_SUB?=
477 SUB_LIST?=
478 .  if defined(OPTIONS_SUB)
479 .    if ! ${PLIST_SUB:M${opt}=*}
480 .      if ${PORT_OPTIONS:M${opt}}
481 PLIST_SUB:=     ${PLIST_SUB} ${opt}="" NO_${opt}="@comment "
482 .      else
483 PLIST_SUB:=     ${PLIST_SUB} ${opt}="@comment " NO_${opt}=""
484 .      endif
485 .    endif
486 .    if ! ${SUB_LIST:M${opt}=*}
487 .      if ${PORT_OPTIONS:M${opt}}
488 SUB_LIST:=      ${SUB_LIST} ${opt}="" NO_${opt}="@comment "
489 .      else
490 SUB_LIST:=      ${SUB_LIST} ${opt}="@comment " NO_${opt}=""
491 .      endif
492 .    endif
493 .  endif
494
495 .  if ${PORT_OPTIONS:M${opt}}
496 .    if defined(${opt}_USE)
497 .      for option in ${${opt}_USE:C/=.*//:O:u}
498 _u=             ${option}
499 USE_${_u:tu}+=  ${${opt}_USE:M${option}=*:C/.*=//g:C/,/ /g}
500 .      endfor
501 .    endif
502 .    if defined(${opt}_VARS)
503 .      for var in ${${opt}_VARS:C/=.*//:O:u}
504 _u=                     ${var}
505 .        if ${_u:M*+}
506 ${_u:C/.$//:tu}+=       ${${opt}_VARS:M${var}=*:C/[^+]*\+=//:C/^"(.*)"$$/\1/}
507 .        else
508 ${_u:tu}=               ${${opt}_VARS:M${var}=*:C/[^=]*=//:C/^"(.*)"$$/\1/}
509 .        endif
510 .      endfor
511 .    endif
512 .    if defined(${opt}_CONFIGURE_ENABLE)
513 CONFIGURE_ARGS+=        ${${opt}_CONFIGURE_ENABLE:S/^/--enable-/}
514 .    endif
515 .    if defined(${opt}_CONFIGURE_WITH)
516 CONFIGURE_ARGS+=        ${${opt}_CONFIGURE_WITH:S/^/--with-/}
517 .    endif
518 .    if defined(${opt}_CMAKE_BOOL)
519 CMAKE_ARGS+=            ${${opt}_CMAKE_BOOL:C/.*/-D&:BOOL=true/}
520 .    endif
521 .    if defined(${opt}_CMAKE_BOOL_OFF)
522 CMAKE_ARGS+=            ${${opt}_CMAKE_BOOL_OFF:C/.*/-D&:BOOL=false/}
523 .    endif
524 .    for configure in CONFIGURE CMAKE QMAKE
525 .      if defined(${opt}_${configure}_ON)
526 ${configure}_ARGS+=     ${${opt}_${configure}_ON}
527 .      endif
528 .    endfor
529 .    for flags in ${_OPTIONS_FLAGS}
530 .      if defined(${opt}_${flags})
531 ${flags}+=      ${${opt}_${flags}}
532 .      endif
533 .    endfor
534 .    for deptype in ${_OPTIONS_DEPENDS}
535 .      if defined(${opt}_${deptype}_DEPENDS)
536 ${deptype}_DEPENDS+=    ${${opt}_${deptype}_DEPENDS}
537 .      endif
538 .    endfor
539 .    for target in ${_OPTIONS_TARGETS}
540 _target=        ${target:C/:.*//}
541 _prio=          ${target:C/.*:(.*):.*/\1/}
542 _type=          ${target:C/.*://}
543 _OPTIONS_${_target}:=   ${_OPTIONS_${_target}} ${_prio}:${_type}-${_target}-${opt}-on
544 .    endfor
545 .  else
546 .    if defined(${opt}_USE_OFF)
547 .      for option in ${${opt}_USE_OFF:C/=.*//:O:u}
548 _u=             ${option}
549 USE_${_u:tu}+=  ${${opt}_USE_OFF:M${option}=*:C/.*=//g:C/,/ /g}
550 .      endfor
551 .    endif
552 .    if defined(${opt}_VARS_OFF)
553 .      for var in ${${opt}_VARS_OFF:C/=.*//:O:u}
554 _u=                     ${var}
555 .        if ${_u:M*+}
556 ${_u:C/.$//:tu}+=       ${${opt}_VARS_OFF:M${var}=*:C/[^+]*\+=//:C/^"(.*)"$$/\1/}
557 .        else
558 ${_u:tu}=               ${${opt}_VARS_OFF:M${var}=*:C/[^=]*=//:C/^"(.*)"$$/\1/}
559 .        endif
560 .      endfor
561 .    endif
562 .    if defined(${opt}_CONFIGURE_ENABLE)
563 CONFIGURE_ARGS+=        ${${opt}_CONFIGURE_ENABLE:S/^/--disable-/:C/=.*//}
564 .    endif
565 .    if defined(${opt}_CONFIGURE_WITH)
566 CONFIGURE_ARGS+=        ${${opt}_CONFIGURE_WITH:S/^/--without-/:C/=.*//}
567 .    endif
568 .    if defined(${opt}_CMAKE_BOOL)
569 CMAKE_ARGS+=            ${${opt}_CMAKE_BOOL:C/.*/-D&:BOOL=false/}
570 .    endif
571 .    if defined(${opt}_CMAKE_BOOL_OFF)
572 CMAKE_ARGS+=            ${${opt}_CMAKE_BOOL_OFF:C/.*/-D&:BOOL=true/}
573 .    endif
574 .    for configure in CONFIGURE CMAKE QMAKE
575 .      if defined(${opt}_${configure}_OFF)
576 ${configure}_ARGS+=     ${${opt}_${configure}_OFF}
577 .      endif
578 .    endfor
579 .    for flags in ${_OPTIONS_FLAGS}
580 .      if defined(${opt}_${flags}_OFF)
581 ${flags}+=      ${${opt}_${flags}_OFF}
582 .      endif
583 .    endfor
584 .    for deptype in ${_OPTIONS_DEPENDS}
585 .      if defined(${opt}_${deptype}_DEPENDS_OFF)
586 ${deptype}_DEPENDS+=    ${${opt}_${deptype}_DEPENDS_OFF}
587 .      endif
588 .    endfor
589 .    for target in ${_OPTIONS_TARGETS}
590 _target=        ${target:C/:.*//}
591 _prio=          ${target:C/.*:(.*):.*/\1/}
592 _type=          ${target:C/.*://}
593 _OPTIONS_${_target}:=   ${_OPTIONS_${_target}} ${_prio}:${_type}-${_target}-${opt}-off
594 .    endfor
595 .  endif
596 .endfor
597
598 .undef (SELECTED_OPTIONS)
599 .undef (DESELECTED_OPTIONS)
600 .for opt in ${ALL_OPTIONS}
601 .  if ${PORT_OPTIONS:M${opt}}
602 SELECTED_OPTIONS:=      ${opt} ${SELECTED_OPTIONS}
603 .  else
604 DESELECTED_OPTIONS:=    ${opt} ${DESELECTED_OPTIONS}
605 .  endif
606 .endfor
607 .for otype in MULTI GROUP SINGLE RADIO
608 .  for m in ${OPTIONS_${otype}}
609 .    for opt in ${OPTIONS_${otype}_${m}}
610 .      if ${PORT_OPTIONS:M${opt}}
611 SELECTED_OPTIONS:=      ${opt} ${SELECTED_OPTIONS}
612 .      else
613 DESELECTED_OPTIONS:=    ${opt} ${DESELECTED_OPTIONS}
614 .      endif
615 .    endfor
616 .  endfor
617 .endfor
618
619 .endif