Sun Oct 5 23:04:00 2008 UTC ()
fix a 2 year old fix that broke genmultilib.  ${CONFIG_SHELL}
wasn't expanded inside cat >tmpmultilib<<\EOF due to the \.
use two cat's to generate these files now, one with EOF and
one with \EOF.


(mrg)
diff -r1.2 -r1.3 src/gnu/dist/gcc4/gcc/genmultilib

cvs diff -r1.2 -r1.3 src/gnu/dist/gcc4/gcc/Attic/genmultilib (expand / switch to unified diff)

--- src/gnu/dist/gcc4/gcc/Attic/genmultilib 2006/09/29 20:11:07 1.2
+++ src/gnu/dist/gcc4/gcc/Attic/genmultilib 2008/10/05 23:04:00 1.3
@@ -126,28 +126,30 @@ enable_multilib=$8 @@ -126,28 +126,30 @@ enable_multilib=$8
126echo "static const char *const multilib_raw[] = {" 126echo "static const char *const multilib_raw[] = {"
127 127
128mkdir tmpmultilib.$$ || exit 1 128mkdir tmpmultilib.$$ || exit 1
129# Use cd ./foo to avoid CDPATH output. 129# Use cd ./foo to avoid CDPATH output.
130cd ./tmpmultilib.$$ || exit 1 130cd ./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.
138rm -f tmpmultilib 138rm -f tmpmultilib
139cat >tmpmultilib <<\EOF 139cat >tmpmultilib <<EOF
140#!${CONFIG_SHELL:-/bin/sh} 140#!${CONFIG_SHELL:-/bin/sh}
 141EOF
 142cat >>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.
147if [ "$#" != "0" ]; then 149if [ "$#" != "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
167fi 169fi
168EOF 170EOF
169chmod +x tmpmultilib 171chmod +x tmpmultilib
170 172
171combinations=`initial=/ ./tmpmultilib ${options}` 173combinations=`initial=/ ./tmpmultilib ${options}`
172 174
173# If there exceptions, weed them out now 175# If there exceptions, weed them out now
174if [ -n "${exceptions}" ]; then 176if [ -n "${exceptions}" ]; then
175 cat >tmpmultilib2 <<\EOF 177 cat >tmpmultilib2 <<EOF
176#!${CONFIG_SHELL:-/bin/sh} 178#!${CONFIG_SHELL:-/bin/sh}
 179EOF
 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
183EOF 187EOF
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
189cat >>tmpmultilib2 <<\EOF 193cat >>tmpmultilib2 <<\EOF
@@ -261,28 +265,30 @@ if [ -n "${osdirnames}" ]; then @@ -261,28 +265,30 @@ if [ -n "${osdirnames}" ]; then
261 fi 265 fi
262fi 266fi
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.
273rm -f tmpmultilib2 277rm -f tmpmultilib2
274cat >tmpmultilib2 <<\EOF 278cat >tmpmultilib2 <<EOF
275#!${CONFIG_SHELL:-/bin/sh} 279#!${CONFIG_SHELL:-/bin/sh}
 280EOF
 281cat >>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.
279if [ "$#" = "0" ]; then 285if [ "$#" = "0" ]; then
280 echo "\"${dirout} ${optout};\"," 286 echo "\"${dirout} ${optout};\","
281else 287else
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/ $//'`