1e1051a39Sopenharmony_ciConfigure Internals
2e1051a39Sopenharmony_ci===================
3e1051a39Sopenharmony_ci
4e1051a39Sopenharmony_ci[ note: this file uses markdown for formatting ]
5e1051a39Sopenharmony_ci
6e1051a39Sopenharmony_ciIntro
7e1051a39Sopenharmony_ci-----
8e1051a39Sopenharmony_ci
9e1051a39Sopenharmony_ciThis is a collection of notes that are hopefully of interest to those
10e1051a39Sopenharmony_ciwho decide to dive into Configure and what it does.  This is a living
11e1051a39Sopenharmony_cidocument and anyone is encouraged to add to it and submit changes.
12e1051a39Sopenharmony_ciThere's no claim for this document to be complete at any time, but it
13e1051a39Sopenharmony_ciwill hopefully reach such a point in time.
14e1051a39Sopenharmony_ci
15e1051a39Sopenharmony_ci
16e1051a39Sopenharmony_ci----------------------------------------------------------------------
17e1051a39Sopenharmony_ci
18e1051a39Sopenharmony_ciParsing build.info files, processing conditions
19e1051a39Sopenharmony_ci-----------------------------------------------
20e1051a39Sopenharmony_ci
21e1051a39Sopenharmony_ciProcessing conditions in build.info files is done with the help of a
22e1051a39Sopenharmony_cicondition stack that tell if a build.info should be processed or if it
23e1051a39Sopenharmony_cishould just be skipped over.  The possible states of the stack top are
24e1051a39Sopenharmony_ciexpressed in the following comment from Configure:
25e1051a39Sopenharmony_ci
26e1051a39Sopenharmony_ci    # The top item of this stack has the following values
27e1051a39Sopenharmony_ci    # -2 positive already run and we found ELSE (following ELSIF should fail)
28e1051a39Sopenharmony_ci    # -1 positive already run (skip until ENDIF)
29e1051a39Sopenharmony_ci    # 0 negatives so far (if we're at a condition, check it)
30e1051a39Sopenharmony_ci    # 1 last was positive (don't skip lines until next ELSE, ELSIF or ENDIF)
31e1051a39Sopenharmony_ci    # 2 positive ELSE (following ELSIF should fail)
32e1051a39Sopenharmony_ci
33e1051a39Sopenharmony_ciGround rule is that non-condition lines are skipped over if the
34e1051a39Sopenharmony_cistack top is > 0.  Condition lines (IF, ELSIF, ELSE and ENDIF
35e1051a39Sopenharmony_cistatements) need to be processed either way to keep track of the skip
36e1051a39Sopenharmony_cistack states, so they are a little more intricate.
37e1051a39Sopenharmony_ci
38e1051a39Sopenharmony_ciInstead of trying to describe in words, here are some example of what
39e1051a39Sopenharmony_cithe skip stack should look like after each line is processed:
40e1051a39Sopenharmony_ci
41e1051a39Sopenharmony_ciExample 1:
42e1051a39Sopenharmony_ci
43e1051a39Sopenharmony_ci| IF[1]                     |  1        |                               |
44e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is processed        |
45e1051a39Sopenharmony_ci|   IF[1]                   |  1  1     |                               |
46e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is processed        |
47e1051a39Sopenharmony_ci|   ELSIF[1]                |  1 -1     |                               |
48e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
49e1051a39Sopenharmony_ci|   ELSE                    |  1 -2     |                               |
50e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
51e1051a39Sopenharmony_ci|   ENDIF                   |  1        |                               |
52e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is processed        |
53e1051a39Sopenharmony_ci| ELSIF[1]                  | -1        |                               |
54e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is skipped over     |
55e1051a39Sopenharmony_ci|   IF[1]                   | -1 -1     |                               |
56e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
57e1051a39Sopenharmony_ci|   ELSIF[1]                | -1 -1     |                               |
58e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
59e1051a39Sopenharmony_ci|   ELSE                    | -1 -2     |                               |
60e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
61e1051a39Sopenharmony_ci|   ENDIF                   | -1        |                               |
62e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is skipped over     |
63e1051a39Sopenharmony_ci| ENDIF                     |           |                               |
64e1051a39Sopenharmony_ci
65e1051a39Sopenharmony_ciExample 2:
66e1051a39Sopenharmony_ci
67e1051a39Sopenharmony_ci| IF[0]                     |  0        |                               |
68e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is skipped over     |
69e1051a39Sopenharmony_ci|   IF[1]                   |  0 -1     |                               |
70e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
71e1051a39Sopenharmony_ci|   ELSIF[1]                |  0 -1     |                               |
72e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
73e1051a39Sopenharmony_ci|   ELSE                    |  0 -2     |                               |
74e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
75e1051a39Sopenharmony_ci|   ENDIF                   |  0        |                               |
76e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is skipped over     |
77e1051a39Sopenharmony_ci| ELSIF[1]                  |  1        |                               |
78e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is processed        |
79e1051a39Sopenharmony_ci|   IF[1]                   |  1  1     |                               |
80e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is processed        |
81e1051a39Sopenharmony_ci|   ELSIF[1]                |  1 -1     |                               |
82e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
83e1051a39Sopenharmony_ci|   ELSE                    |  1 -2     |                               |
84e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
85e1051a39Sopenharmony_ci|   ENDIF                   |  1        |                               |
86e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is processed        |
87e1051a39Sopenharmony_ci| ENDIF                     |           |                               |
88e1051a39Sopenharmony_ci
89e1051a39Sopenharmony_ciExample 3:
90e1051a39Sopenharmony_ci
91e1051a39Sopenharmony_ci| IF[0]                     |  0        |                               |
92e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is skipped over     |
93e1051a39Sopenharmony_ci|   IF[0]                   |  0 -1     |                               |
94e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
95e1051a39Sopenharmony_ci|   ELSIF[1]                |  0 -1     |                               |
96e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
97e1051a39Sopenharmony_ci|   ELSE                    |  0 -2     |                               |
98e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
99e1051a39Sopenharmony_ci|   ENDIF                   |  0        |                               |
100e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is skipped over     |
101e1051a39Sopenharmony_ci| ELSIF[1]                  |  1        |                               |
102e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is processed        |
103e1051a39Sopenharmony_ci|   IF[0]                   |  1  0     |                               |
104e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
105e1051a39Sopenharmony_ci|   ELSIF[1]                |  1  1     |                               |
106e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is processed        |
107e1051a39Sopenharmony_ci|   ELSE                    |  1 -2     |                               |
108e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
109e1051a39Sopenharmony_ci|   ENDIF                   |  1        |                               |
110e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is processed        |
111e1051a39Sopenharmony_ci| ENDIF                     |           |                               |
112e1051a39Sopenharmony_ci
113e1051a39Sopenharmony_ciExample 4:
114e1051a39Sopenharmony_ci
115e1051a39Sopenharmony_ci| IF[0]                     |  0        |                               |
116e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is skipped over     |
117e1051a39Sopenharmony_ci|   IF[0]                   |  0 -1     |                               |
118e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
119e1051a39Sopenharmony_ci|   ELSIF[0]                |  0 -1     |                               |
120e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
121e1051a39Sopenharmony_ci|   ELSE                    |  0 -2     |                               |
122e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
123e1051a39Sopenharmony_ci|   ENDIF                   |  0        |                               |
124e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is skipped over     |
125e1051a39Sopenharmony_ci| ELSIF[1]                  |  1        |                               |
126e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is processed        |
127e1051a39Sopenharmony_ci|   IF[0]                   |  1  0     |                               |
128e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
129e1051a39Sopenharmony_ci|   ELSIF[0]                |  1  0     |                               |
130e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is skipped over     |
131e1051a39Sopenharmony_ci|   ELSE                    |  1  2     |                               |
132e1051a39Sopenharmony_ci|     ... whatever ...      |           | this line is processed        |
133e1051a39Sopenharmony_ci|   ENDIF                   |  1        |                               |
134e1051a39Sopenharmony_ci|   ... whatever ...        |           | this line is processed        |
135e1051a39Sopenharmony_ci| ENDIF                     |           |                               |
136e1051a39Sopenharmony_ci
137