Browse code

Merge pull request #24 from Yikun/master

Update ClustalOmega/ClustalW config.guess to latest

UBod authored on 20/02/2023 12:25:03 • GitHub committed on 20/02/2023 12:25:03
Showing 4 changed files

... ...
@@ -1,14 +1,12 @@
1 1
 #! /bin/sh
2 2
 # Attempt to guess a canonical system name.
3
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
5
-#   Free Software Foundation, Inc.
3
+#   Copyright 1992-2021 Free Software Foundation, Inc.
6 4
 
7
-timestamp='2008-01-23'
5
+timestamp='2021-01-01'
8 6
 
9 7
 # This file is free software; you can redistribute it and/or modify it
10 8
 # under the terms of the GNU General Public License as published by
11
-# the Free Software Foundation; either version 2 of the License, or
9
+# the Free Software Foundation; either version 3 of the License, or
12 10
 # (at your option) any later version.
13 11
 #
14 12
 # This program is distributed in the hope that it will be useful, but
... ...
@@ -17,35 +15,31 @@ timestamp='2008-01-23'
17 15
 # General Public License for more details.
18 16
 #
19 17
 # You should have received a copy of the GNU General Public License
20
-# along with this program; if not, write to the Free Software
21
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
22
-# 02110-1301, USA.
18
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
23 19
 #
24 20
 # As a special exception to the GNU General Public License, if you
25 21
 # distribute this file as part of a program that contains a
26 22
 # configuration script generated by Autoconf, you may include it under
27
-# the same distribution terms that you use for the rest of that program.
28
-
29
-
30
-# Originally written by Per Bothner <per@bothner.com>.
31
-# Please send patches to <config-patches@gnu.org>.  Submit a context
32
-# diff and a properly formatted ChangeLog entry.
23
+# the same distribution terms that you use for the rest of that
24
+# program.  This Exception is an additional permission under section 7
25
+# of the GNU General Public License, version 3 ("GPLv3").
33 26
 #
34
-# This script attempts to guess a canonical system name similar to
35
-# config.sub.  If it succeeds, it prints the system name on stdout, and
36
-# exits with 0.  Otherwise, it exits with 1.
27
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
37 28
 #
38
-# The plan is that this can be called by configure scripts if you
39
-# don't specify an explicit build system type.
29
+# You can get the latest version of this script from:
30
+# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess
31
+#
32
+# Please send patches to <config-patches@gnu.org>.
33
+
40 34
 
41
-me=`echo "$0" | sed -e 's,.*/,,'`
35
+me=$(echo "$0" | sed -e 's,.*/,,')
42 36
 
43 37
 usage="\
44 38
 Usage: $0 [OPTION]
45 39
 
