--- gcc/genmultilib 2018/04/24 18:19:56 1.1 +++ gcc/genmultilib 2018/04/24 18:26:25 1.1.1.2 @@ -1,6 +1,6 @@ #!/bin/sh # Generates multilib.h. -# Copyright (C) 1994 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995 Free Software Foundation, Inc. #This file is part of GNU CC. @@ -16,7 +16,8 @@ #You should have received a copy of the GNU General Public License #along with GNU CC; see the file COPYING. If not, write to -#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +#the Free Software Foundation, 59 Temple Place - Suite 330, +#Boston, MA 02111-1307, USA. # This shell script produces a header file which the gcc driver # program uses to pick which library to use based on the machine @@ -39,7 +40,7 @@ # identical. The elements in the list are separated by spaces. Each # element must be of the form OPTION=OPTION. The first OPTION should # appear in the first argument, and the second should be a synonym for -# it. +# it. Question marks are replaced with equal signs in both options. # The output looks like # #define MULTILIB_MATCHES "\ @@ -58,15 +59,15 @@ # genmultilib "m68000/m68020 msoft-float" "m68000 m68020 msoft-float" # "m68000=mc68000" # This produces: -# #define MULTILIB_MATCHES "\ -# m68000/msoft-float m68000 msoft-float;\ -# m68000/msoft-float mc68000 msoft-float;\ -# m68020/msoft-float m68020 msoft-float;\ -# msoft-float !m68000 !mc68000 !m68020 msoft-float;\ -# m68000 m68000 !msoft-float;\ -# m68000 mc60000 !msoft-float;\ -# m68020 m68020 !msoft-float;\ +# #define MULTILIB_SELECT "\ # . !m68000 !mc68000 !m68020 !msoft-float;\ +# m68000 m68000 !m68020 !msoft-float;\ +# m68000 mc60000 !m68020 !msoft-float;\ +# m68020 !m68000 !mc68000 m68020 !msoft-float;\ +# msoft-float !m68000 !mc68000 !m68020 msoft-float;\ +# m68000/msoft-float m68000 !m68020 msoft-float;\ +# m68000/msoft-float mc68000 !m68020 msoft-float;\ +# m68020/msoft-float !m68000 !mc68000 m68020 msoft-float;\ # " # The effect is that `gcc -msoft-float' (for example) will append # msoft-float to the directory name when searching for libraries or @@ -132,8 +133,8 @@ fi # quoted spaces when expanding a variable. matchnegations= for i in ${matches}; do - l=`echo $i | sed -e 's/=.*$//'` - r=`echo $i | sed -e 's/^.*=//'` + l=`echo $i | sed -e 's/=.*$//' -e 's/?/=/g'` + r=`echo $i | sed -e 's/^.*=//' -e 's/?/=/g'` matchnegations="${matchnegations} -e s/;!${l};/;!${l};!${r};/" done @@ -158,14 +159,12 @@ else first=$1 shift dirout="${dirout}" optout="${optout}" ./tmpmultilib2 $@ - l=`echo ${first} | sed -e 's/=.*$//'` - r=`echo ${first} | sed -e 's/^.*=//'` - case " ${optout} " in - *" ${l} "*) + l=`echo ${first} | sed -e 's/=.*$//' -e 's/?/=/g'` + r=`echo ${first} | sed -e 's/^.*=//' -e 's/?/=/g'` + if expr " ${optout} " : ".* ${l} .*" > /dev/null; then newopt=`echo " ${optout} " | sed -e "s/ ${l} / ${r} /" -e 's/^ //' -e 's/ $//'` dirout="${dirout}" optout="${newopt}" ./tmpmultilib2 $@ - ;; - esac + fi fi EOF chmod +x tmpmultilib2 @@ -201,26 +200,17 @@ for combo in ${combinations}; do dirout=`echo ${dirout} | sed -e 's|^/||' -e 's|/$||g'` # Look through the options. We must output each option that is - # present, and negate each option that is not present. If an - # element of a set is present, we need not negate the other elements - # of the set. + # present, and negate each option that is not present. optout= for set in ${options}; do setopts=`echo ${set} | sed -e 's|/| |g'` - found= for opt in ${setopts}; do - case "${combo}" in - *"/${opt}/"*) + if expr "${combo} " : ".*/${opt}/.*" > /dev/null; then optout="${optout} ${opt}" - found=yes - ;; - esac - done - if [ "${found}" = "" ]; then - for opt in ${setopts}; do + else optout="${optout} !${opt}" - done - fi + fi + done done optout=`echo ${optout} | sed -e 's/^ //'`