Mercurial > hg > early-roguelike
comparison build-aux/config.guess @ 317:aab761616489 default tip
Rearrange some Autoconf files.
Autoconf was failing to detect install-sh at the top level and needed
some explicit directions. It also wants config.guess and config.sub to
be provided too.
A few other macros have also been updated.
author | John "Elwin" Edwards |
---|---|
date | Tue, 05 Sep 2023 20:05:24 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
316:c03d0b87211c | 317:aab761616489 |
---|---|
1 #!/usr/bin/sh | |
2 # Attempt to guess a canonical system name. | |
3 # Copyright 1992-2022 Free Software Foundation, Inc. | |
4 | |
5 # shellcheck disable=SC2006,SC2268 # see below for rationale | |
6 | |
7 timestamp='2022-05-25' | |
8 | |
9 # This file is free software; you can redistribute it and/or modify it | |
10 # under the terms of the GNU General Public License as published by | |
11 # the Free Software Foundation, either version 3 of the License, or | |
12 # (at your option) any later version. | |
13 # | |
14 # This program is distributed in the hope that it will be useful, but | |
15 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 # General Public License for more details. | |
18 # | |
19 # You should have received a copy of the GNU General Public License | |
20 # along with this program; if not, see <https://www.gnu.org/licenses/>. | |
21 # | |
22 # As a special exception to the GNU General Public License, if you | |
23 # distribute this file as part of a program that contains a | |
24 # configuration script generated by Autoconf, you may include it under | |
25 # the same distribution terms that you use for the rest of that | |
26 # program. This Exception is an additional permission under section 7 | |
27 # of the GNU General Public License, version 3 ("GPLv3"). | |
28 # | |
29 # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. | |
30 # | |
31 # You can get the latest version of this script from: | |
32 # https://git.savannah.gnu.org/cgit/config.git/plain/config.guess | |
33 # | |
34 # Please send patches to <config-patches@gnu.org>. | |
35 | |
36 | |
37 # The "shellcheck disable" line above the timestamp inhibits complaints | |
38 # about features and limitations of the classic Bourne shell that were | |
39 # superseded or lifted in POSIX. However, this script identifies a wide | |
40 # variety of pre-POSIX systems that do not have POSIX shells at all, and | |
41 # even some reasonably current systems (Solaris 10 as case-in-point) still | |
42 # have a pre-POSIX /bin/sh. | |
43 | |
44 | |
45 me=`echo "$0" | sed -e 's,.*/,,'` | |
46 | |
47 usage="\ | |
48 Usage: $0 [OPTION] | |
49 | |
50 Output the configuration name of the system \`$me' is run on. | |
51 | |
52 Options: | |
53 -h, --help print this help, then exit | |
54 -t, --time-stamp print date of last modification, then exit | |
55 -v, --version print version number, then exit | |
56 | |
57 Report bugs and patches to <config-patches@gnu.org>." | |
58 | |
59 version="\ | |
60 GNU config.guess ($timestamp) | |
61 | |
62 Originally written by Per Bothner. | |
63 Copyright 1992-2022 Free Software Foundation, Inc. | |
64 | |
65 This is free software; see the source for copying conditions. There is NO | |
66 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." | |
67 | |
68 help=" | |
69 Try \`$me --help' for more information." | |
70 | |
71 # Parse command line | |
72 while test $# -gt 0 ; do | |
73 case $1 in | |
74 --time-stamp | --time* | -t ) | |
75 echo "$timestamp" ; exit ;; | |
76 --version | -v ) | |
77 echo "$version" ; exit ;; | |
78 --help | --h* | -h ) | |
79 echo "$usage"; exit ;; | |
80 -- ) # Stop option processing | |
81 shift; break ;; | |
82 - ) # Use stdin as input. | |
83 break ;; | |
84 -* ) | |
85 echo "$me: invalid option $1$help" >&2 | |
86 exit 1 ;; | |
87 * ) | |
88 break ;; | |
89 esac | |
90 done | |
91 | |
92 if test $# != 0; then | |
93 echo "$me: too many arguments$help" >&2 | |
94 exit 1 | |
95 fi | |
96 | |
97 # Just in case it came from the environment. | |
98 GUESS= | |
99 | |
100 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a | |
101 # compiler to aid in system detection is discouraged as it requires | |
102 # temporary files to be created and, as you can see below, it is a | |
103 # headache to deal with in a portable fashion. | |
104 | |
105 # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still | |
106 # use `HOST_CC' if defined, but it is deprecated. | |
107 | |
108 # Portable tmp directory creation inspired by the Autoconf team. | |
109 | |
110 tmp= | |
111 # shellcheck disable=SC2172 | |
112 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 | |
113 | |
114 set_cc_for_build() { | |
115 # prevent multiple calls if $tmp is already set | |
116 test "$tmp" && return 0 | |
117 : "${TMPDIR=/tmp}" | |
118 # shellcheck disable=SC2039,SC3028 | |
119 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || | |
120 { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || | |
121 { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || | |
122 { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } | |
123 dummy=$tmp/dummy | |
124 case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in | |
125 ,,) echo "int x;" > "$dummy.c" | |
126 for driver in cc gcc c89 c99 ; do | |
127 if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then | |
128 CC_FOR_BUILD=$driver | |
129 break | |
130 fi | |
131 done | |
132 if test x"$CC_FOR_BUILD" = x ; then | |
133 CC_FOR_BUILD=no_compiler_found | |
134 fi | |
135 ;; | |
136 ,,*) CC_FOR_BUILD=$CC ;; | |
137 ,*,*) CC_FOR_BUILD=$HOST_CC ;; | |
138 esac | |
139 } | |
140 | |
141 # This is needed to find uname on a Pyramid OSx when run in the BSD universe. | |
142 # (ghazi@noc.rutgers.edu 1994-08-24) | |
143 if test -f /.attbin/uname ; then | |
144 PATH=$PATH:/.attbin ; export PATH | |
145 fi | |
146 | |
147 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown | |
148 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown | |
149 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown | |
150 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown | |
151 | |
152 case $UNAME_SYSTEM in | |
153 Linux|GNU|GNU/*) | |
154 LIBC=unknown | |
155 | |
156 set_cc_for_build | |
157 cat <<-EOF > "$dummy.c" | |
158 #include <features.h> | |
159 #if defined(__UCLIBC__) | |
160 LIBC=uclibc | |
161 #elif defined(__dietlibc__) | |
162 LIBC=dietlibc | |
163 #elif defined(__GLIBC__) | |
164 LIBC=gnu | |
165 #else | |
166 #include <stdarg.h> | |
167 /* First heuristic to detect musl libc. */ | |
168 #ifdef __DEFINED_va_list | |
169 LIBC=musl | |
170 #endif | |
171 #endif | |
172 EOF | |
173 cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` | |
174 eval "$cc_set_libc" | |
175 | |
176 # Second heuristic to detect musl libc. | |
177 if [ "$LIBC" = unknown ] && | |
178 command -v ldd >/dev/null && | |
179 ldd --version 2>&1 | grep -q ^musl; then | |
180 LIBC=musl | |
181 fi | |
182 | |
183 # If the system lacks a compiler, then just pick glibc. | |
184 # We could probably try harder. | |
185 if [ "$LIBC" = unknown ]; then | |
186 LIBC=gnu | |
187 fi | |
188 ;; | |
189 esac | |
190 | |
191 # Note: order is significant - the case branches are not exclusive. | |
192 | |
193 case $UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in | |
194 *:NetBSD:*:*) | |
195 # NetBSD (nbsd) targets should (where applicable) match one or | |
196 # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, | |
197 # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently | |
198 # switched to ELF, *-*-netbsd* would select the old | |
199 # object file format. This provides both forward | |
200 # compatibility and a consistent mechanism for selecting the | |
201 # object file format. | |
202 # | |
203 # Note: NetBSD doesn't particularly care about the vendor | |
204 # portion of the name. We always set it to "unknown". | |
205 UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ | |
206 /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ | |
207 /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ | |
208 echo unknown)` | |
209 case $UNAME_MACHINE_ARCH in | |
210 aarch64eb) machine=aarch64_be-unknown ;; | |
211 armeb) machine=armeb-unknown ;; | |
212 arm*) machine=arm-unknown ;; | |
213 sh3el) machine=shl-unknown ;; | |
214 sh3eb) machine=sh-unknown ;; | |
215 sh5el) machine=sh5le-unknown ;; | |
216 earmv*) | |
217 arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` | |
218 endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` | |
219 machine=${arch}${endian}-unknown | |
220 ;; | |
221 *) machine=$UNAME_MACHINE_ARCH-unknown ;; | |
222 esac | |
223 # The Operating System including object format, if it has switched | |
224 # to ELF recently (or will in the future) and ABI. | |
225 case $UNAME_MACHINE_ARCH in | |
226 earm*) | |
227 os=netbsdelf | |
228 ;; | |
229 arm*|i386|m68k|ns32k|sh3*|sparc|vax) | |
230 set_cc_for_build | |
231 if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | |
232 | grep -q __ELF__ | |
233 then | |
234 # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). | |
235 # Return netbsd for either. FIX? | |
236 os=netbsd | |
237 else | |
238 os=netbsdelf | |
239 fi | |
240 ;; | |
241 *) | |
242 os=netbsd | |
243 ;; | |
244 esac | |
245 # Determine ABI tags. | |
246 case $UNAME_MACHINE_ARCH in | |
247 earm*) | |
248 expr='s/^earmv[0-9]/-eabi/;s/eb$//' | |
249 abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` | |
250 ;; | |
251 esac | |
252 # The OS release | |
253 # Debian GNU/NetBSD machines have a different userland, and | |
254 # thus, need a distinct triplet. However, they do not need | |
255 # kernel version information, so it can be replaced with a | |
256 # suitable tag, in the style of linux-gnu. | |
257 case $UNAME_VERSION in | |
258 Debian*) | |
259 release='-gnu' | |
260 ;; | |
261 *) | |
262 release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` | |
263 ;; | |
264 esac | |
265 # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: | |
266 # contains redundant information, the shorter form: | |
267 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. | |
268 GUESS=$machine-${os}${release}${abi-} | |
269 ;; | |
270 *:Bitrig:*:*) | |
271 UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` | |
272 GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE | |
273 ;; | |
274 *:OpenBSD:*:*) | |
275 UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` | |
276 GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE | |
277 ;; | |
278 *:SecBSD:*:*) | |
279 UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` | |
280 GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE | |
281 ;; | |
282 *:LibertyBSD:*:*) | |
283 UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` | |
284 GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE | |
285 ;; | |
286 *:MidnightBSD:*:*) | |
287 GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE | |
288 ;; | |
289 *:ekkoBSD:*:*) | |
290 GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE | |
291 ;; | |
292 *:SolidBSD:*:*) | |
293 GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE | |
294 ;; | |
295 *:OS108:*:*) | |
296 GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE | |
297 ;; | |
298 macppc:MirBSD:*:*) | |
299 GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE | |
300 ;; | |
301 *:MirBSD:*:*) | |
302 GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE | |
303 ;; | |
304 *:Sortix:*:*) | |
305 GUESS=$UNAME_MACHINE-unknown-sortix | |
306 ;; | |
307 *:Twizzler:*:*) | |
308 GUESS=$UNAME_MACHINE-unknown-twizzler | |
309 ;; | |
310 *:Redox:*:*) | |
311 GUESS=$UNAME_MACHINE-unknown-redox | |
312 ;; | |
313 mips:OSF1:*.*) | |
314 GUESS=mips-dec-osf1 | |
315 ;; | |
316 alpha:OSF1:*:*) | |
317 # Reset EXIT trap before exiting to avoid spurious non-zero exit code. | |
318 trap '' 0 | |
319 case $UNAME_RELEASE in | |
320 *4.0) | |
321 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` | |
322 ;; | |
323 *5.*) | |
324 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` | |
325 ;; | |
326 esac | |
327 # According to Compaq, /usr/sbin/psrinfo has been available on | |
328 # OSF/1 and Tru64 systems produced since 1995. I hope that | |
329 # covers most systems running today. This code pipes the CPU | |
330 # types through head -n 1, so we only detect the type of CPU 0. | |
331 ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` | |
332 case $ALPHA_CPU_TYPE in | |
333 "EV4 (21064)") | |
334 UNAME_MACHINE=alpha ;; | |
335 "EV4.5 (21064)") | |
336 UNAME_MACHINE=alpha ;; | |
337 "LCA4 (21066/21068)") | |
338 UNAME_MACHINE=alpha ;; | |
339 "EV5 (21164)") | |
340 UNAME_MACHINE=alphaev5 ;; | |
341 "EV5.6 (21164A)") | |
342 UNAME_MACHINE=alphaev56 ;; | |
343 "EV5.6 (21164PC)") | |
344 UNAME_MACHINE=alphapca56 ;; | |
345 "EV5.7 (21164PC)") | |
346 UNAME_MACHINE=alphapca57 ;; | |
347 "EV6 (21264)") | |
348 UNAME_MACHINE=alphaev6 ;; | |
349 "EV6.7 (21264A)") | |
350 UNAME_MACHINE=alphaev67 ;; | |
351 "EV6.8CB (21264C)") | |
352 UNAME_MACHINE=alphaev68 ;; | |
353 "EV6.8AL (21264B)") | |
354 UNAME_MACHINE=alphaev68 ;; | |
355 "EV6.8CX (21264D)") | |
356 UNAME_MACHINE=alphaev68 ;; | |
357 "EV6.9A (21264/EV69A)") | |
358 UNAME_MACHINE=alphaev69 ;; | |
359 "EV7 (21364)") | |
360 UNAME_MACHINE=alphaev7 ;; | |
361 "EV7.9 (21364A)") | |