46 40
 Output the configuration name of the system \`$me' is run on.
47 41
 
48
-Operation modes:
42
+Options:
49 43
   -h, --help         print this help, then exit
50 44
   -t, --time-stamp   print date of last modification, then exit
51 45
   -v, --version      print version number, then exit
... ...
@@ -56,8 +50,7 @@ version="\
56 50
 GNU config.guess ($timestamp)
57 51
 
58 52
 Originally written by Per Bothner.
59
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
60
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
53
+Copyright 1992-2021 Free Software Foundation, Inc.
61 54
 
62 55
 This is free software; see the source for copying conditions.  There is NO
63 56
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
... ...
@@ -91,8 +84,6 @@ if test $# != 0; then
91 84
   exit 1
92 85
 fi
93 86
 
94
-trap 'exit 1' 1 2 15
95
-
96 87
 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
97 88
 # compiler to aid in system detection is discouraged as it requires
98 89
 # temporary files to be created and, as you can see below, it is a
... ...
@@ -103,48 +94,92 @@ trap 'exit 1' 1 2 15
103 94
 
104 95
 # Portable tmp directory creation inspired by the Autoconf team.
105 96
 
106
-set_cc_for_build='
107
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
108
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
109
-: ${TMPDIR=/tmp} ;
110
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
111
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
112
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
113
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
114
-dummy=$tmp/dummy ;
115
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
116
-case $CC_FOR_BUILD,$HOST_CC,$CC in
117
- ,,)    echo "int x;" > $dummy.c ;
118
-	for c in cc gcc c89 c99 ; do
119
-	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
120
-	     CC_FOR_BUILD="$c"; break ;
121
-	  fi ;
122
-	done ;
123
-	if test x"$CC_FOR_BUILD" = x ; then
124
-	  CC_FOR_BUILD=no_compiler_found ;
125
-	fi
126
-	;;
127
- ,,*)   CC_FOR_BUILD=$CC ;;
128
- ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
129
-esac ; set_cc_for_build= ;'
97
+tmp=
98
+# shellcheck disable=SC2172
99
+trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
100
+
101
+set_cc_for_build() {
102
+    # prevent multiple calls if $tmp is already set
103
+    test "$tmp" && return 0
104
+    : "${TMPDIR=/tmp}"
105
+    # shellcheck disable=SC2039
106
+    { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } ||
107
+	{ test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } ||
108
+	{ tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } ||
109
+	{ echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; }
110
+    dummy=$tmp/dummy
111
+    case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in
112
+	,,)    echo "int x;" > "$dummy.c"
113
+	       for driver in cc gcc c89 c99 ; do
114
+		   if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then
115
+		       CC_FOR_BUILD="$driver"
116
+		       break
117
+		   fi
118
+	       done
119
+	       if test x"$CC_FOR_BUILD" = x ; then
120
+		   CC_FOR_BUILD=no_compiler_found
121
+	       fi
122
+	       ;;
123
+	,,*)   CC_FOR_BUILD=$CC ;;
124
+	,*,*)  CC_FOR_BUILD=$HOST_CC ;;
125
+    esac
126
+}
130 127
 
131 128
 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
132 129
 # (ghazi@noc.rutgers.edu 1994-08-24)
133
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
130
+if test -f /.attbin/uname ; then
134 131
 	PATH=$PATH:/.attbin ; export PATH
135 132
 fi
136 133
 
137
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
138
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
139
-UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
140
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
134
+UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown
135
+UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown
136
+UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown
137
+UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown
138
+
139
+case "$UNAME_SYSTEM" in
140
+Linux|GNU|GNU/*)
141
+	LIBC=unknown
142
+
143
+	set_cc_for_build
144
+	cat <<-EOF > "$dummy.c"
145
+	#include <features.h>
146
+	#if defined(__UCLIBC__)
147
+	LIBC=uclibc
148
+	#elif defined(__dietlibc__)
149
+	LIBC=dietlibc
150
+	#elif defined(__GLIBC__)
151
+	LIBC=gnu
152
+	#else
153
+	#include <stdarg.h>
154
+	/* First heuristic to detect musl libc.  */
155
+	#ifdef __DEFINED_va_list
156
+	LIBC=musl
157
+	#endif
158
+	#endif
159
+	EOF
160
+	eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')"
161
+
162
+	# Second heuristic to detect musl libc.
163
+	if [ "$LIBC" = unknown ] &&
164
+	   command -v ldd >/dev/null &&
165
+	   ldd --version 2>&1 | grep -q ^musl; then
166
+		LIBC=musl
167
+	fi
168
+
169
+	# If the system lacks a compiler, then just pick glibc.
170
+	# We could probably try harder.
171
+	if [ "$LIBC" = unknown ]; then
172
+		LIBC=gnu
173
+	fi
174
+	;;
175
+esac
141 176
 
142 177
 # Note: order is significant - the case branches are not exclusive.
143 178
 
144
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
179
+case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
145 180
     *:NetBSD:*:*)
146 181
 	# NetBSD (nbsd) targets should (where applicable) match one or
147
-	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
182
+	# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
148 183
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
149 184
 	# switched to ELF, *-*-netbsd* would select the old
150 185
 	# object file format.  This provides both forward
... ...
@@ -154,23 +189,34 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
154 189
 	# Note: NetBSD doesn't particularly care about the vendor
155 190
 	# portion of the name.  We always set it to "unknown".
156 191
 	sysctl="sysctl -n hw.machine_arch"
157
-	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
158
-	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
159
-	case "${UNAME_MACHINE_ARCH}" in
192
+	UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \
193
+	    "/sbin/$sysctl" 2>/dev/null || \
194
+	    "/usr/sbin/$sysctl" 2>/dev/null || \
195
+	    echo unknown))
196
+	case "$UNAME_MACHINE_ARCH" in
197
+	    aarch64eb) machine=aarch64_be-unknown ;;
160 198
 	    armeb) machine=armeb-unknown ;;
161 199
 	    arm*) machine=arm-unknown ;;
162 200
 	    sh3el) machine=shl-unknown ;;
163 201
 	    sh3eb) machine=sh-unknown ;;
164 202
 	    sh5el) machine=sh5le-unknown ;;
165
-	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
203
+	    earmv*)
204
+		arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,')
205
+		endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p')
206
+		machine="${arch}${endian}"-unknown
207
+		;;
208
+	    *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
166 209
 	esac
167 210
 	# The Operating System including object format, if it has switched
168
-	# to ELF recently, or will in the future.
169
-	case "${UNAME_MACHINE_ARCH}" in
211
+	# to ELF recently (or will in the future) and ABI.
212
+	case "$UNAME_MACHINE_ARCH" in
213
+	    earm*)
214
+		os=netbsdelf
215
+		;;
170 216
 	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
171
-		eval $set_cc_for_build
217
+		set_cc_for_build
172 218
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
173
-			| grep __ELF__ >/dev/null
219
+			| grep -q __ELF__
174 220
 		then
175 221
 		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
176 222
 		    # Return netbsd for either.  FIX?
... ...
@@ -180,7 +226,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
180 226
 		fi
181 227
 		;;
182 228
 	    *)
183
-	        os=netbsd
229
+		os=netbsd
230
+		;;
231
+	esac
232
+	# Determine ABI tags.
233
+	case "$UNAME_MACHINE_ARCH" in
234
+	    earm*)
235
+		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
236
+		abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr")
184 237
 		;;
185 238
 	esac
186 239
 	# The OS release
... ...
@@ -188,105 +241,125 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
188 241
 	# thus, need a distinct triplet. However, they do not need
189 242
 	# kernel version information, so it can be replaced with a
190 243
 	# suitable tag, in the style of linux-gnu.
191
-	case "${UNAME_VERSION}" in
244
+	case "$UNAME_VERSION" in
192 245
 	    Debian*)
193 246
 		release='-gnu'
194 247
 		;;
195 248
 	    *)
196
-		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
249
+		release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2)
197 250
 		;;
198 251
 	esac
199 252
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
200 253
 	# contains redundant information, the shorter form:
201 254
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
202
-	echo "${machine}-${os}${release}"
255
+	echo "$machine-${os}${release}${abi-}"
256
+	exit ;;
257
+    *:Bitrig:*:*)
258
+	UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//')
259
+	echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
203 260
 	exit ;;
204 261
     *:OpenBSD:*:*)
205
-	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
206
-	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
262
+	UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//')
263
+	echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
264
+	exit ;;
265
+    *:LibertyBSD:*:*)
266
+	UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//')
267
+	echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
268
+	exit ;;
269
+    *:MidnightBSD:*:*)
270
+	echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
207 271
 	exit ;;
208 272
     *:ekkoBSD:*:*)
209
-	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
273
+	echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
210 274
 	exit ;;
211 275
     *:SolidBSD:*:*)
212
-	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
276
+	echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
277
+	exit ;;
278
+    *:OS108:*:*)
279
+	echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
213 280
 	exit ;;
214 281
     macppc:MirBSD:*:*)
215
-	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
282
+	echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
216 283
 	exit ;;
217 284
     *:MirBSD:*:*)
218
-	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
285
+	echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
286
+	exit ;;
287
+    *:Sortix:*:*)
288
+	echo "$UNAME_MACHINE"-unknown-sortix
289
+	exit ;;
290
+    *:Twizzler:*:*)
291
+	echo "$UNAME_MACHINE"-unknown-twizzler
292
+	exit ;;
293
+    *:Redox:*:*)
294
+	echo "$UNAME_MACHINE"-unknown-redox
295
+	exit ;;
296
+    mips:OSF1:*.*)
297
+	echo mips-dec-osf1
219 298
 	exit ;;
220 299
     alpha:OSF1:*:*)
221 300
 	case $UNAME_RELEASE in
222 301
 	*4.0)
223
-		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
302
+		UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}')
224 303
 		;;
225 304
 	*5.*)
226
-	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
305
+		UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}')
227 306
 		;;
228 307
 	esac
229 308
 	# According to Compaq, /usr/sbin/psrinfo has been available on
230 309
 	# OSF/1 and Tru64 systems produced since 1995.  I hope that
231 310
 	# covers most systems running today.  This code pipes the CPU
232 311
 	# types through head -n 1, so we only detect the type of CPU 0.
233
-	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
312
+	ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1)
234 313
 	case "$ALPHA_CPU_TYPE" in
235 314
 	    "EV4 (21064)")
236
-		UNAME_MACHINE="alpha" ;;
315
+		UNAME_MACHINE=alpha ;;
237 316
 	    "EV4.5 (21064)")
238
-		UNAME_MACHINE="alpha" ;;
317
+		UNAME_MACHINE=alpha ;;
239 318
 	    "LCA4 (21066/21068)")
240
-		UNAME_MACHINE="alpha" ;;
319
+		UNAME_MACHINE=alpha ;;
241 320
 	    "EV5 (21164)")
242
-		UNAME_MACHINE="alphaev5" ;;
321
+		UNAME_MACHINE=alphaev5 ;;
243 322
 	    "EV5.6 (21164A)")
244
-		UNAME_MACHINE="alphaev56" ;;
323
+		UNAME_MACHINE=alphaev56 ;;
245 324
 	    "EV5.6 (21164PC)")
246
-		UNAME_MACHINE="alphapca56" ;;
325
+		UNAME_MACHINE=alphapca56 ;;
247 326
 	    "EV5.7 (21164PC)")
248
-		UNAME_MACHINE="alphapca57" ;;
327
+		UNAME_MACHINE=alphapca57 ;;
249 328
 	    "EV6 (21264)")
250
-		UNAME_MACHINE="alphaev6" ;;
329
+		UNAME_MACHINE=alphaev6 ;;
251 330
 	    "EV6.7 (21264A)")
252
-		UNAME_MACHINE="alphaev67" ;;
331
+		UNAME_MACHINE=alphaev67 ;;
253 332
 	    "EV6.8CB (21264C)")
254
-		UNAME_MACHINE="alphaev68" ;;
333
+		UNAME_MACHINE=alphaev68 ;;
255 334
 	    "EV6.8AL (21264B)")
256
-		UNAME_MACHINE="alphaev68" ;;
335
+		UNAME_MACHINE=alphaev68 ;;
257 336
 	    "EV6.8CX (21264D)")
258
-		UNAME_MACHINE="alphaev68" ;;
337
+		UNAME_MACHINE=alphaev68 ;;
259 338
 	    "EV6.9A (21264/EV69A)")
260
-		UNAME_MACHINE="alphaev69" ;;
339
+		UNAME_MACHINE=alphaev69 ;;
261 340
 	    "EV7 (21364)")
262
-		UNAME_MACHINE="alphaev7" ;;
341
+		UNAME_MACHINE=alphaev7 ;;
263 342
 	    "EV7.9 (21364A)")
264
-		UNAME_MACHINE="alphaev79" ;;
343
+		UNAME_MACHINE=alphaev79 ;;
265 344
 	esac
266 345
 	# A Pn.n version is a patched version.
267 346
 	# A Vn.n version is a released version.
268 347
 	# A Tn.n version is a released field test version.
269 348
 	# A Xn.n version is an unreleased experimental baselevel.
270 349
 	# 1.2 uses "1.2" for uname -r.
271
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
272
-	exit ;;
273
-    Alpha\ *:Windows_NT*:*)
274
-	# How do we know it's Interix rather than the generic POSIX subsystem?
275
-	# Should we change UNAME_MACHINE based on the output of uname instead
276
-	# of the specific Alpha model?
277
-	echo alpha-pc-interix
278
-	exit ;;
279
-    21064:Windows_NT:50:3)
280
-	echo alpha-dec-winnt3.5
281
-	exit ;;
350
+	echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)"
351
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
352
+	exitcode=$?
353
+	trap '' 0
354
+	exit $exitcode ;;
282 355
     Amiga*:UNIX_System_V:4.0:*)
283 356
 	echo m68k-unknown-sysv4
284 357
 	exit ;;
285 358
     *:[Aa]miga[Oo][Ss]:*:*)
286
-	echo ${UNAME_MACHINE}-unknown-amigaos
359
+	echo "$UNAME_MACHINE"-unknown-amigaos
287 360
 	exit ;;
288 361
     *:[Mm]orph[Oo][Ss]:*:*)
289
-	echo ${UNAME_MACHINE}-unknown-morphos
362
+	echo "$UNAME_MACHINE"-unknown-morphos
290 363
 	exit ;;
291 364
     *:OS/390:*:*)
292 365
 	echo i370-ibm-openedition
... ...
@@ -295,12 +368,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
295 368
 	echo s390-ibm-zvmoe
296 369
 	exit ;;
297 370
     *:OS400:*:*)
298
-        echo powerpc-ibm-os400
371
+	echo powerpc-ibm-os400
299 372
 	exit ;;
300 373
     arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
301
-	echo arm-acorn-riscix${UNAME_RELEASE}
374
+	echo arm-acorn-riscix"$UNAME_RELEASE"
302 375
 	exit ;;
303
-    arm:riscos:*:*|arm:RISCOS:*:*)
376
+    arm*:riscos:*:*|arm*:RISCOS:*:*)
304 377
 	echo arm-unknown-riscos
305 378
 	exit ;;
306 379
     SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
... ...
@@ -308,7 +381,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
308 381
 	exit ;;
309 382
     Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
310 383
 	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
311
-	if test "`(/bin/universe) 2>/dev/null`" = att ; then
384
+	if test "$( (/bin/universe) 2>/dev/null)" = att ; then
312 385
 		echo pyramid-pyramid-sysv3
313 386
 	else
314 387
 		echo pyramid-pyramid-bsd
... ...
@@ -321,50 +394,69 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
321 394
 	echo sparc-icl-nx6
322 395
 	exit ;;
323 396
     DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
324
-	case `/usr/bin/uname -p` in
397
+	case $(/usr/bin/uname -p) in
325 398
 	    sparc) echo sparc-icl-nx7; exit ;;
326 399
 	esac ;;
400
+    s390x:SunOS:*:*)
401
+	echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"
402
+	exit ;;
327 403
     sun4H:SunOS:5.*:*)
328
-	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
404
+	echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
329 405
 	exit ;;
330 406
     sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
331
-	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
407
+	echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')"
408
+	exit ;;
409
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
410
+	echo i386-pc-auroraux"$UNAME_RELEASE"
332 411
 	exit ;;
333 412
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
334
-	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
413
+	set_cc_for_build
414
+	SUN_ARCH=i386
415
+	# If there is a compiler, see if it is configured for 64-bit objects.
416
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
417
+	# This test works for both compilers.
418
+	if test "$CC_FOR_BUILD" != no_compiler_found; then
419
+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
420
+		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
421
+		grep IS_64BIT_ARCH >/dev/null
422
+	    then
423
+		SUN_ARCH=x86_64
424
+	    fi
425
+	fi
426
+	echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
335 427
 	exit ;;
336 428
     sun4*:SunOS:6*:*)
337 429
 	# According to config.sub, this is the proper way to canonicalize
338 430
 	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
339 431
 	# it's likely to be more like Solaris than SunOS4.
340
-	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
432
+	echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
341 433
 	exit ;;
342 434
     sun4*:SunOS:*:*)
343
-	case "`/usr/bin/arch -k`" in
435
+	case "$(/usr/bin/arch -k)" in
344 436
 	    Series*|S4*)
345
-		UNAME_RELEASE=`uname -v`
437
+		UNAME_RELEASE=$(uname -v)
346 438
 		;;
347 439
 	esac
348 440
 	# Japanese Language versions have a version number like `4.1.3-JL'.
