* config.guess: Use double quotes on any remaining unquoted

variables to prevent globbing and word splitting.
This commit is contained in:
Ben Elliston 2018-01-16 18:09:53 +11:00
parent 9ca5f17e49
commit 827c77253b
2 changed files with 38 additions and 33 deletions

View File

@ -1,3 +1,8 @@
2018-01-16 Ben Elliston <bje@gnu.org>
* config.guess: Use double quotes on any remaining unquoted
variables to prevent globbing and word splitting.
2018-01-16 Ben Elliston <bje@gnu.org> 2018-01-16 Ben Elliston <bje@gnu.org>
* config.guess: Change most ${foo} expansions to "$foo" to: * config.guess: Change most ${foo} expansions to "$foo" to:

66
config.guess vendored
View File

@ -138,7 +138,7 @@ Linux|GNU|GNU/*)
# We could probably try harder. # We could probably try harder.
LIBC=gnu LIBC=gnu
eval $set_cc_for_build eval "$set_cc_for_build"
cat <<-EOF > "$dummy.c" cat <<-EOF > "$dummy.c"
#include <features.h> #include <features.h>
#if defined(__UCLIBC__) #if defined(__UCLIBC__)
@ -149,7 +149,7 @@ Linux|GNU|GNU/*)
LIBC=gnu LIBC=gnu
#endif #endif
EOF EOF
eval `$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
;; ;;
esac esac
@ -169,8 +169,8 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# portion of the name. We always set it to "unknown". # portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch" sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
/sbin/$sysctl 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \
echo unknown)` echo unknown)`
case "$UNAME_MACHINE_ARCH" in case "$UNAME_MACHINE_ARCH" in
armeb) machine=armeb-unknown ;; armeb) machine=armeb-unknown ;;
@ -181,7 +181,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
earmv*) earmv*)
arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
machine="$arch""$endian"-unknown machine="${arch}${endian}"-unknown
;; ;;
*) machine="$UNAME_MACHINE_ARCH"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
esac esac
@ -192,7 +192,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
os=netbsdelf os=netbsdelf
;; ;;
arm*|i386|m68k|ns32k|sh3*|sparc|vax) arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build eval "$set_cc_for_build"
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ELF__ | grep -q __ELF__
then then
@ -319,7 +319,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# A Tn.n version is a released field test version. # A Tn.n version is a released field test version.
# A Xn.n version is an unreleased experimental baselevel. # A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r. # 1.2 uses "1.2" for uname -r.
echo "$UNAME_MACHINE"-dec-osf`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
# Reset EXIT trap before exiting to avoid spurious non-zero exit code. # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
exitcode=$? exitcode=$?
trap '' 0 trap '' 0
@ -370,19 +370,19 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
sparc) echo sparc-icl-nx7; exit ;; sparc) echo sparc-icl-nx7; exit ;;
esac ;; esac ;;
s390x:SunOS:*:*) s390x:SunOS:*:*)
echo "$UNAME_MACHINE"-ibm-solaris2`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
exit ;; exit ;;
sun4H:SunOS:5.*:*) sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'` echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
exit ;; exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
exit ;; exit ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
echo i386-pc-auroraux"$UNAME_RELEASE" echo i386-pc-auroraux"$UNAME_RELEASE"
exit ;; exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build eval "$set_cc_for_build"
SUN_ARCH=i386 SUN_ARCH=i386
# If there is a compiler, see if it is configured for 64-bit objects. # If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
@ -395,13 +395,13 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
SUN_ARCH=x86_64 SUN_ARCH=x86_64
fi fi
fi fi
echo "$SUN_ARCH"-pc-solaris2`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'` echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
exit ;; exit ;;
sun4*:SunOS:6*:*) sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize # According to config.sub, this is the proper way to canonicalize
# SunOS6. Hard to guess exactly what SunOS6 will be like, but # SunOS6. Hard to guess exactly what SunOS6 will be like, but
# it's likely to be more like Solaris than SunOS4. # it's likely to be more like Solaris than SunOS4.
echo sparc-sun-solaris3`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'` echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
exit ;; exit ;;
sun4*:SunOS:*:*) sun4*:SunOS:*:*)
case "`/usr/bin/arch -k`" in case "`/usr/bin/arch -k`" in
@ -410,7 +410,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
;; ;;
esac esac
# Japanese Language versions have a version number like `4.1.3-JL'. # Japanese Language versions have a version number like `4.1.3-JL'.
echo sparc-sun-sunos`echo "$UNAME_RELEASE"|sed -e 's/-/_/'` echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
exit ;; exit ;;
sun3*:SunOS:*:*) sun3*:SunOS:*:*)
echo m68k-sun-sunos"$UNAME_RELEASE" echo m68k-sun-sunos"$UNAME_RELEASE"
@ -475,7 +475,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
echo clipper-intergraph-clix"$UNAME_RELEASE" echo clipper-intergraph-clix"$UNAME_RELEASE"
exit ;; exit ;;
mips:*:*:UMIPS | mips:*:*:RISCos) mips:*:*:UMIPS | mips:*:*:RISCos)
eval $set_cc_for_build eval "$set_cc_for_build"
sed 's/^ //' << EOF > "$dummy.c" sed 's/^ //' << EOF > "$dummy.c"
#ifdef __cplusplus #ifdef __cplusplus
#include <stdio.h> /* for printf() prototype */ #include <stdio.h> /* for printf() prototype */
@ -499,7 +499,7 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
EOF EOF
$CC_FOR_BUILD -o "$dummy" "$dummy.c" && $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
SYSTEM_NAME=`$dummy $dummyarg` && SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
{ echo "$SYSTEM_NAME"; exit; } { echo "$SYSTEM_NAME"; exit; }
echo mips-mips-riscos"$UNAME_RELEASE" echo mips-mips-riscos"$UNAME_RELEASE"
exit ;; exit ;;
@ -554,7 +554,7 @@ EOF
echo m68k-tektronix-bsd echo m68k-tektronix-bsd
exit ;; exit ;;
*:IRIX*:*:*) *:IRIX*:*:*)
echo mips-sgi-irix`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'` echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
exit ;; exit ;;
????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
@ -572,7 +572,7 @@ EOF
exit ;; exit ;;
*:AIX:2:3) *:AIX:2:3)
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
eval $set_cc_for_build eval "$set_cc_for_build"
sed 's/^ //' << EOF > "$dummy.c" sed 's/^ //' << EOF > "$dummy.c"
#include <sys/systemcfg.h> #include <sys/systemcfg.h>
@ -653,7 +653,7 @@ EOF
esac esac
fi fi
if [ "$HP_ARCH" = "" ]; then if [ "$HP_ARCH" = "" ]; then
eval $set_cc_for_build eval "$set_cc_for_build"
sed 's/^ //' << EOF > "$dummy.c" sed 's/^ //' << EOF > "$dummy.c"
#define _HPUX_SOURCE #define _HPUX_SOURCE
@ -693,7 +693,7 @@ EOF
esac esac
if [ "$HP_ARCH" = hppa2.0w ] if [ "$HP_ARCH" = hppa2.0w ]
then then
eval $set_cc_for_build eval "$set_cc_for_build"
# hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
# 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
@ -719,7 +719,7 @@ EOF
echo ia64-hp-hpux"$HPUX_REV" echo ia64-hp-hpux"$HPUX_REV"
exit ;; exit ;;
3050*:HI-UX:*:*) 3050*:HI-UX:*:*)
eval $set_cc_for_build eval "$set_cc_for_build"
sed 's/^ //' << EOF > "$dummy.c" sed 's/^ //' << EOF > "$dummy.c"
#include <unistd.h> #include <unistd.h>
int int
@ -841,7 +841,7 @@ EOF
i386) i386)
UNAME_PROCESSOR=i586 ;; UNAME_PROCESSOR=i586 ;;
esac esac
echo "$UNAME_PROCESSOR"-unknown-freebsd`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'` echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
exit ;; exit ;;
i*:CYGWIN*:*) i*:CYGWIN*:*)
echo "$UNAME_MACHINE"-pc-cygwin echo "$UNAME_MACHINE"-pc-cygwin
@ -877,15 +877,15 @@ EOF
echo x86_64-unknown-cygwin echo x86_64-unknown-cygwin
exit ;; exit ;;
prep*:SunOS:5.*:*) prep*:SunOS:5.*:*)
echo powerpcle-unknown-solaris2`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'` echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
exit ;; exit ;;
*:GNU:*:*) *:GNU:*:*)
# the GNU system # the GNU system
echo `echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-"$LIBC"`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'` echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
exit ;; exit ;;
*:GNU/*:*:*) *:GNU/*:*:*)
# other systems with GNU libc and userland # other systems with GNU libc and userland
echo "$UNAME_MACHINE"-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-"$LIBC" echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
exit ;; exit ;;
i*86:Minix:*:*) i*86:Minix:*:*)
echo "$UNAME_MACHINE"-pc-minix echo "$UNAME_MACHINE"-pc-minix
@ -915,7 +915,7 @@ EOF
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
arm*:Linux:*:*) arm*:Linux:*:*)
eval $set_cc_for_build eval "$set_cc_for_build"
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__ | grep -q __ARM_EABI__
then then
@ -964,7 +964,7 @@ EOF
echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
exit ;; exit ;;
mips:Linux:*:* | mips64:Linux:*:*) mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build eval "$set_cc_for_build"
sed 's/^ //' << EOF > "$dummy.c" sed 's/^ //' << EOF > "$dummy.c"
#undef CPU #undef CPU
#undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}
@ -979,7 +979,7 @@ EOF
#endif #endif
#endif #endif
EOF EOF
eval `$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'` eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`"
test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; }
;; ;;
mips64el:Linux:*:*) mips64el:Linux:*:*)
@ -1093,7 +1093,7 @@ EOF
*Pentium) UNAME_MACHINE=i586 ;; *Pentium) UNAME_MACHINE=i586 ;;
*Pent*|*Celeron) UNAME_MACHINE=i686 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
esac esac
echo "$UNAME_MACHINE"-unknown-sysv"$UNAME_RELEASE""$UNAME_SYSTEM""$UNAME_VERSION" echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}"
exit ;; exit ;;
i*86:*:3.2:*) i*86:*:3.2:*)
if test -f /usr/options/cb.name; then if test -f /usr/options/cb.name; then
@ -1278,11 +1278,11 @@ EOF
exit ;; exit ;;
*:Darwin:*:*) *:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
eval $set_cc_for_build eval "$set_cc_for_build"
if test "$UNAME_PROCESSOR" = unknown ; then if test "$UNAME_PROCESSOR" = unknown ; then
UNAME_PROCESSOR=powerpc UNAME_PROCESSOR=powerpc
fi fi
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then
if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
@ -1380,7 +1380,7 @@ EOF
echo mips-sei-seiux"$UNAME_RELEASE" echo mips-sei-seiux"$UNAME_RELEASE"
exit ;; exit ;;
*:DragonFly:*:*) *:DragonFly:*:*)
echo "$UNAME_MACHINE"-unknown-dragonfly`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'` echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
exit ;; exit ;;
*:*VMS:*:*) *:*VMS:*:*)
UNAME_MACHINE=`(uname -p) 2>/dev/null` UNAME_MACHINE=`(uname -p) 2>/dev/null`
@ -1393,7 +1393,7 @@ EOF
echo i386-pc-xenix echo i386-pc-xenix
exit ;; exit ;;
i*86:skyos:*:*) i*86:skyos:*:*)
echo "$UNAME_MACHINE"-pc-skyos`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
exit ;; exit ;;
i*86:rdos:*:*) i*86:rdos:*:*)
echo "$UNAME_MACHINE"-pc-rdos echo "$UNAME_MACHINE"-pc-rdos