| @@ -126,28 +126,30 @@ enable_multilib=$8 | | | @@ -126,28 +126,30 @@ enable_multilib=$8 |
126 | echo "static const char *const multilib_raw[] = {" | | 126 | echo "static const char *const multilib_raw[] = {" |
127 | | | 127 | |
128 | mkdir tmpmultilib.$$ || exit 1 | | 128 | mkdir tmpmultilib.$$ || exit 1 |
129 | # Use cd ./foo to avoid CDPATH output. | | 129 | # Use cd ./foo to avoid CDPATH output. |
130 | cd ./tmpmultilib.$$ || exit 1 | | 130 | cd ./tmpmultilib.$$ || exit 1 |
131 | | | 131 | |
132 | # What we want to do is select all combinations of the sets in | | 132 | # What we want to do is select all combinations of the sets in |
133 | # options. Each combination which includes a set of mutually | | 133 | # options. Each combination which includes a set of mutually |
134 | # exclusive options must then be output multiple times, once for each | | 134 | # exclusive options must then be output multiple times, once for each |
135 | # item in the set. Selecting combinations is a recursive process. | | 135 | # item in the set. Selecting combinations is a recursive process. |
136 | # Since not all versions of sh support functions, we achieve recursion | | 136 | # Since not all versions of sh support functions, we achieve recursion |
137 | # by creating a temporary shell script which invokes itself. | | 137 | # by creating a temporary shell script which invokes itself. |
138 | rm -f tmpmultilib | | 138 | rm -f tmpmultilib |
139 | cat >tmpmultilib <<\EOF | | 139 | cat >tmpmultilib <<EOF |
140 | #!${CONFIG_SHELL:-/bin/sh} | | 140 | #!${CONFIG_SHELL:-/bin/sh} |
| | | 141 | EOF |
| | | 142 | cat >>tmpmultilib <<\EOF |
141 | # This recursive script basically outputs all combinations of its | | 143 | # This recursive script basically outputs all combinations of its |
142 | # input arguments, handling mutually exclusive sets of options by | | 144 | # input arguments, handling mutually exclusive sets of options by |
143 | # repetition. When the script is called, ${initial} is the list of | | 145 | # repetition. When the script is called, ${initial} is the list of |
144 | # options which should appear before all combinations this will | | 146 | # options which should appear before all combinations this will |
145 | # output. The output looks like a list of subdirectory names with | | 147 | # output. The output looks like a list of subdirectory names with |
146 | # leading and trailing slashes. | | 148 | # leading and trailing slashes. |
147 | if [ "$#" != "0" ]; then | | 149 | if [ "$#" != "0" ]; then |
148 | first=$1 | | 150 | first=$1 |
149 | shift | | 151 | shift |
150 | case "$first" in | | 152 | case "$first" in |
151 | *\|*) | | 153 | *\|*) |
152 | all=${initial}`echo $first | sed -e 's_|_/_'g` | | 154 | all=${initial}`echo $first | sed -e 's_|_/_'g` |
153 | first=`echo $first | sed -e 's_|_ _'g` | | 155 | first=`echo $first | sed -e 's_|_ _'g` |
| @@ -162,28 +164,30 @@ if [ "$#" != "0" ]; then | | | @@ -162,28 +164,30 @@ if [ "$#" != "0" ]; then |
162 | ./tmpmultilib $@ | | 164 | ./tmpmultilib $@ |
163 | for opt in `echo $first | sed -e 's|/| |'g`; do | | 165 | for opt in `echo $first | sed -e 's|/| |'g`; do |
164 | initial="${initial}${opt}/" ./tmpmultilib $@ | | 166 | initial="${initial}${opt}/" ./tmpmultilib $@ |
165 | done | | 167 | done |
166 | esac | | 168 | esac |
167 | fi | | 169 | fi |
168 | EOF | | 170 | EOF |
169 | chmod +x tmpmultilib | | 171 | chmod +x tmpmultilib |
170 | | | 172 | |
171 | combinations=`initial=/ ./tmpmultilib ${options}` | | 173 | combinations=`initial=/ ./tmpmultilib ${options}` |
172 | | | 174 | |
173 | # If there exceptions, weed them out now | | 175 | # If there exceptions, weed them out now |
174 | if [ -n "${exceptions}" ]; then | | 176 | if [ -n "${exceptions}" ]; then |
175 | cat >tmpmultilib2 <<\EOF | | 177 | cat >tmpmultilib2 <<EOF |
176 | #!${CONFIG_SHELL:-/bin/sh} | | 178 | #!${CONFIG_SHELL:-/bin/sh} |
| | | 179 | EOF |
| | | 180 | cat >>tmpmultilib2 <<\EOF |
177 | # This recursive script weeds out any combination of multilib | | 181 | # This recursive script weeds out any combination of multilib |
178 | # switches that should not be generated. The output looks like | | 182 | # switches that should not be generated. The output looks like |
179 | # a list of subdirectory names with leading and trailing slashes. | | 183 | # a list of subdirectory names with leading and trailing slashes. |
180 | | | 184 | |
181 | for opt in $@; do | | 185 | for opt in $@; do |
182 | case "$opt" in | | 186 | case "$opt" in |
183 | EOF | | 187 | EOF |
184 | | | 188 | |
185 | for except in ${exceptions}; do | | 189 | for except in ${exceptions}; do |
186 | echo " /${except}/) : ;;" >> tmpmultilib2 | | 190 | echo " /${except}/) : ;;" >> tmpmultilib2 |
187 | done | | 191 | done |
188 | | | 192 | |
189 | cat >>tmpmultilib2 <<\EOF | | 193 | cat >>tmpmultilib2 <<\EOF |
| @@ -261,28 +265,30 @@ if [ -n "${osdirnames}" ]; then | | | @@ -261,28 +265,30 @@ if [ -n "${osdirnames}" ]; then |
261 | fi | | 265 | fi |
262 | fi | | 266 | fi |
263 | | | 267 | |
264 | # We need another recursive shell script to correctly handle positive | | 268 | # We need another recursive shell script to correctly handle positive |
265 | # matches. If we are invoked as | | 269 | # matches. If we are invoked as |
266 | # genmultilib "opt1 opt2" "" "opt1=nopt1 opt2=nopt2" | | 270 | # genmultilib "opt1 opt2" "" "opt1=nopt1 opt2=nopt2" |
267 | # we must output | | 271 | # we must output |
268 | # opt1/opt2 opt1 opt2 | | 272 | # opt1/opt2 opt1 opt2 |
269 | # opt1/opt2 nopt1 opt2 | | 273 | # opt1/opt2 nopt1 opt2 |
270 | # opt1/opt2 opt1 nopt2 | | 274 | # opt1/opt2 opt1 nopt2 |
271 | # opt1/opt2 nopt1 nopt2 | | 275 | # opt1/opt2 nopt1 nopt2 |
272 | # In other words, we must output all combinations of matches. | | 276 | # In other words, we must output all combinations of matches. |
273 | rm -f tmpmultilib2 | | 277 | rm -f tmpmultilib2 |
274 | cat >tmpmultilib2 <<\EOF | | 278 | cat >tmpmultilib2 <<EOF |
275 | #!${CONFIG_SHELL:-/bin/sh} | | 279 | #!${CONFIG_SHELL:-/bin/sh} |
| | | 280 | EOF |
| | | 281 | cat >>tmpmultilib2 <<\EOF |
276 | # The positional parameters are a list of matches to consider. | | 282 | # The positional parameters are a list of matches to consider. |
277 | # ${dirout} is the directory name and ${optout} is the current list of | | 283 | # ${dirout} is the directory name and ${optout} is the current list of |
278 | # options. | | 284 | # options. |
279 | if [ "$#" = "0" ]; then | | 285 | if [ "$#" = "0" ]; then |
280 | echo "\"${dirout} ${optout};\"," | | 286 | echo "\"${dirout} ${optout};\"," |
281 | else | | 287 | else |
282 | first=$1 | | 288 | first=$1 |
283 | shift | | 289 | shift |
284 | dirout="${dirout}" optout="${optout}" ./tmpmultilib2 $@ | | 290 | dirout="${dirout}" optout="${optout}" ./tmpmultilib2 $@ |
285 | l=`echo ${first} | sed -e 's/=.*$//' -e 's/?/=/g'` | | 291 | l=`echo ${first} | sed -e 's/=.*$//' -e 's/?/=/g'` |
286 | r=`echo ${first} | sed -e 's/^.*=//' -e 's/?/=/g'` | | 292 | r=`echo ${first} | sed -e 's/^.*=//' -e 's/?/=/g'` |
287 | if expr " ${optout} " : ".* ${l} .*" > /dev/null; then | | 293 | if expr " ${optout} " : ".* ${l} .*" > /dev/null; then |
288 | newopt=`echo " ${optout} " | sed -e "s/ ${l} / ${r} /" -e 's/^ //' -e 's/ $//'` | | 294 | newopt=`echo " ${optout} " | sed -e "s/ ${l} / ${r} /" -e 's/^ //' -e 's/ $//'` |