349
-	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
441
+	echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')"
350 442
 	exit ;;
351 443
     sun3*:SunOS:*:*)
352
-	echo m68k-sun-sunos${UNAME_RELEASE}
444
+	echo m68k-sun-sunos"$UNAME_RELEASE"
353 445
 	exit ;;
354 446
     sun*:*:4.2BSD:*)
355
-	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
356
-	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
357
-	case "`/bin/arch`" in
447
+	UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null)
448
+	test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
449
+	case "$(/bin/arch)" in
358 450
 	    sun3)
359
-		echo m68k-sun-sunos${UNAME_RELEASE}
451
+		echo m68k-sun-sunos"$UNAME_RELEASE"
360 452
 		;;
361 453
 	    sun4)
362
-		echo sparc-sun-sunos${UNAME_RELEASE}
454
+		echo sparc-sun-sunos"$UNAME_RELEASE"
363 455
 		;;
364 456
 	esac
365 457
 	exit ;;
366 458
     aushp:SunOS:*:*)
367
-	echo sparc-auspex-sunos${UNAME_RELEASE}
459
+	echo sparc-auspex-sunos"$UNAME_RELEASE"
368 460
 	exit ;;
369 461
     # The situation for MiNT is a little confusing.  The machine name
370 462
     # can be virtually everything (everything which is not
