3 # scripts/options.awk - library build configuration control
5 # Copyright (c) 1998-2014 Glenn Randers-Pehrson
7 # This code is released under the libpng license.
8 # For conditions of distribution and use, see the disclaimer
11 # The output of this script is written to the file given by
12 # the variable 'out'. The script is run twice, once with
13 # an intermediate output file, 'options.tmp' then again on
14 # that file to produce the final output:
16 # awk -f scripts/options.awk out=options.tmp scripts/options.dfa 1>&2
17 # awk -f scripts/options.awk out=options.dfn options.tmp 1>&2
19 # Some options may be specified on the command line:
21 # deb=1 Causes debugging to be output
22 # logunsupported=1 Causes all options to be recorded in the output
23 # everything=off Causes all options to be disabled by default
24 # everything=on Causes all options to be enabled by default
26 # If awk fails on your platform, try nawk instead.
28 # These options may also be specified in the original input file (and
29 # are copied to the preprocessed file).
32 out="" # intermediate, preprocessed, file
33 pre=-1 # preprocess (first line)
34 version="libpng version unknown" # version information
35 version_file="" # where to find the version
36 err=0 # in-line exit sets this
37 # The following definitions prevent the C preprocessor noticing the lines
38 # that will be in the final output file. Some C preprocessors tokenise
39 # the lines, for example by inserting spaces around operators, and all
40 # C preprocessors notice lines that start with '#', most remove comments.
41 # The technique adopted here is to make the final output lines into
42 # C strings (enclosed in double quotes), preceded by PNG_DFN. As a
43 # consequence the output cannot contain a 'raw' double quote - instead put
44 # @' in, this will be replaced by a single " afterward. See the parser
45 # script dfn.awk for more capabilities (not required here). Note that if
46 # you need a " in a 'setting' in pnglibconf.dfa it must also be @'!
47 dq="@'" # For a single double quote
48 start=" PNG_DFN \"" # Start stuff to output (can't contain a "!)
49 end="\" " # End stuff to output
50 subs="@\" " # Substitute start (substitute a C macro)
51 sube=" \"@" # Substitute end
52 comment=start "/*" # Comment start
53 cend="*/" end # Comment end
54 def=start "#define PNG_" # Arbitrary define
55 sup="_SUPPORTED" end # end supported option
56 und=comment "#undef PNG_" # Unsupported option
57 une="_SUPPORTED" cend # end unsupported option
58 error=start "ERROR:" # error message, terminate with 'end'
61 deb=0 # debug - set on command line
62 everything="" # do not override defaults
63 logunsupported=0 # write unsupported options too
67 option[""] = "" # list of all options: default enabled/disabled
68 done[""] = 1 # marks option as having been output
69 requires[""] = "" # requires by option
70 iffs[""] = "" # if by option
71 enabledby[""] = "" # options that enable it by option
72 sets[""] = "" # settings set by each option
73 setval[""] = "" # value to set (indexed: 'option sets[option]')
75 setting[""] = "" # requires by setting
76 defaults[""] = "" # used for a defaulted value
77 doneset[""] = 1 # marks setting as having been output
78 r[""] = "" # Temporary array
80 # For decorating the output file
84 # The output file must be specified before any input:
86 print "out=output.file must be given on the command line"
91 # The very first line indicates whether we are reading pre-processed
92 # input or not, this must come *first* because 'PREPROCESSED' needs
93 # to be the very first line in the temporary file.
95 if ($0 == "PREPROCESSED") {
100 print "PREPROCESSED" >out
101 # And fall through to continue processing
105 # While pre-processing if version is set to "search" look for a version string
106 # in the following file.
107 pre && version == "search" && version_file == ""{
108 version_file = FILENAME
111 pre && version == "search" && version_file != FILENAME{
112 print "version string not found in", version_file
117 pre && version == "search" && $0 ~ /^ \* libpng version/{
118 version = substr($0, 4)
119 print "version =", version >out
123 pre && FILENAME == version_file{
128 # Sets the given variable to the given value (the syntax is fairly
129 # free form, except for deb (you are expected to understand how to
130 # set the debug variable...)
132 # This happens before the check on 'pre' below skips most of the
133 # rest of the actions, so the variable settings happen during
134 # preprocessing but are recorded in the END action too. This
135 # allows them to be set on the command line too.
136 $0 ~ /^[ ]*version[ ]*=/{
137 sub(/^[ ]*version[ ]*=[ ]*/, "")
141 $0 ~ /^[ ]*everything[ =]*off[ ]*$/{
145 $0 ~ /^[ ]*everything[ =]*on[ ]*$/{
149 $0 ~ /^[ ]*logunsupported[ =]*0[ ]*$/{
153 $0 ~ /^[ ]*logunsupported[ =]*1[ ]*$/{
157 $1 == "deb" && $2 == "=" && NF == 3{
162 # Preprocessing - this just copies the input file with lines
163 # that need preprocessing (just chunk at present) expanded
164 # The bare "pre" instead of "pre != 0" crashes under Sunos awk
165 pre && $1 != "chunk"{
170 # The first characters of the line determine how it is processed,
171 # leading spaces are ignored. In general tokens that are not
172 # keywords are the names of options. An option 'name' is
173 # controlled by the definition of the corresponding macros:
175 # PNG_name_SUPPORTED The option is turned on
177 # PNG_NO_name_SUPPORTED If the first macro is not defined
178 # either of these will turn the option off
180 # If none of these macros are defined the option is turned on, unless
181 # the keyword 'off' is given in a line relating to the option. The
182 # keyword 'on' can also be given, but it will be ignored (since it is
185 # In the syntax below a 'name' is indicated by "NAME", other macro
186 # values are indicated by "MACRO", as with "NAME" the leading "PNG_"
187 # is omitted, but in this case the "NO_" prefix and the "_SUPPORTED"
188 # suffix are never used.
190 # Each line is introduced by a keyword - the first non-space characters
191 # on the line. A line starting with a '#' is a comment - it is totally
192 # ignored. Keywords are as follows, a NAME, is simply a macro name
193 # without the leading PNG_, PNG_NO_ or the trailing _SUPPORTED.
195 $1 ~ /^#/ || $0 ~ /^[ ]*$/{
200 # The whole line is placed in the output file as a comment with
201 # the preceding 'com' removed
204 # sub(/^[ ]*com[ ]*/, "")
206 print comment $0, cend >out
213 # Inserts a version comment
214 $1 == "version" && NF == 1{
216 print "ERROR: no version string set"
217 err = 1 # prevent END{} running
221 print comment, version, cend >out
225 # file output input protect
226 # Informational: the official name of the input file (without
227 # make generated local directories), the official name of the
228 # output file and, if required, a name to use in a protection
229 # macro for the contents.
230 $1 == "file" && NF >= 2{
231 print comment, $2, cend >out
232 print comment, "Machine generated file: DO NOT EDIT", cend >out
234 print comment, "Derived from:", $3, cend >out
237 print start "#ifndef", protect end >out
238 print start "#define", protect end >out
243 # option NAME ( (requires|enables|if) NAME* | on | off | disabled |
244 # sets SETTING VALUE+ )*
246 # Declares an option 'NAME' and describes its default setting (disabled)
247 # and its relationship to other options. The option is disabled
248 # unless *all* the options listed after 'requires' are set and at
249 # least one of the options listed after 'if' is set. If the
250 # option is set then it turns on all the options listed after 'enables'.
252 # Note that "enables" takes priority over the required/if/disabled/off
253 # setting of the target option.
255 # The definition file may list an option as 'disabled': off by default,
256 # otherwise the option is enabled: on by default. A later (and it must
257 # be later) entry may turn an option on or off explicitly.
259 $1 == "option" && NF >= 2{
262 onoff = option[opt] # records current (and the default is "", enabled)
266 if (istart == 1) { # continuation line
269 if (val != 1) { # error reading it
271 print "option", opt ": ERROR: missing continuation line"
273 print "option", opt ": ERROR: error reading continuation line"
275 # This is a hard error
276 err = 1 # prevent END{} running
281 for (i=istart; i<=NF; ++i) {
284 if (val == "on" || val == "off" || val == "disabled" || val =="enabled") {
287 # on or off can zap disabled or enabled:
288 if (onoff == "" || (onoff == "disabled" || onoff == "enabled") &&
289 (val == "on" || val == "off")) {
290 # It's easy to mis-spell the option when turning it
291 # on or off, so warn about it here:
292 if (onoff == "" && (val == "on" || val == "off")) {
293 print "option", opt ": ERROR: turning unrecognized option", val
294 # For the moment error out - it is safer
295 err = 1 # prevent END{} running
300 # Print a message, otherwise the error
301 # below is incomprehensible
302 print "option", opt ": currently", onoff ": attempt to turn", val
306 } else if (val == "requires" || val == "if" || val == "enables" || val =="sets") {
308 } else if (key == "requires") {
309 requires[opt] = requires[opt] " " val
310 } else if (key == "if") {
311 iffs[opt] = iffs[opt] " " val
312 } else if (key == "enables") {
313 enabledby[val] = enabledby[val] " " opt
314 } else if (key == "sets") {
315 sets[opt] = sets[opt] " " val
318 } else if (key == "setval") {
319 setval[opt " " set] = setval[opt " " set] " " val
321 break # bad line format
325 } while (i > NF && $0 ~ /,$/)
328 # Set the option, defaulting to 'enabled'
329 if (onoff == "") onoff = "enabled"
333 # Else fall through to the error handler
336 # chunk NAME [requires OPT] [enables LIST] [on|off|disabled]
337 # Expands to the 'option' settings appropriate to the reading and
338 # writing of an ancillary PNG chunk 'NAME':
340 # option READ_NAME requires READ_ANCILLARY_CHUNKS [READ_OPT]
341 # option READ_NAME enables NAME LIST
342 # [option READ_NAME off]
343 # option WRITE_NAME requires WRITE_ANCILLARY_CHUNKS [WRITE_OPT]
344 # option WRITE_NAME enables NAME LIST
345 # [option WRITE_NAME off]
347 pre != 0 && $1 == "chunk" && NF >= 2{
348 # 'chunk' is handled on the first pass by writing appropriate
349 # 'option' lines into the intermediate file.
359 if (istart == 1) { # continuation line
362 if (val != 1) { # error reading it
364 print "chunk", opt ": ERROR: missing continuation line"
366 print "chunk", opt ": ERROR: error reading continuation line"
368 # This is a hard error
369 err = 1 # prevent END{} running
374 # read the keywords/additional OPTS
375 for (i=istart; i<=NF; ++i) {
378 if (val == "on" || val == "off" || val == "disabled") {
383 break # on/off conflict
386 } else if (val == "requires")
388 else if (val == "enables")
391 reqread = reqread " READ_" val
392 reqwrite = reqwrite " WRITE_" val
394 enables = enables " " val
396 break # bad line: handled below
400 } while (i > NF && $0 ~ /,$/)
403 # Output new 'option' lines to the intermediate file (out)
404 print "option READ_" opt, "requires READ_ANCILLARY_CHUNKS" reqread, "enables", opt enables , onoff >out
405 print "option WRITE_" opt, "requires WRITE_ANCILLARY_CHUNKS" reqwrite, "enables", opt enables, onoff >out
408 # Else hit the error handler below - bad line format!
411 # setting MACRO ( requires MACRO* )* [ default VALUE ]
412 # Behaves in a similar way to 'option' without looking for NO_ or
413 # _SUPPORTED; the macro is enabled if it is defined so long as all
414 # the 'requires' macros are also defined. The definitions may be
415 # empty, an error will be issued if the 'requires' macros are
416 # *not* defined. If given the 'default' value is used if the
417 # macro is not defined. The default value will be re-tokenised.
418 # (BTW: this is somewhat restrictive, it mainly exists for the
419 # support of non-standard configurations and numeric parameters,
420 # see the uses in scripts/options.dat
422 $1 == "setting" && (NF == 2 || NF >= 3 && ($3 == "requires" || $3 == "default")){
427 for (i=3; i<=NF; ++i)
428 if ($(i) == "requires" || $(i) == "default") {
430 if (key == "default") isdef = 1
431 } else if (key == "requires")
433 else if (key == "default")
434 deflt = deflt " " $(i)
436 break # Format error, handled below
439 # NOTE: this overwrites a previous value silently
440 if (isdef && deflt == "")
441 deflt = " " # as a flag to force output
446 # The order of the dependency lines (option, chunk, setting) is irrelevant
447 # - the 'enables', 'requires' and 'if' settings will be used to determine
448 # the correct order in the output and the final values in pnglibconf.h are
449 # not order dependent. 'requires' and 'if' entries take precedence over
450 # 'enables' from other options; if an option requires another option it
451 # won't be set regardless of any options that enable it unless the other
452 # option is also enabled.
454 # Similarly 'enables' trumps a NO_ definition in CFLAGS or pngusr.h
456 # For simplicity cycles in the definitions are regarded as errors,
457 # even if they are not ambiguous.
458 # A given NAME can be specified in as many 'option' lines as required, the
459 # definitions are additive.
461 # For backwards compatibility equivalent macros may be listed thus:
464 # Makes -DMACRO equivalent to -DPNG_NO_NAME or -DPNG_NAME_SUPPORTED
467 # The definition is injected into the C compiler input when encountered
468 # in the second pass (so all these definitions appear *after* the @
471 # 'NAME' is as above, but 'MACRO' is the full text of the equivalent
472 # old, deprecated, macro.
474 $1 == "=" && NF == 3{
475 print "#ifdef PNG_" $3 >out
477 print "# define PNG_" $2 >out
479 print "# define PNG_" $2 "_SUPPORTED" >out
484 # Lines may be injected into the C compiler input by preceding them
485 # with an "@" character. The line is copied with just the leading
495 # Check for unrecognized lines, because of the preprocessing chunk
496 # format errors will be detected on the first pass independent of
497 # any other format errors.
499 print "options.awk: bad line (" NR "):", $0
500 err = 1 # prevent END{} running
504 # For checking purposes names that start with "ok_" or "fail_" are
505 # not output to pnglibconf.h and must be either enabled or disabled
506 # respectively for the build to succeed. This allows interdependencies
507 # between options of the form "at least one of" or "at most one of"
508 # to be checked. For example:
510 # option FLOATING_POINT enables ok_math
511 # option FIXED_POINT enables ok_math
512 # This ensures that at least one of FLOATING_POINT and FIXED_POINT
513 # must be set for the build to succeed.
515 # option fail_math requires FLOATING_POINT FIXED_POINT
516 # This means the build will fail if *both* FLOATING_POINT and
517 # FIXED_POINT are set (this is an example; in fact both are allowed.)
519 # If all these options were given the build would require exactly one
520 # of the names to be enabled.
523 # END{} gets run on an exit (a traditional awk feature)
527 # Record the final value of the variables
528 print "deb =", deb >out
529 if (everything != "") {
530 print "everything =", everything >out
532 print "logunsupported =", logunsupported >out
536 # Do the options first (allowing options to set settings). The dependency
542 # name enabledby name
544 # First build a list 'tree' by option of all the things on which
547 print "/* OPTIONS */" >out
548 print comment, "options", cend >out
549 for (opt in enabledby) tree[opt] = 1 # may not be explicit options
550 for (opt in option) if (opt != "") {
552 # option should always be one of the following values
553 if (o != "on" && o != "off" && o != "disabled" && o != "enabled") {
554 print "internal option error (" o ")"
557 tree[opt] = "" # so unlisted options marked
559 for (opt in tree) if (opt != "") {
560 if (tree[opt] == 1) {
562 if (option[opt] != "") {
563 print "internal error (1)"
566 # Macros only listed in 'enables' remain off unless
567 # one of the enabling macros is on.
568 option[opt] = "disabled"
571 split("", list) # clear 'list'
572 # Now add every requires, iffs or enabledby entry to 'list'
573 # so that we can add a unique list of requirements to tree[i]
574 split(requires[opt] iffs[opt] enabledby[opt], r)
575 for (i in r) list[r[i]] = 1
576 for (i in list) tree[opt] = tree[opt] " " i
579 # print the tree for extreme debugging
580 if (deb > 2) for (i in tree) if (i != "") print i, "depends-on" tree[i]
582 # Ok, now check all options marked explicitly 'on' or 'off':
584 # If an option[opt] is 'on' then turn on all requires[opt]
585 # If an option[opt] is 'off' then turn off all enabledby[opt]
587 # Error out if we have to turn 'on' to an 'off' option or vice versa.
589 for (opt in option) if (opt != "") {
590 if (option[opt] == "on" || option[opt] == "off") {
591 pending[++npending] = opt
595 err = 0 # set on error
596 while (npending > 0) {
597 opt = pending[npending--]
598 if (option[opt] == "on") {
599 nreqs = split(requires[opt], r)
600 for (j=1; j<=nreqs; ++j) {
601 if (option[r[j]] == "off") {
602 print "option", opt, "turned on, but requirement", r[j], "is turned off"
604 } else if (option[r[j]] != "on") {
606 pending[++npending] = r[j]
610 if (option[opt] != "off") {
611 print "internal error (2)"
614 nreqs = split(enabledby[opt], r)
615 for (j=1; j<=nreqs; ++j) {
616 if (option[r[j]] == "on") {
617 print "option", opt, "turned off, but enabled by", r[j], "which is turned on"
619 } else if (option[r[j]] != "off") {
621 pending[++npending] = r[j]
629 print "PNG_DFN_START_SORT 2" >out
631 # option[i] is now the complete list of all the tokens we may
632 # need to output, go through it as above, depth first.
636 movement = 0 # done nothing
637 for (i in option) if (!done[i]) {
638 nreqs = split(tree[i], r)
640 for (j=1; j<=nreqs; ++j) if (!done[r[j]]) {
645 continue # next option
649 # All the requirements have been processed, output
650 # this option. An option is _SUPPORTED if:
652 # all 'requires' are _SUPPORTED AND
653 # at least one of the 'if' options are _SUPPORTED AND
655 # The name is _SUPPORTED (on the command line)
657 # an 'enabledby' is _SUPPORTED
659 # NO_name is not defined AND
660 # the option is not disabled; an option is disabled if:
662 # option == disabled && everything != on
663 # option == "" && everything == off
664 if (deb) print "option", i
666 print "/* option:", i, option[i] >out
667 print " * requires: " requires[i] >out
668 print " * if: " iffs[i] >out
669 print " * enabled-by:" enabledby[i] >out
670 print " * sets: " sets[i], "*/" >out
671 print "#undef PNG_on" >out
672 print "#define PNG_on 1" >out
675 nreqs = split(requires[i], r)
676 for (j=1; j<=nreqs; ++j) {
677 print "#ifndef PNG_" r[j] "_SUPPORTED" >out
678 print "# undef PNG_on /*!" r[j] "*/" >out
679 # This error appears in the final output if something
680 # was switched 'on' but the processing above to force
681 # the requires did not work
682 if (option[i] == "on") {
683 print error, i, "requires", r[j] end >out
690 nreqs = split(iffs[i], r)
691 print "#undef PNG_no_if" >out
694 print "/* if" iffs[i], "*/" >out
695 print "#define PNG_no_if 1" >out
696 for (j=1; j<=nreqs; ++j) {
697 print "#ifdef PNG_" r[j] "_SUPPORTED" >out
698 print "# undef PNG_no_if /*" r[j] "*/" >out
701 print "#ifdef PNG_no_if /*missing if*/" >out
702 print "# undef PNG_on" >out
703 # There is no checking above for this, because we
704 # don't know which 'if' to choose, so whine about
706 if (option[i] == "on") {
707 print error, i, "needs one of:", iffs[i] end >out
712 print "#ifdef PNG_on /*requires, if*/" >out
714 print "# undef PNG_not_enabled" >out
715 print "# define PNG_not_enabled 1" >out
716 print " /* enabled by" enabledby[i], "*/" >out
717 nreqs = split(enabledby[i], r)
718 for (j=1; j<=nreqs; ++j) {
719 print "#ifdef PNG_" r[j] "_SUPPORTED" >out
720 print "# undef PNG_not_enabled /*" r[j] "*/" >out
721 # Oops, probably not intended (should be factored
722 # out by the checks above).
723 if (option[i] == "off") {
724 print error, i, "enabled by:", r[j] end >out
729 print "# ifndef PNG_" i "_SUPPORTED /*!command line*/" >out
730 print "# ifdef PNG_not_enabled /*!enabled*/" >out
731 # 'have_ifs' here means that everything = "off" still allows an 'if' on
732 # an otherwise enabled option to turn it on; otherwise the 'if'
733 # handling is effectively disabled by 'everything = off'
734 if (option[i] == "off" || option[i] == "disabled" && everything != "on" || option[i] == "enabled" && everything == "off" && !have_ifs) {
735 print "# undef PNG_on /*default off*/" >out
737 print "# ifdef PNG_NO_" i >out
738 print "# undef PNG_on /*turned off*/" >out
740 print "# ifdef PNG_NO_" i "_SUPPORTED" >out
741 print "# undef PNG_on /*turned off*/" >out
744 print "# endif /*!enabled*/" >out
745 print "# ifdef PNG_on" >out
746 # The _SUPPORTED macro must be defined so that dependent
747 # options output later work.
748 print "# define PNG_" i "_SUPPORTED" >out
750 print "# endif /*!command line*/" >out
751 # If PNG_on is still set the option should be defined in
753 print "# ifdef PNG_on" >out
755 print error, i, "is on: enabled by:" iffs[i] enabledby[i] ", requires" requires[i] end >out
756 } else if (i !~ /^ok_/) {
758 # Supported option, set required settings
759 nreqs = split(sets[i], r)
760 for (j=1; j<=nreqs; ++j) {
761 print "# ifdef PNG_set_" r[j] >out
762 # Some other option has already set a value:
763 print error, i, "sets", r[j] ": duplicate setting" end >out
764 print error, " previous value: " end "PNG_set_" r[j] >out
766 # Else set the default: note that this won't accept arbitrary
767 # values, the setval string must be acceptable to all the C
768 # compilers we use. That means it must be VERY simple; a number,
769 # a name or a string.
770 print "# define PNG_set_" r[j], setval[i " " r[j]] >out
774 print "# endif /* definition */" >out
775 print "#endif /*requires, if*/" >out
776 if (logunsupported || i ~ /^ok_/) {
777 print "#ifndef PNG_on" >out
778 if (logunsupported) {
782 print error, i, "not enabled: requires:" requires[i] ", enabled by:" iffs[i] enabledby[i] end >out
791 if (!finished && !movement) {
792 print "option: loop or missing option in dependency tree, cannot process:"
793 for (i in option) if (!done[i]) {
794 print " option", i, "depends on" tree[i], "needs:"
795 nreqs = split(tree[i], r)
796 if (nreqs > 0) for (j=1; j<=nreqs; ++j) if (!done[r[j]]) {
803 print "PNG_DFN_END_SORT" >out
804 print comment, "end of options", cend >out
806 # Do the 'setting' values second, the algorithm the standard
807 # tree walk (O(1)) done in an O(2) while/for loop; iterations
808 # settings x depth, outputting the deepest required macros
811 print "/* SETTINGS */" >out
812 print comment, "settings", cend >out
813 # Sort (in dfn.awk) on field 2, the setting name
814 print "PNG_DFN_START_SORT 2" >out
818 movement = 0 # done nothing
819 for (i in setting) if (!doneset[i]) {
820 nreqs = split(setting[i], r)
822 # By default assume the requires values are options, but if there
823 # is no option with that name check for a setting
824 for (j=1; j<=nreqs; ++j) if (option[r[j]] == "" && !doneset[r[j]]) {
829 continue # try a different setting
833 # All the requirements have been processed, output
835 if (deb) print "setting", i
837 # Remove any spurious trailing spaces
839 # A leading @ means leave it unquoted so the preprocessor
840 # can substitute the build time value
842 deflt = " " subs substr(deflt, 3) sube
844 print "/* setting: ", i >out
845 print " * requires:" setting[i] >out
846 print " * default: ", defaults[i] deflt, "*/" >out
847 for (j=1; j<=nreqs; ++j) {
848 if (option[r[j]] != "")
849 print "#ifndef PNG_" r[j] "_SUPPORTED" >out
851 print "#ifndef PNG_" r[j] >out
852 print error, i, "requires", r[j] end >out
857 # 1) External definition; trumps:
858 # 2) Option 'sets' value; trumps:
859 # 3) Setting 'default'
861 print "#ifdef PNG_" i >out
862 # PNG_<i> is defined, so substitute the value:
863 print def i, subs "PNG_" i sube end >out
864 print "#else /* use default */" >out
865 print "# ifdef PNG_set_" i >out
866 # Value from an option 'sets' argument
867 print def i, subs "PNG_set_" i sube end >out
868 # This is so that subsequent tests on the setting work:
869 print "# define PNG_" i, "1" >out
870 if (defaults[i] != "") {
871 print "# else /*default*/" >out
872 print def i deflt end >out
873 print "# define PNG_" i, "1" >out
875 print "# endif /* defaults */" >out
876 print "#endif /* setting", i, "*/" >out
882 if (!finished && !movement) {
883 print "setting: loop or missing setting in 'requires', cannot process:"
884 for (i in setting) if (!doneset[i]) {
885 print " setting", i, "requires" setting[i]
890 print "PNG_DFN_END_SORT" >out
891 print comment, "end of settings", cend >out
893 # Regular end - everything looks ok
895 print start "#endif", "/*", protect, "*/" end >out