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