... ...
@@ -375,44 +467,44 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
375 467
     # MiNT.  But MiNT is downward compatible to TOS, so this should
376 468
     # be no problem.
377 469
     atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
378
-        echo m68k-atari-mint${UNAME_RELEASE}
470
+	echo m68k-atari-mint"$UNAME_RELEASE"
379 471
 	exit ;;
380 472
     atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
381
-	echo m68k-atari-mint${UNAME_RELEASE}
382
-        exit ;;
473
+	echo m68k-atari-mint"$UNAME_RELEASE"
474
+	exit ;;
383 475
     *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
384
-        echo m68k-atari-mint${UNAME_RELEASE}
476
+	echo m68k-atari-mint"$UNAME_RELEASE"
385 477
 	exit ;;
386 478
     milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
387
-        echo m68k-milan-mint${UNAME_RELEASE}
388
-        exit ;;
479
+	echo m68k-milan-mint"$UNAME_RELEASE"
480
+	exit ;;
389 481
     hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
390
-        echo m68k-hades-mint${UNAME_RELEASE}
391
-        exit ;;
482
+	echo m68k-hades-mint"$UNAME_RELEASE"
483
+	exit ;;
392 484
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
393
-        echo m68k-unknown-mint${UNAME_RELEASE}
394
-        exit ;;
485
+	echo m68k-unknown-mint"$UNAME_RELEASE"
486
+	exit ;;
395 487
     m68k:machten:*:*)
396
-	echo m68k-apple-machten${UNAME_RELEASE}
488
+	echo m68k-apple-machten"$UNAME_RELEASE"
397 489
 	exit ;;
398 490
     powerpc:machten:*:*)
399
-	echo powerpc-apple-machten${UNAME_RELEASE}
491
+	echo powerpc-apple-machten"$UNAME_RELEASE"
400 492
 	exit ;;
401 493
     RISC*:Mach:*:*)
402 494
 	echo mips-dec-mach_bsd4.3
403 495
 	exit ;;
404 496
     RISC*:ULTRIX:*:*)
405
-	echo mips-dec-ultrix${UNAME_RELEASE}
497
+	echo mips-dec-ultrix"$UNAME_RELEASE"
406 498
 	exit ;;
407 499
     VAX*:ULTRIX*:*:*)
408
-	echo vax-dec-ultrix${UNAME_RELEASE}
500
+	echo vax-dec-ultrix"$UNAME_RELEASE"
409 501
 	exit ;;
410 502
     2020:CLIX:*:* | 2430:CLIX:*:*)
411
-	echo clipper-intergraph-clix${UNAME_RELEASE}
503
+	echo clipper-intergraph-clix"$UNAME_RELEASE"
412 504
 	exit ;;
413 505
     mips:*:*:UMIPS | mips:*:*:RISCos)
414
-	eval $set_cc_for_build
415
-	sed 's/^	//' << EOF >$dummy.c
506
+	set_cc_for_build
507
+	sed 's/^	//' << EOF > "$dummy.c"
416 508
 #ifdef __cplusplus
417 509
 #include <stdio.h>  /* for printf() prototype */
418 510
 	int main (int argc, char *argv[]) {
... ...
@@ -421,23 +513,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
421 513
 #endif
422 514
 	#if defined (host_mips) && defined (MIPSEB)
423 515
 	#if defined (SYSTYPE_SYSV)
424
-	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
516
+	  printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
425 517
 	#endif
426 518
 	#if defined (SYSTYPE_SVR4)
427
-	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
519
+	  printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
428 520
 	#endif
429 521
 	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
430
-	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
522
+	  printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
431 523
 	#endif
432 524
 	#endif
433 525
 	  exit (-1);
434 526
 	}
435 527
 EOF
436
-	$CC_FOR_BUILD -o $dummy $dummy.c &&
437
-	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
438
-	  SYSTEM_NAME=`$dummy $dummyarg` &&
528
+	$CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
529
+	  dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') &&
530
+	  SYSTEM_NAME=$("$dummy" "$dummyarg") &&
439 531
 	    { echo "$SYSTEM_NAME"; exit; }
440
-	echo mips-mips-riscos${UNAME_RELEASE}
532
+	echo mips-mips-riscos"$UNAME_RELEASE"
441 533
 	exit ;;
442 534
     Motorola:PowerMAX_OS:*:*)
443 535
 	echo powerpc-motorola-powermax
... ...
@@ -461,21 +553,21 @@ EOF
461 553
 	echo m88k-motorola-sysv3
462 554
 	exit ;;
463 555
     AViiON:dgux:*:*)
464
-        # DG/UX returns AViiON for all architectures
465
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
466
-	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
556
+	# DG/UX returns AViiON for all architectures
557
+	UNAME_PROCESSOR=$(/usr/bin/uname -p)
558
+	if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110
467 559
 	then
468
-	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
469
-	       [ ${TARGET_BINARY_INTERFACE}x = x ]
560
+	    if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
561
+	       test "$TARGET_BINARY_INTERFACE"x = x
470 562
 	    then
471
-		echo m88k-dg-dgux${UNAME_RELEASE}
563
+		echo m88k-dg-dgux"$UNAME_RELEASE"
472 564
 	    else
