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