• Home
  • Raw
  • Download

Lines Matching +full:opt +full:- +full:out

1 #!/bin/awk -f
3 # scripts/options.awk - library build configuration control
5 # Copyright (c) 1998-2014 Glenn Randers-Pehrson
12 # the variable 'out'. The script is run twice, once with
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
32 out="" # intermediate, preprocessed, file
33 pre=-1 # preprocess (first line)
36 err=0 # in-line exit sets this
43 # consequence the output cannot contain a 'raw' double quote - instead put
61 deb=0 # debug - set on command line
85 out == "" {
86 print "out=output.file must be given on the command line"
91 # The very first line indicates whether we are reading pre-processed
94 pre == -1{
100 print "PREPROCESSED" >out
105 # While pre-processing if version is set to "search" look for a version string
119 print "version =", version >out
162 # Preprocessing - this just copies the input file with lines
166 print >out
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
206 print comment $0, cend >out
208 print start end >out
221 print comment, version, cend >out
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
260 opt = $2
261 sub(/,$/,"",opt)
262 onoff = option[opt] # records current (and the default is "", enabled)
271 print "option", opt ": ERROR: missing continuation line"
273 print "option", opt ": ERROR: error reading continuation line"
290 # It's easy to mis-spell the option when turning it
293 print "option", opt ": ERROR: turning unrecognized option", val
294 # For the moment error out - it is safer
302 print "option", opt ": currently", onoff ": attempt to turn", val
309 requires[opt] = requires[opt] " " val
311 iffs[opt] = iffs[opt] " " val
313 enabledby[val] = enabledby[val] " " opt
315 sets[opt] = sets[opt] " " val
319 setval[opt " " set] = setval[opt " " set] " " val
330 option[opt] = onoff
336 # chunk NAME [requires OPT] [enables LIST] [on|off|disabled]
350 opt = $2
351 sub(/,$/,"",opt)
364 print "chunk", opt ": ERROR: missing continuation line"
366 print "chunk", opt ": ERROR: error reading continuation line"
403 # Output new 'option' lines to the intermediate file (out)
404 print "option READ_" opt, "requires READ_ANCILLARY_CHUNKS" reqread,
405 "enables", opt enables , onoff >out
406 print "option WRITE_" opt, "requires WRITE_ANCILLARY_CHUNKS" reqwrite,
407 "enables", opt enables, onoff >out
410 # Else hit the error handler below - bad line format!
419 # macro is not defined. The default value will be re-tokenised.
421 # support of non-standard configurations and numeric parameters,
449 # - the 'enables', 'requires' and 'if' settings will be used to determine
466 # Makes -DMACRO equivalent to -DPNG_NO_NAME or -DPNG_NAME_SUPPORTED
477 print "#ifdef PNG_" $3 >out
479 print "# define PNG_" $2 >out
481 print "# define PNG_" $2 "_SUPPORTED" >out
482 print "#endif" >out
493 print >out
530 print "deb =", deb >out
532 print "everything =", everything >out
534 print "logunsupported =", logunsupported >out
548 print "" >out
549 print "/* OPTIONS */" >out
550 print comment, "options", cend >out
551 for (opt in enabledby) tree[opt] = 1 # may not be explicit options
552 for (opt in option) if (opt != "") {
553 o = option[opt]
559 tree[opt] = "" # so unlisted options marked
561 for (opt in tree) if (opt != "") {
562 if (tree[opt] == 1) {
563 tree[opt] = ""
564 if (option[opt] != "") {
570 option[opt] = "disabled"
576 split(requires[opt] iffs[opt] enabledby[opt], r)
578 for (i in list) tree[opt] = tree[opt] " " i
582 if (deb > 2) for (i in tree) if (i != "") print i, "depends-on" tree[i]
586 # If an option[opt] is 'on' then turn on all requires[opt]
587 # If an option[opt] is 'off' then turn off all enabledby[opt]
589 # Error out if we have to turn 'on' to an 'off' option or vice versa.
591 for (opt in option) if (opt != "") {
592 if (option[opt] == "on" || option[opt] == "off") {
593 pending[++npending] = opt
599 opt = pending[npending--]
600 if (option[opt] == "on") {
601 nreqs = split(requires[opt], r)
604 print "option", opt, "turned on, but requirement", r[j], "is turned off"
612 if (option[opt] != "off") {
616 nreqs = split(enabledby[opt], r)
619 print "option", opt, "turned off, but enabled by", r[j], "which is turned on"
631 print "PNG_DFN_START_SORT 2" >out
667 print "" >out
668 print "/* option:", i, option[i] >out
669 print " * requires: " requires[i] >out
670 print " * if: " iffs[i] >out
671 print " * enabled-by:" enabledby[i] >out
672 print " * sets: " sets[i], "*/" >out
673 print "#undef PNG_on" >out
674 print "#define PNG_on 1" >out
679 print "#ifndef PNG_" r[j] "_SUPPORTED" >out
680 print "# undef PNG_on /*!" r[j] "*/" >out
685 print error, i, "requires", r[j] end >out
687 print "#endif" >out
693 print "#undef PNG_no_if" >out
696 print "/* if" iffs[i], "*/" >out
697 print "#define PNG_no_if 1" >out
699 print "#ifdef PNG_" r[j] "_SUPPORTED" >out
700 print "# undef PNG_no_if /*" r[j] "*/" >out
701 print "#endif" >out
703 print "#ifdef PNG_no_if /*missing if*/" >out
704 print "# undef PNG_on" >out
709 print error, i, "needs one of:", iffs[i] end >out
711 print "#endif" >out
714 print "#ifdef PNG_on /*requires, if*/" >out
716 print "# undef PNG_not_enabled" >out
717 print "# define PNG_not_enabled 1" >out
718 print " /* enabled by" enabledby[i], "*/" >out
721 print "#ifdef PNG_" r[j] "_SUPPORTED" >out
722 print "# undef PNG_not_enabled /*" r[j] "*/" >out
724 # out by the checks above).
726 print error, i, "enabled by:", r[j] end >out
728 print "#endif" >out
731 print "# ifndef PNG_" i "_SUPPORTED /*!command line*/" >out
732 print "# ifdef PNG_not_enabled /*!enabled*/" >out
739 print "# undef PNG_on /*default off*/" >out
741 print "# ifdef PNG_NO_" i >out
742 print "# undef PNG_on /*turned off*/" >out
743 print "# endif" >out
744 print "# ifdef PNG_NO_" i "_SUPPORTED" >out
745 print "# undef PNG_on /*turned off*/" >out
746 print "# endif" >out
748 print "# endif /*!enabled*/" >out
749 print "# ifdef PNG_on" >out
752 print "# define PNG_" i "_SUPPORTED" >out
753 print "# endif" >out
754 print "# endif /*!command line*/" >out
757 print "# ifdef PNG_on" >out
760 "enabled by:" iffs[i] enabledby[i] ", requires" requires[i] end >out
762 print def i sup >out
766 print "# ifdef PNG_set_" r[j] >out
768 print error, i, "sets", r[j] ": duplicate setting" end >out
769 print error, " previous value: " end "PNG_set_" r[j] >out
770 print "# else" >out
775 print "# define PNG_set_" r[j], setval[i " " r[j]] >out
776 print "# endif" >out
779 print "# endif /* definition */" >out
780 print "#endif /*requires, if*/" >out
782 print "#ifndef PNG_on" >out
784 print und i une >out
788 "requires:" requires[i] ", enabled by:" iffs[i] enabledby[i] end >out
790 print "#endif" >out
809 print "PNG_DFN_END_SORT" >out
810 print comment, "end of options", cend >out
816 print "" >out
817 print "/* SETTINGS */" >out
818 print comment, "settings", cend >out
820 print "PNG_DFN_START_SORT 2" >out
849 print "" >out
850 print "/* setting: ", i >out
851 print " * requires:" setting[i] >out
852 print " * default: ", defaults[i] deflt, "*/" >out
855 print "#ifndef PNG_" r[j] "_SUPPORTED" >out
857 print "#ifndef PNG_" r[j] >out
858 print error, i, "requires", r[j] end >out
859 print "# endif" >out
867 print "#ifdef PNG_" i >out
869 print def i, subs "PNG_" i sube end >out
870 print "#else /* use default */" >out
871 print "# ifdef PNG_set_" i >out
873 print def i, subs "PNG_set_" i sube end >out
875 print "# define PNG_" i, "1" >out
877 print "# else /*default*/" >out
878 print def i deflt end >out
879 print "# define PNG_" i, "1" >out
881 print "# endif /* defaults */" >out
882 print "#endif /* setting", i, "*/" >out
896 print "PNG_DFN_END_SORT" >out
897 print comment, "end of settings", cend >out
899 # Regular end - everything looks ok
901 print start "#endif", "/*", protect, "*/" end >out