473
-		echo m88k-dg-dguxbcs${UNAME_RELEASE}
565
+		echo m88k-dg-dguxbcs"$UNAME_RELEASE"
474 566
 	    fi
475 567
 	else
476
-	    echo i586-dg-dgux${UNAME_RELEASE}
568
+	    echo i586-dg-dgux"$UNAME_RELEASE"
477 569
 	fi
478
- 	exit ;;
570
+	exit ;;
479 571
     M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
480 572
 	echo m88k-dolphin-sysv3
481 573
 	exit ;;
... ...
@@ -490,26 +582,26 @@ EOF
490 582
 	echo m68k-tektronix-bsd
491 583
 	exit ;;
492 584
     *:IRIX*:*:*)
493
-	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
585
+	echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')"
494 586
 	exit ;;
495 587
     ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
496 588
 	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
497
-	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
589
+	exit ;;               # Note that: echo "'$(uname -s)'" gives 'AIX '
498 590
     i*86:AIX:*:*)
499 591
 	echo i386-ibm-aix
500 592
 	exit ;;
501 593
     ia64:AIX:*:*)
502
-	if [ -x /usr/bin/oslevel ] ; then
503
-		IBM_REV=`/usr/bin/oslevel`
594
+	if test -x /usr/bin/oslevel ; then
595
+		IBM_REV=$(/usr/bin/oslevel)
504 596
 	else
505
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
597
+		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
506 598
 	fi
507
-	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
599
+	echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
508 600
 	exit ;;
509 601
     *:AIX:2:3)
510 602
 	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
511
-		eval $set_cc_for_build
512
-		sed 's/^		//' << EOF >$dummy.c
603
+		set_cc_for_build
604
+		sed 's/^		//' << EOF > "$dummy.c"
513 605
 		#include <sys/systemcfg.h>
514 606
 
515 607
 		main()
... ...
@@ -520,7 +612,7 @@ EOF
520 612
 			exit(0);
521 613
 			}
522 614
 EOF
523
-		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
615
+		if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy")
524 616
 		then
525 617
 			echo "$SYSTEM_NAME"
526 618
 		else
... ...
@@ -532,28 +624,29 @@ EOF
532 624
 		echo rs6000-ibm-aix3.2
533 625
 	fi
534 626
 	exit ;;
535
-    *:AIX:*:[456])
536
-	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
537
-	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
627
+    *:AIX:*:[4567])
628
+	IBM_CPU_ID=$(/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }')
629
+	if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
538 630
 		IBM_ARCH=rs6000
539 631
 	else
540 632
 		IBM_ARCH=powerpc
541 633
 	fi
542
-	if [ -x /usr/bin/oslevel ] ; then
543
-		IBM_REV=`/usr/bin/oslevel`
634
+	if test -x /usr/bin/lslpp ; then
635
+		IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc |
636
+			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/)
544 637
 	else
545
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
638
+		IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
546 639
 	fi
547
-	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
640
+	echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
548 641
 	exit ;;
549 642
     *:AIX:*:*)
550 643
 	echo rs6000-ibm-aix
551 644
 	exit ;;
552
-    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
645
+    ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
553 646
 	echo romp-ibm-bsd4.4
554 647
 	exit ;;
555 648
     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
556
-	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
649
+	echo romp-ibm-bsd"$UNAME_RELEASE"   # 4.3 with uname added to
557 650
 	exit ;;                             # report: romp-ibm BSD 4.3
558 651
     *:BOSX:*:*)
559 652
 	echo rs6000-bull-bosx
... ...
@@ -568,67 +661,67 @@ EOF
568 661
 	echo m68k-hp-bsd4.4
569 662
 	exit ;;
570 663
     9000/[34678]??:HP-UX:*:*)
571
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
572
-	case "${UNAME_MACHINE}" in
573
-	    9000/31? )            HP_ARCH=m68000 ;;
574
-	    9000/[34]?? )         HP_ARCH=m68k ;;
664
+	HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
665
+	case "$UNAME_MACHINE" in
666
+	    9000/31?)            HP_ARCH=m68000 ;;
667
+	    9000/[34]??)         HP_ARCH=m68k ;;
575 668
 	    9000/[678][0-9][0-9])
576
-		if [ -x /usr/bin/getconf ]; then
577
-		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
578
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
579
-                    case "${sc_cpu_version}" in
580
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
581
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
582
-                      532)                      # CPU_PA_RISC2_0
583
-                        case "${sc_kernel_bits}" in
584
-                          32) HP_ARCH="hppa2.0n" ;;
585
-                          64) HP_ARCH="hppa2.0w" ;;
586
-			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
587
-                        esac ;;
588
-                    esac
669
+		if test -x /usr/bin/getconf; then
670
+		    sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 2>/dev/null)
671
+		    sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null)
672
+		    case "$sc_cpu_version" in
673
+		      523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
674
+		      528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
675
+		      532)                      # CPU_PA_RISC2_0
676
+			case "$sc_kernel_bits" in
677
+			  32) HP_ARCH=hppa2.0n ;;
678
+			  64) HP_ARCH=hppa2.0w ;;
679
+			  '') HP_ARCH=hppa2.0 ;;   # HP-UX 10.20
680
+			esac ;;
681
+		    esac
589 682
 		fi
590
-		if [ "${HP_ARCH}" = "" ]; then
591
-		    eval $set_cc_for_build
592
-		    sed 's/^              //' << EOF >$dummy.c
683
+		if test "$HP_ARCH" = ""; then
684
+		    set_cc_for_build
685
+		    sed 's/^		//' << EOF > "$dummy.c"
593 686
 
594
-              #define _HPUX_SOURCE
595
-              #include <stdlib.h>
596
-              #include <unistd.h>
687
+		#define _HPUX_SOURCE
688
+		#include <stdlib.h>
689
+		#include <unistd.h>
597 690
 
598
-              int main ()
599
-              {
600
-              #if defined(_SC_KERNEL_BITS)
601
-                  long bits = sysconf(_SC_KERNEL_BITS);
602
-              #endif
603
-                  long cpu  = sysconf (_SC_CPU_VERSION);
691
+		int main ()
692
+		{
693
+		#if defined(_SC_KERNEL_BITS)
694
+		    long bits = sysconf(_SC_KERNEL_BITS);
695
+		#endif
696
+		    long cpu  = sysconf (_SC_CPU_VERSION);
604 697
 
605
-                  switch (cpu)
606
-              	{
607
-              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
608
-              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
609
-              	case CPU_PA_RISC2_0:
610
-              #if defined(_SC_KERNEL_BITS)
611
-              	    switch (bits)
612
-              		{
613
-              		case 64: puts ("hppa2.0w"); break;
614
-              		case 32: puts ("hppa2.0n"); break;
615
-              		default: puts ("hppa2.0"); break;
616
-              		} break;
617
-              #else  /* !defined(_SC_KERNEL_BITS) */
618
-              	    puts ("hppa2.0"); break;
619
-              #endif
620
-              	default: puts ("hppa1.0"); break;
621
-              	}
622
-                  exit (0);
623
-              }
698
+		    switch (cpu)
699
+			{
700
+			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
701
+			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
702
+			case CPU_PA_RISC2_0:
703
+		#if defined(_SC_KERNEL_BITS)
704
+			    switch (bits)
705
+				{
706
+				case 64: puts ("hppa2.0w"); break;
707
+				case 32: puts ("hppa2.0n"); break;
708
+				default: puts ("hppa2.0"); break;
709
+				} break;
710
+		#else  /* !defined(_SC_KERNEL_BITS) */
711
+			    puts ("hppa2.0"); break;
712
+		#endif
713
+			default: puts ("hppa1.0"); break;
714
+			}
715
+		    exit (0);
716
+		}
624 717
 EOF
