aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/bsd.options.mk
blob: 37b3b2c988c03cfaeeb8044cf7170547f58e8f1f (plain) (blame)
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
# $FreeBSD$
#
# These variables are used in port makefiles to define the options for a port.
#
# OPTIONS_DEFINE        - List of options this ports accept
# OPTIONS_DEFINE_${ARCH}    - List of options this ports accept and are
#                 specific to ${ARCH}
# OPTIONS_DEFAULT       - List of options activated by default
# OPTIONS_DEFAULT_${ARCH}   - List of options activated by default for a
#                 given arch
#
# ${OPTION}_DESC        - Description of the ${OPTION}
#
# OPTIONS_SINGLE        - List of single-choice grouped options: 1 and
#                 only 1 among N
# OPTIONS_RADIO         - List of radio-choice grouped options: 0 or 1
#                 among N
# OPTIONS_MULTI         - List of multiple-choice grouped options: at
#                 least 1 among N
# OPTIONS_GROUP         - List of group-choice grouped options: 0 or
#                 more among N
#
# OPTIONS_SINGLE_${NAME}    - List of OPTIONS grouped as single choice (for
#                 the single named as ${NAME} as defined in
#                 OPTIONS_SINGLE)
# OPTIONS_RADIO_${NAME}     - List of OPTIONS grouped as radio choice (for
#                 the radio named as ${NAME} as defined in
#                 OPTIONS_RADIO)
# OPTIONS_MULTI_${NAME}     - List of OPTIONS grouped as multiple-choice
#                 (for the multi named as ${NAME} as defined in
#                 OPTIONS_MULTI)
# OPTIONS_GROUP_${NAME}     - List of OPTIONS grouped as group-choice (for
#                 the group named as ${NAME} as defined in
#                 OPTIONS_GROUP)
#
# OPTIONS_EXCLUDE       - List of options unsupported (useful for slave ports)
# OPTIONS_EXCLUDE_${ARCH}   - List of options unsupported on a given ${ARCH}
# OPTIONS_EXCLUDE_${OPSYS}  - List of options unsupported on a given ${OPSYS}
# OPTIONS_SLAVE         - This is designed for slave ports, it removes an
#                 option from the options list inherited from the
#                 master port and it always adds it to PORT_OPTIONS
#                 meaning activated
#
# These variables can be used in make.conf to configure options.  They are
# processed in the order listed below, i.e. later variables override the effects
# of previous variables.  Options saved using the options dialog are processed
# right before OPTIONS_SET_FORCE.  When building a port a dialog to configure
# options will only appear if there are new options, i.e. options which have not
# been configured before either using the option dialog in a previous build or
# using the variables below.  You can force the dialog to appear by running
# "make config".
#
# OPTIONS_SET           - List of options to enable for all ports.
# OPTIONS_UNSET         - List of options to disable for all ports.
# ${OPTIONS_NAME}_SET       - List of options to enable for a specific port.
# ${OPTIONS_NAME}_UNSET     - List of options to disable for a specific port.
#
# OPTIONS_SET_FORCE     - List of options to enable for all ports.
# OPTIONS_UNSET_FORCE       - List of options to disable for all ports.
# ${OPTIONS_NAME}_SET_FORCE - List of options to enable for a specific port.
# ${OPTIONS_NAME}_UNSET_FORCE
#               - List of options to disable for a specific port.
#
# These variables can be used on the command line. They override the effects of
# the make.conf variables above.
#
# WITH              - Set options from the command line
# WITHOUT           - Unset options from the command line
#
#
# These variables are strictly informational (read-only).  They indicate the
# current state of the selected options; they are space-delimited lists.
#
# SELECTED_OPTIONS      - list of options set "on"
# DESELECTED_OPTIONS        - list of options set "off"
#
#
# The following knobs are there to simplify the handling of OPTIONS in simple
# cases :
#
# OPTIONS_SUB           When defined it will add to PLIST_SUB:
#               Option enabled  ${opt}=""
#               Option disabled ${opt}="@comment "
#
# ${opt}_CONFIGURE_ON       When option is enabled, it will add its content to
#               the CONFIGURE_ARGS.
# ${opt}_CONFIGURE_OFF      When option is disabled, it will add its content to
#               the CONFIGURE_ARGS.
# ${opt}_CONFIGURE_ENABLE   Will add to CONFIGURE_ARGS:
#               Option enabled  --enable-${content}
#               Option disabled --disable-${content}
# ${opt}_CONFIGURE_WITH     Will add to CONFIGURE_ARGS:
#               Option enabled  --with-${content}
#               Option disabled --without-${content}
#
# ${opt}_CMAKE_ON       When option is enabled, it will add its content to
#               the CMAKE_ARGS.
# ${opt}_CMAKE_OFF      When option is disabled, it will add its content to
#               the CMAKE_ARGS.
#
# ${opt}_QMAKE_ON       When option is enabled, it will add its content to
#               the QMAKE_ARGS.
# ${opt}_QMAKE_OFF      When option is disabled, it will add its content to
#               the QMAKE_ARGS.
#
# ${opt}_IMPLIES        When opt is enabled, options named in IMPLIES will
#               get enabled too.
# ${opt}_PREVENTS       When opt is enabled, if any options in PREVENTS are
#               also enabled, it will produce an error.
# ${opt}_PREVENTS_MSG       Provides a message explaining why the options
#               cannot be selected together.
#
# ${opt}_USE=   FOO=bar     When option is enabled, it will  enable
#               USE_FOO+= bar
#               If you need more than one option, you can do
#               FOO=bar,baz and you'll get USE_FOO=bar baz
# ${opt}_USE_OFF=   FOO=bar When option is disabled, it will enable
#               USE_FOO+= bar
#
# ${opt}_VARS=  FOO=bar     When option is enabled, it will set
#               FOO= bar
# ${opt}_VARS=  FOO+=bar    When option is enabled, it will append
#               FOO+= bar
# ${opt}_VARS_OFF=    FOO=bar   When option is disabled, it will set
#               FOO= bar
# ${opt}_VARS_OFF=    FOO+=bar  When option is disabled, it will append
#               FOO+= bar
#
# For each of:
# ALL_TARGET BROKEN CATEGORIES CFLAGS CONFIGURE_ENV CONFLICTS CONFLICTS_BUILD
# CONFLICTS_INSTALL CPPFLAGS CXXFLAGS DESKTOP_ENTRIES DISTFILES EXTRA_PATCHES
# EXTRACT_ONLY GH_ACCOUNT GH_PROJECT GH_TAGNAME IGNORE INFO INSTALL_TARGET
# LDFLAGS LIBS MAKE_ARGS MAKE_ENV PATCHFILES PATCH_SITES PLIST_DIRS
# PLIST_DIRSTRY PLIST_FILES PLIST_SUB PORTDOCS PORTEXAMPLES SUB_FILES SUB_LIST
# TEST_TARGET USES,
# defining ${opt}_${variable} will add its content to the actual variable when
# the option is enabled.  Defining ${opt}_${variable}_OFF will add its content
# to the actual variable when the option is disabled.
#
# For each of the depends target PKG FETCH EXTRACT PATCH BUILD LIB RUN,
# defining ${opt}_${deptype}_DEPENDS will add its content to the actual
# dependency when the option is enabled.  Defining
# ${opt}_${deptype}_DEPENDS_OFF will add its content to the actual dependency
# when the option is disabled.

