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