625
-		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
718
+		    (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=$("$dummy")
626 719
 		    test -z "$HP_ARCH" && HP_ARCH=hppa
627 720
 		fi ;;
628 721
 	esac
629
-	if [ ${HP_ARCH} = "hppa2.0w" ]
722
+	if test "$HP_ARCH" = hppa2.0w
630 723
 	then
631
-	    eval $set_cc_for_build
724
+	    set_cc_for_build
632 725
 
633 726
 	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
634 727
 	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
... ...
@@ -639,23 +732,23 @@ EOF
639 732
 	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
640 733
 	    # => hppa64-hp-hpux11.23
641 734
 
642
-	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
643
-		grep __LP64__ >/dev/null
735
+	    if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) |
736
+		grep -q __LP64__
644 737
 	    then
645
-		HP_ARCH="hppa2.0w"
738
+		HP_ARCH=hppa2.0w
646 739
 	    else
647
-		HP_ARCH="hppa64"
740
+		HP_ARCH=hppa64
648 741
 	    fi
649 742
 	fi
650
-	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
743
+	echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
651 744
 	exit ;;
652 745
     ia64:HP-UX:*:*)
653
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
654
-	echo ia64-hp-hpux${HPUX_REV}
746
+	HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//')
747
+	echo ia64-hp-hpux"$HPUX_REV"
655 748
 	exit ;;
656 749
     3050*:HI-UX:*:*)
657
-	eval $set_cc_for_build
658
-	sed 's/^	//' << EOF >$dummy.c
750
+	set_cc_for_build
751
+	sed 's/^	//' << EOF > "$dummy.c"
659 752
 	#include <unistd.h>
660 753
 	int
661 754
 	main ()
... ...
@@ -680,11 +773,11 @@ EOF
680 773
 	  exit (0);
681 774
 	}
682 775
 EOF
683
-	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
776
+	$CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") &&
684 777
 		{ echo "$SYSTEM_NAME"; exit; }
685 778
 	echo unknown-hitachi-hiuxwe2
686 779
 	exit ;;
687
-    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
780
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
688 781
 	echo hppa1.1-hp-bsd
689 782
 	exit ;;
690 783
     9000/8??:4.3bsd:*:*)
... ...
@@ -693,17 +786,17 @@ EOF
693 786
     *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
694 787
 	echo hppa1.0-hp-mpeix
695 788
 	exit ;;
696
-    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
789
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
697 790
 	echo hppa1.1-hp-osf
698 791
 	exit ;;
699 792
     hp8??:OSF1:*:*)
700 793
 	echo hppa1.0-hp-osf
701 794
 	exit ;;
702 795
     i*86:OSF1:*:*)
703
-	if [ -x /usr/sbin/sysversion ] ; then
704
-	    echo ${UNAME_MACHINE}-unknown-osf1mk
796
+	if test -x /usr/sbin/sysversion ; then
797
+	    echo "$UNAME_MACHINE"-unknown-osf1mk
705 798
 	else
706
-	    echo ${UNAME_MACHINE}-unknown-osf1
799
+	    echo "$UNAME_MACHINE"-unknown-osf1
707 800
 	fi
708 801
 	exit ;;
709 802
     parisc*:Lites*:*:*)
... ...
@@ -711,325 +804,326 @@ EOF
711 804
 	exit ;;
712 805
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
713 806
 	echo c1-convex-bsd
714
-        exit ;;
807
+	exit ;;
715 808
     C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
716 809
 	if getsysinfo -f scalar_acc
717 810
 	then echo c32-convex-bsd
718 811
 	else echo c2-convex-bsd
719 812
 	fi
720
-        exit ;;
813
+	exit ;;
721 814
     C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
722 815
 	echo c34-convex-bsd
723
-        exit ;;
816
+	exit ;;
724 817
     C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
725 818
 	echo c38-convex-bsd
726
-        exit ;;
819
+	exit ;;
727 820
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
728 821
 	echo c4-convex-bsd
729
-        exit ;;
822
+	exit ;;
730 823
     CRAY*Y-MP:*:*:*)
731
-	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
824
+	echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
732 825
 	exit ;;
733 826
     CRAY*[A-Z]90:*:*:*)
734
-	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
827
+	echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
735 828
 	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
736 829
 	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
737 830
 	      -e 's/\.[^.]*$/.X/'
738 831
 	exit ;;
739 832
     CRAY*TS:*:*:*)
740
-	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
833
+	echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
741 834
 	exit ;;
742 835
     CRAY*T3E:*:*:*)
743
-	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
836
+	echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
744 837
 	exit ;;
745 838
     CRAY*SV1:*:*:*)
746
-	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
839
+	echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
747 840
 	exit ;;
748 841
     *:UNICOS/mp:*:*)
749
-	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
842
+	echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
750 843
 	exit ;;
751 844
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
752
-	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
753
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
754
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
755
-        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
756
-        exit ;;
845
+	FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)
846
+	FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')
847
+	FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/')
848
+	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
849
+	exit ;;
757 850
     5000:UNIX_System_V:4.*:*)
758
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
759
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
760
-        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
851
+	FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///')
852
+	FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/')
853
+	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
761 854
 	exit ;;
762 855
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
763
-	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
856
+	echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
764 857
 	exit ;;
765 858
     sparc*:BSD/OS:*:*)
766
-	echo sparc-unknown-bsdi${UNAME_RELEASE}
859
+	echo sparc-unknown-bsdi"$UNAME_RELEASE"
767 860
 	exit ;;
768 861
     *:BSD/OS:*:*)
769
-	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
862
+	echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
863
+	exit ;;
864
+    arm:FreeBSD:*:*)
865
+	UNAME_PROCESSOR=$(uname -p)
866
+	set_cc_for_build
867
+	if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
868
+	    | grep -q __ARM_PCS_VFP
869
+	then
870
+	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi
871
+	else
872
+	    echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf
873
+	fi
770 874
 	exit ;;