##
# Set all the options available for the ports, beginning with the
# global ones and ending with the ones decided by the maintainer.

.if !defined(OPTIONSMKINCLUDED)
OPTIONSMKINCLUDED=  bsd.options.mk

OPTIONS_NAME?=  ${PKGORIGIN:S/\//_/}
OPTIONS_FILE?=  ${PORT_DBDIR}/${OPTIONS_NAME}/options

_OPTIONS_FLAGS= ALL_TARGET BROKEN CATEGORIES CFLAGS CONFIGURE_ENV CONFLICTS \
        CONFLICTS_BUILD CONFLICTS_INSTALL CPPFLAGS CXXFLAGS \
        DESKTOP_ENTRIES DISTFILES EXTRA_PATCHES EXTRACT_ONLY \
        GH_ACCOUNT GH_PROJECT GH_TAGNAME GH_TUPLE IGNORE INFO \
        INSTALL_TARGET LDFLAGS LIBS MAKE_ARGS MAKE_ENV MASTER_SITES \
        PATCHFILES PATCH_SITES PLIST_DIRS PLIST_DIRSTRY PLIST_FILES \
        PLIST_SUB PORTDOCS PORTEXAMPLES SUB_FILES SUB_LIST \
        TEST_TARGET USES
_OPTIONS_DEPENDS=   PKG FETCH EXTRACT PATCH BUILD LIB RUN

# The format here is target_family:priority:target-type
_OPTIONS_TARGETS=   fetch:300:pre fetch:500:do fetch:700:post \
            extract:300:pre extract:500:do extract:700:post \
            patch:300:pre patch:500:do patch:700:post \
            configure:300:pre configure:500:do configure:700:post \
            build:300:pre build:500:do build:700:post \
            install:300:pre install:500:do install:700:post  \
            test:300:pre test:500:do test:700:post  \
            package:300:pre package:500:do package:700:post \
            stage:800:post

# Set the default values for the global options, as defined by portmgr
.if !defined(NOPORTDOCS)
PORT_OPTIONS+=  DOCS
.else
OPTIONS_WARNINGS+=      "NOPORTDOCS"
WITHOUT+=           DOCS
OPTIONS_WARNINGS_UNSET+=    DOCS
.endif

.if !defined(WITHOUT_NLS)
PORT_OPTIONS+=  NLS
.else
WITHOUT+=       NLS
.endif

.if !defined(NOPORTEXAMPLES)
PORT_OPTIONS+=  EXAMPLES
.else
OPTIONS_WARNINGS+=      "NOPORTEXAMPLES"
WITHOUT+=           EXAMPLES
OPTIONS_WARNINGS_UNSET+=    EXAMPLES
.endif

.if defined(DEVELOPER)
PORT_OPTIONS+=  TEST
.endif

PORT_OPTIONS+=  IPV6

# Add per arch options
.for opt in ${OPTIONS_DEFINE_${ARCH}}
.if empty(OPTIONS_DEFINE:M${opt})
OPTIONS_DEFINE+=    ${opt}
.endif
.endfor

# Add per arch defaults
OPTIONS_DEFAULT+=   ${OPTIONS_DEFAULT_${ARCH}}

_ALL_EXCLUDE=   ${OPTIONS_EXCLUDE_${ARCH}} ${OPTIONS_EXCLUDE} \
        ${OPTIONS_SLAVE} ${OPTIONS_EXCLUDE_${OPSYS}}

# Remove options the port maintainer doesn't want
.for opt in ${_ALL_EXCLUDE:O:u}
OPTIONS_DEFAULT:=   ${OPTIONS_DEFAULT:N${opt}}
OPTIONS_DEFINE:=    ${OPTIONS_DEFINE:N${opt}}
PORT_OPTIONS:=      ${PORT_OPTIONS:N${opt}}
.  for otype in SINGLE RADIO MULTI GROUP
.    for m in ${OPTIONS_${otype}}
OPTIONS_${otype}_${m}:= ${OPTIONS_${otype}_${m}:N${opt}}
.    endfor
.  endfor
.endfor

# Remove empty SINGLE/GROUP/RADIO/MULTI
# Can be empty because of exclude/slaves
.for otype in SINGLE RADIO MULTI GROUP
.  for m in ${OPTIONS_${otype}}
.    if empty(OPTIONS_${otype}_${m})
OPTIONS_${otype}:=  ${OPTIONS_${otype}:N${m}}
.    endif
.  endfor
.endfor

# Sort options
ALL_OPTIONS:=   ${OPTIONS_DEFINE:O:u}
OPTIONS_DEFAULT:=   ${OPTIONS_DEFAULT:O:u}

# complete list
COMPLETE_OPTIONS_LIST=  ${ALL_OPTIONS}
.for otype in SINGLE RADIO MULTI GROUP
.  for m in ${OPTIONS_${otype}}
COMPLETE_OPTIONS_LIST+= ${OPTIONS_${otype}_${m}}
.  endfor
.endfor

## Now create the list of activated options
.if defined(OPTIONS_OVERRIDE)
# Special case $OPTIONS_OVERRIDE; if it is defined forget about anything done
# before
NEW_OPTIONS=
PORT_OPTIONS:=  ${OPTIONS_OVERRIDE}
.else
NEW_OPTIONS=    ${COMPLETE_OPTIONS_LIST}

## Set default options defined by the port maintainer
PORT_OPTIONS+=  ${OPTIONS_DEFAULT}

## Set system-wide defined options (set by user in make.conf)
.  for opt in ${OPTIONS_SET}
.    if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+=  ${opt}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.    endif
.  endfor

## Remove the options excluded system-wide (set by user in make.conf)
.  for opt in ${OPTIONS_UNSET}
PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.  endfor

## Set the options specified per-port (set by user in make.conf)
.  for opt in ${${OPTIONS_NAME}_SET}
.    if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+=  ${opt}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.    endif
.  endfor

## Unset the options excluded per-port (set by user in make.conf)
.  for opt in ${${OPTIONS_NAME}_UNSET}
PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.  endfor

## options files (from dialog)
.  if exists(${OPTIONS_FILE}) && !make(rmconfig)
.  include "${OPTIONS_FILE}"
.  endif
.  sinclude "${OPTIONS_FILE}.local"

### convert WITH and WITHOUT found in make.conf or reloaded from old optionsfile
# XXX once WITH_DEBUG is not magic any more, do remove the :NDEBUG from here.
.for opt in ${ALL_OPTIONS:NDEBUG}
.if defined(WITH_${opt})
OPTIONS_WARNINGS+=  "WITH_${opt}"
OPTIONS_WARNINGS_SET+=  ${opt}
PORT_OPTIONS+=  ${opt}
.endif
.if defined(WITHOUT_${opt})
OPTIONS_WARNINGS+=  "WITHOUT_${opt}"
OPTIONS_WARNINGS_UNSET+=    ${opt}
PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
.endif
.endfor

_OPTIONS_UNIQUENAME=    ${PKGNAMEPREFIX}${PORTNAME}
.for _k in SET UNSET SET_FORCE UNSET_FORCE
.if defined(${_OPTIONS_UNIQUENAME}_${_k})
WARNING+=   "You are using ${_OPTIONS_UNIQUENAME}_${_k} which is not supported any more, use:"
WARNING+=   "${OPTIONS_NAME}_${_k}= ${${_OPTIONS_UNIQUENAME}_${_k}}"
.endif
.endfor

.if defined(OPTIONS_WARNINGS)
WARNING+=   "You are using the following deprecated options: ${OPTIONS_WARNINGS}"
WARNING+=   "If you added them on the command line, you should replace them by"
WARNING+=   "WITH=\"${OPTIONS_WARNINGS_SET}\" WITHOUT=\"${OPTIONS_WARNINGS_UNSET}\""
WARNING+=   ""
WARNING+=   "If they are global options set in your make.conf, you should replace them with:"
.if defined(OPTIONS_WARNINGS_SET)
WARNING+=   "OPTIONS_SET=${OPTIONS_WARNINGS_SET}"
.endif
.if defined(OPTIONS_WARNINGS_UNSET)
WARNING+=   "OPTIONS_UNSET=${OPTIONS_WARNINGS_UNSET}"
.endif
WARNING+=   ""
WARNING+=   "If they are local to this port, you should use:"
.if defined(OPTIONS_WARNINGS_SET)
WARNING+=   "${OPTIONS_NAME}_SET=${OPTIONS_WARNINGS_SET}"
.endif
.if defined(OPTIONS_WARNINGS_UNSET)
WARNING+=   "${OPTIONS_NAME}_UNSET=${OPTIONS_WARNINGS_UNSET}"
.endif
.endif

## Finish by using the options set by the port config dialog, if any
.  for opt in ${OPTIONS_FILE_SET}
.    if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+=  ${opt}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.    endif
.  endfor

.for opt in ${OPTIONS_FILE_UNSET}
PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.endfor

.endif

## FORCE
## Set system-wide defined options (set by user in make.conf)
.  for opt in ${OPTIONS_SET_FORCE}
.    if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+=  ${opt}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.    endif
.  endfor

## Remove the options excluded system-wide (set by user in make.conf)
.  for opt in ${OPTIONS_UNSET_FORCE}
PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.  endfor

## Set the options specified per-port (set by user in make.conf)
.  for opt in ${${OPTIONS_NAME}_SET_FORCE}
.    if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+=  ${opt}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.    endif
.  endfor

## Unset the options excluded per-port (set by user in make.conf)
.  for opt in ${${OPTIONS_NAME}_UNSET_FORCE}
PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.  endfor


## Cmdline always win over the rest
.for opt in ${WITH}
.  if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+=  ${opt}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.  endif
.endfor

.for opt in ${WITHOUT}
PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.endfor

## Enable options implied by other options
# _PREVENTS is handled in bsd.port.mk:pre-check-config
## 1) Build dependency chain in A.B format:
_DEPCHAIN=
.for opt in ${COMPLETE_OPTIONS_LIST}
.  for o in ${${opt}_IMPLIES}
_DEPCHAIN+= ${opt}.$o
.  endfor
.endfor
## 2) Check each dependency pair and if LHS is in PORT_OPTIONS then add RHS.
##    All of RHS of "RHS.*" (i.e. indirect dependency) are also added for
##    fast convergence.
_PORT_OPTIONS:= ${PORT_OPTIONS}
.for _count in _0 ${COMPLETE_OPTIONS_LIST}
count=  ${_count}
### Check if all of the nested dependency are resolved already.
.  if ${count} == _0 || ${_PORT_OPTIONS} != ${PORT_OPTIONS}
PORT_OPTIONS:=  ${_PORT_OPTIONS}
.    for dc in ${_DEPCHAIN}
.      for opt in ${_PORT_OPTIONS}
_opt=${opt}
### Add all of direct and indirect dependency only if
### they are not in ${PORT_OPTIONS}.
.        if !empty(_opt:M${dc:R})
.          for d in ${dc:E} ${_DEPCHAIN:M${dc:E}.*:E}
.            if empty(_PORT_OPTIONS:M$d)
_PORT_OPTIONS+= $d
.            endif
.          endfor
.        endif
.      endfor
.    endfor
.  endif
.endfor

# Finally, add options required by slave ports
PORT_OPTIONS+=  ${OPTIONS_SLAVE}

# Sort options and eliminate duplicates
PORT_OPTIONS:=  ${PORT_OPTIONS:O:u}

## Now some compatibility
.if empty(PORT_OPTIONS:MDOCS)
NOPORTDOCS= yes
.endif

.if empty(PORT_OPTIONS:MEXAMPLES)
NOPORTEXAMPLES= yes
.endif

.if ${PORT_OPTIONS:MDEBUG}
WITH_DEBUG= yes
.endif

.if defined(NO_OPTIONS_SORT)
ALL_OPTIONS=    ${OPTIONS_DEFINE}
.endif

.for target in ${_OPTIONS_TARGETS:C/:.*//:u}
_OPTIONS_${target}?=
.endfor

.for opt in ${COMPLETE_OPTIONS_LIST} ${_ALL_EXCLUDE:O:u}
# PLIST_SUB
PLIST_SUB?=
SUB_LIST?=
.  if defined(OPTIONS_SUB)
.    if ! ${PLIST_SUB:M${opt}=*}
.      if ${PORT_OPTIONS:M${opt}}
PLIST_SUB:= ${PLIST_SUB} ${opt}="" NO_${opt}="@comment "
.      else
PLIST_SUB:= ${PLIST_SUB} ${opt}="@comment " NO_${opt}=""
.      endif
.    endif
.    if ! ${SUB_LIST:M${opt}=*}
.      if ${PORT_OPTIONS:M${opt}}
SUB_LIST:=  ${SUB_LIST} ${opt}="" NO_${opt}="@comment "
.      else
SUB_LIST:=  ${SUB_LIST} ${opt}="@comment " NO_${opt}=""
.      endif
.    endif
.  endif

.  if ${PORT_OPTIONS:M${opt}}
.    if defined(${opt}_USE)
.      for option in ${${opt}_USE}
_u=     ${option:C/=.*//g}
USE_${_u:tu}+=  ${option:C/.*=//g:C/,/ /g}
.      endfor
.    endif
.    if defined(${opt}_VARS)
.      for var in ${${opt}_VARS:C/=.*//:O:u}
_u=         ${var}
.        if ${_u:M*+}
${_u:C/.$//:tu}+=   ${${opt}_VARS:M${var}=*:C/[^+]*\+=//:C/^"(.*)"$$/\1/}
.        else
${_u:tu}=       ${${opt}_VARS:M${var}=*:C/[^=]*=//:C/^"(.*)"$$/\1/}
.        endif
.      endfor
.    endif
.    if defined(${opt}_CONFIGURE_ENABLE)
CONFIGURE_ARGS+=    ${${opt}_CONFIGURE_ENABLE:S/^/--enable-/}
.    endif
.    if defined(${opt}_CONFIGURE_WITH)
CONFIGURE_ARGS+=    ${${opt}_CONFIGURE_WITH:S/^/--with-/}
.    endif
.    for configure in CONFIGURE CMAKE QMAKE
.      if defined(${opt}_${configure}_ON)
${configure}_ARGS+= ${${opt}_${configure}_ON}
.      endif
.    endfor
.    for flags in ${_OPTIONS_FLAGS}
.      if defined(${opt}_${flags})
${flags}+=  ${${opt}_${flags}}
.      endif
.    endfor
.    for deptype in ${_OPTIONS_DEPENDS}
.      if defined(${opt}_${deptype}_DEPENDS)
${deptype}_DEPENDS+=    ${${opt}_${deptype}_DEPENDS}
.      endif
.    endfor
.    for target in ${_OPTIONS_TARGETS}
_target=    ${target:C/:.*//}
_prio=      ${target:C/.*:(.*):.*/\1/}
_type=      ${target:C/.*://}
_OPTIONS_${_target}:=   ${_OPTIONS_${_target}} ${_prio}:${_type}-${_target}-${opt}-on
.    endfor
.  else
.    if defined(${opt}_USE_OFF)
.      for option in ${${opt}_USE_OFF}
_u=     ${option:C/=.*//g}
USE_${_u:tu}+=  ${option:C/.*=//g:C/,/ /g}
.      endfor
.    endif
.    if defined(${opt}_VARS_OFF)
.      for var in ${${opt}_VARS_OFF:C/=.*//:O:u}
_u=         ${var}
.        if ${_u:M*+}
${_u:C/.$//:tu}+=   ${${opt}_VARS_OFF:M${var}=*:C/[^+]*\+=//:C/^"(.*)"$$/\1/}
.        else
${_u:tu}=       ${${opt}_VARS_OFF:M${var}=*:C/[^=]*=//:C/^"(.*)"$$/\1/}
.        endif
.      endfor
.    endif
.    if defined(${opt}_CONFIGURE_ENABLE)
CONFIGURE_ARGS+=    ${${opt}_CONFIGURE_ENABLE:S/^/--disable-/:C/=.*//}
.    endif
.    if defined(${opt}_CONFIGURE_WITH)
CONFIGURE_ARGS+=    ${${opt}_CONFIGURE_WITH:S/^/--without-/:C/=.*//}
.    endif
.    for configure in CONFIGURE CMAKE QMAKE
.      if defined(${opt}_${configure}_OFF)
${configure}_ARGS+= ${${opt}_${configure}_OFF}
.      endif
.    endfor
.    for flags in ${_OPTIONS_FLAGS}
.      if defined(${opt}_${flags}_OFF)
${flags}+=  ${${opt}_${flags}_OFF}
.      endif
.    endfor
.    for deptype in ${_OPTIONS_DEPENDS}
.      if defined(${opt}_${deptype}_DEPENDS_OFF)
${deptype}_DEPENDS+=    ${${opt}_${deptype}_DEPENDS_OFF}
.      endif
.    endfor
.    for target in ${_OPTIONS_TARGETS}
_target=    ${target:C/:.*//}
_prio=      ${target:C/.*:(.*):.*/\1/}
_type=      ${target:C/.*://}
_OPTIONS_${_target}:=   ${_OPTIONS_${_target}} ${_prio}:${_type}-${_target}-${opt}-off
.    endfor
.  endif
.endfor

.undef (SELECTED_OPTIONS)
.undef (DESELECTED_OPTIONS)
.for opt in ${ALL_OPTIONS}
.  if ${PORT_OPTIONS:M${opt}}
SELECTED_OPTIONS:=  ${opt} ${SELECTED_OPTIONS}
.  else
DESELECTED_OPTIONS:=    ${opt} ${DESELECTED_OPTIONS}
.  endif
.endfor
.for otype in MULTI GROUP SINGLE RADIO
.  for m in ${OPTIONS_${otype}}
.    for opt in ${OPTIONS_${otype}_${m}}
.      if ${PORT_OPTIONS:M${opt}}
SELECTED_OPTIONS:=  ${opt} ${SELECTED_OPTIONS}
.      else
DESELECTED_OPTIONS:=    ${opt} ${DESELECTED_OPTIONS}
.      endif
.    endfor
.  endfor
.endfor

.endif