771 875
     *:FreeBSD:*:*)
772
-	case ${UNAME_MACHINE} in
773
-	    pc98)
774
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
876
+	UNAME_PROCESSOR=$(/usr/bin/uname -p)
877
+	case "$UNAME_PROCESSOR" in
775 878
 	    amd64)
776
-		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
777
-	    *)
778
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
879
+		UNAME_PROCESSOR=x86_64 ;;
880
+	    i386)
881
+		UNAME_PROCESSOR=i586 ;;
779 882
 	esac
883
+	echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')"
780 884
 	exit ;;
781 885
     i*:CYGWIN*:*)
782
-	echo ${UNAME_MACHINE}-pc-cygwin
886
+	echo "$UNAME_MACHINE"-pc-cygwin
887
+	exit ;;
888
+    *:MINGW64*:*)
889
+	echo "$UNAME_MACHINE"-pc-mingw64
783 890
 	exit ;;
784 891
     *:MINGW*:*)
785
-	echo ${UNAME_MACHINE}-pc-mingw32
892
+	echo "$UNAME_MACHINE"-pc-mingw32
786 893
 	exit ;;
787
-    i*:windows32*:*)
788
-    	# uname -m includes "-pc" on this system.
789
-    	echo ${UNAME_MACHINE}-mingw32
894
+    *:MSYS*:*)
895
+	echo "$UNAME_MACHINE"-pc-msys
790 896
 	exit ;;
791 897
     i*:PW*:*)
792
-	echo ${UNAME_MACHINE}-pc-pw32
898
+	echo "$UNAME_MACHINE"-pc-pw32
793 899
 	exit ;;
794
-    *:Interix*:[3456]*)
795
-    	case ${UNAME_MACHINE} in
900
+    *:Interix*:*)
901
+	case "$UNAME_MACHINE" in
796 902
 	    x86)
797
-		echo i586-pc-interix${UNAME_RELEASE}
903
+		echo i586-pc-interix"$UNAME_RELEASE"
798 904
 		exit ;;
799
-	    EM64T | authenticamd)
800
-		echo x86_64-unknown-interix${UNAME_RELEASE}
905
+	    authenticamd | genuineintel | EM64T)
906
+		echo x86_64-unknown-interix"$UNAME_RELEASE"
801 907
 		exit ;;
802 908
 	    IA64)
803
-		echo ia64-unknown-interix${UNAME_RELEASE}
909
+		echo ia64-unknown-interix"$UNAME_RELEASE"
804 910
 		exit ;;
805 911
 	esac ;;
806
-    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
807
-	echo i${UNAME_MACHINE}-pc-mks
808
-	exit ;;
809
-    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
810
-	# How do we know it's Interix rather than the generic POSIX subsystem?
811
-	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
812
-	# UNAME_MACHINE based on the output of uname instead of i386?
813
-	echo i586-pc-interix
814
-	exit ;;
815 912
     i*:UWIN*:*)
816
-	echo ${UNAME_MACHINE}-pc-uwin
913
+	echo "$UNAME_MACHINE"-pc-uwin
817 914
 	exit ;;
818 915
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
819
-	echo x86_64-unknown-cygwin
820
-	exit ;;
821
-    p*:CYGWIN*:*)
822
-	echo powerpcle-unknown-cygwin
916
+	echo x86_64-pc-cygwin
823 917
 	exit ;;
824 918
     prep*:SunOS:5.*:*)
825
-	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
919
+	echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')"
826 920
 	exit ;;
827 921
     *:GNU:*:*)
828 922
 	# the GNU system
829
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
923
+	echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')"
830 924
 	exit ;;
831 925
     *:GNU/*:*:*)
832 926
 	# other systems with GNU libc and userland
833
-	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
927
+	echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC"
928
+	exit ;;
929
+    *:Minix:*:*)
930
+	echo "$UNAME_MACHINE"-unknown-minix
931
+	exit ;;
932
+    aarch64:Linux:*:*)
933
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
834 934
 	exit ;;
835
-    i*86:Minix:*:*)
836
-	echo ${UNAME_MACHINE}-pc-minix
935
+    aarch64_be:Linux:*:*)
936
+	UNAME_MACHINE=aarch64_be
937
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
938
+	exit ;;
939
+    alpha:Linux:*:*)
940
+	case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in
941
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
942
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
943
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
944
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
945
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
946
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
947
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
948
+	esac
949
+	objdump --private-headers /bin/sh | grep -q ld.so.1
950
+	if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
951
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
952
+	exit ;;
953
+    arc:Linux:*:* | arceb:Linux:*:*)
954
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
837 955
 	exit ;;
838 956
     arm*:Linux:*:*)
839
-	eval $set_cc_for_build
957
+	set_cc_for_build
840 958
 	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
841 959
 	    | grep -q __ARM_EABI__
842 960
 	then
843
-	    echo ${UNAME_MACHINE}-unknown-linux-gnu
961
+	    echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
844 962
 	else
845
-	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
963
+	    if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
964
+		| grep -q __ARM_PCS_VFP
965
+	    then
966
+		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
967
+	    else
968
+		echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
969
+	    fi
846 970
 	fi
847 971
 	exit ;;
848 972
     avr32*:Linux:*:*)
849
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
973
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
850 974
 	exit ;;
851 975
     cris:Linux:*:*)
852
-	echo cris-axis-linux-gnu
976
+	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
853 977
 	exit ;;
854 978
     crisv32:Linux:*:*)
855
-	echo crisv32-axis-linux-gnu
979
+	echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
980
+	exit ;;
981
+    e2k:Linux:*:*)
982
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
856 983
 	exit ;;
857 984
     frv:Linux:*:*)
858
-    	echo frv-unknown-linux-gnu
985
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
986
+	exit ;;
987
+    hexagon:Linux:*:*)
988
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
989
+	exit ;;
990
+    i*86:Linux:*:*)
991
+	echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
859 992
 	exit ;;
860 993
     ia64:Linux:*:*)
861
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
994
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
995
+	exit ;;
996
+    k1om:Linux:*:*)
997
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
998
+	exit ;;
999
+    loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*)
1000
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
862 1001
 	exit ;;
863 1002
     m32r*:Linux:*:*)
864
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
1003
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
865 1004
 	exit ;;
866 1005
     m68*:Linux:*:*)
867
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
1006
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
868 1007
 	exit ;;
869
-    mips:Linux:*:*)
870
-	eval $set_cc_for_build
871
-	sed 's/^	//' << EOF >$dummy.c
1008
+    mips:Linux:*:* | mips64:Linux:*:*)
1009
+	set_cc_for_build
1010
+	IS_GLIBC=0
1011
+	test x"${LIBC}" = xgnu && IS_GLIBC=1
1012
+	sed 's/^	//' << EOF > "$dummy.c"
872 1013
 	#undef CPU
873 1014
 	#undef mips
874 1015
 	#undef mipsel
875
-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
876
-	CPU=mipsel
1016
+	#undef mips64
1017
+	#undef mips64el
1018
+	#if ${IS_GLIBC} && defined(_ABI64)
1019
+	LIBCABI=gnuabi64
877 1020
 	#else
878
-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
879
-	CPU=mips
1021
+	#if ${IS_GLIBC} && defined(_ABIN32)
1022
+	LIBCABI=gnuabin32
880 1023
 	#else
881
-	CPU=
1024
+	LIBCABI=${LIBC}
882 1025
 	#endif
883 1026
 	#endif
884
-EOF
885
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
886
-	    /^CPU/{
887
-		s: ::g
888
-		p
889
-	    }'`"
890
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
891
-	;;
892
-    mips64:Linux:*:*)
893
-	eval $set_cc_for_build
894
-	sed 's/^	//' << EOF >$dummy.c
895
-	#undef CPU
896
-	#undef mips64
897
-	#undef mips64el
1027
+
1028
+	#if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1029
+	CPU=mipsisa64r6
1030
+	#else
1031
+	#if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1032
+	CPU=mipsisa32r6
1033
+	#else
1034
+	#if defined(__mips64)
1035
+	CPU=mips64
1036
+	#else
1037
+	CPU=mips
1038
+	#endif
1039
+	#endif
1040
+	#endif
1041
+
898 1042
 	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
899
-	CPU=mips64el
1043
+	MIPS_ENDIAN=el
900 1044
 	#else
901 1045
 	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
902
-	CPU=mips64
1046
+	MIPS_ENDIAN=
903 1047
 	#else
904
-	CPU=
1048
+	MIPS_ENDIAN=
905 1049
 	#endif
906 1050
 	#endif
907 1051
 EOF
908
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
909
-	    /^CPU/{
910
-		s: ::g
911
-		p
912
-	    }'`"
913
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
1052
+	eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')"
1053
+	test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
914 1054
 	;;
915
-    or32:Linux:*:*)
916
-	echo or32-unknown-linux-gnu
1055
+    mips64el:Linux:*:*)
1056
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
917 1057
 	exit ;;
918
-    ppc:Linux:*:*)
919
-	echo powerpc-unknown-linux-gnu
1058
+    openrisc*:Linux:*:*)
1059
+	echo or1k-unknown-linux-"$LIBC"
920 1060
 	exit ;;
921
-    ppc64:Linux:*:*)
922
-	echo powerpc64-unknown-linux-gnu
1061
+    or32:Linux:*:* | or1k*:Linux:*:*)
1062
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
923 1063
 	exit ;;
924
-    alpha:Linux:*:*)
925
-	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
926
-	  EV5)   UNAME_MACHINE=alphaev5 ;;
927
-	  EV56)  UNAME_MACHINE=alphaev56 ;;
928
-	  PCA56) UNAME_MACHINE=alphapca56 ;;
929
-	  PCA57) UNAME_MACHINE=alphapca56 ;;
930
-	  EV6)   UNAME_MACHINE=alphaev6 ;;
931
-	  EV67)  UNAME_MACHINE=alphaev67 ;;
932
-	  EV68*) UNAME_MACHINE=alphaev68 ;;
933
-        esac
934
-	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
935
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
936
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
1064
+    padre:Linux:*:*)
1065
+	echo sparc-unknown-linux-"$LIBC"
1066
+	exit ;;
1067
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
1068
+	echo hppa64-unknown-linux-"$LIBC"
937 1069
 	exit ;;
938 1070
     parisc:Linux:*:* | hppa:Linux:*:*)
939 1071
 	# Look for CPU level
940
-	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
941
-	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
942
-	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
943
-	  *)    echo hppa-unknown-linux-gnu ;;
1072
+	case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in
1073
+	  PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
1074
+	  PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
1075
+	  *)    echo hppa-unknown-linux-"$LIBC" ;;
944 1076
 	esac
945 1077
 	exit ;;
946
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
947
-	echo hppa64-unknown-linux-gnu
1078
+    ppc64:Linux:*:*)
1079
+	echo powerpc64-unknown-linux-"$LIBC"
1080
+	exit ;;
1081
+    ppc:Linux:*:*)
1082
+	echo powerpc-unknown-linux-"$LIBC"
1083
+	exit ;;
1084
+    ppc64le:Linux:*:*)
1085
+	echo powerpc64le-unknown-linux-"$LIBC"
1086
+	exit ;;
1087
+    ppcle:Linux:*:*)
1088
+	echo powerpcle-unknown-linux-"$LIBC"
1089
+	exit ;;
1090
+    riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*)
1091
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
948 1092
 	exit ;;
949 1093
     s390:Linux:*:* | s390x:Linux:*:*)
950
-	echo ${UNAME_MACHINE}-ibm-linux
1094
+	echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
951 1095
 	exit ;;
952 1096
     sh64*:Linux:*:*)
953
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
1097
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
954 1098
 	exit ;;
955 1099
     sh*:Linux:*:*)
956
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
1100
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
957 1101
 	exit ;;
958 1102
     sparc:Linux:*:* | sparc64:Linux:*:*)
959
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
1103
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1104
+	exit ;;
1105
+    tile*:Linux:*:*)
1106
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
960 1107
 	exit ;;
961 1108
     vax:Linux:*:*)
962
-	echo ${UNAME_MACHINE}-dec-linux-gnu
1109
+	echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
963 1110
 	exit ;;
964 1111
     x86_64:Linux:*:*)
965
-	echo x86_64-unknown-linux-gnu
1112
+	set_cc_for_build
1113
+	LIBCABI=$LIBC
1114
+	if test "$CC_FOR_BUILD" != no_compiler_found; then
1115
+	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
1116
+		(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1117
+		grep IS_X32 >/dev/null
1118
+	    then
1119
+		LIBCABI="$LIBC"x32
1120
+	    fi
1121
+	fi
1122
+	echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI"
966 1123
 	exit ;;
967 1124
     xtensa*:Linux:*:*)
968
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
1125
+	echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
969 1126
 	exit ;;
970
-    i*86:Linux:*:*)
971
-	# The BFD linker knows what the default object file format is, so
972
-	# first see if it will tell us. cd to the root directory to prevent
973
-	# problems with other programs or directories called `ld' in the path.
974
-	# Set LC_ALL=C to ensure ld outputs messages in English.
975
-	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
976
-			 | sed -ne '/supported targets:/!d
977
-				    s/[ 	][ 	]*/ /g
978