ffi 1.13.1 → 1.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/README.md +10 -2
  4. data/ext/ffi_c/AbstractMemory.c +25 -26
  5. data/ext/ffi_c/Buffer.c +2 -7
  6. data/ext/ffi_c/Call.c +2 -7
  7. data/ext/ffi_c/ClosurePool.c +64 -11
  8. data/ext/ffi_c/ClosurePool.h +3 -1
  9. data/ext/ffi_c/DynamicLibrary.c +1 -6
  10. data/ext/ffi_c/Function.c +8 -13
  11. data/ext/ffi_c/FunctionInfo.c +2 -6
  12. data/ext/ffi_c/LastError.c +2 -6
  13. data/ext/ffi_c/MemoryPointer.c +2 -7
  14. data/ext/ffi_c/MethodHandle.c +4 -8
  15. data/ext/ffi_c/Platform.c +2 -7
  16. data/ext/ffi_c/Pointer.c +24 -25
  17. data/ext/ffi_c/Struct.c +3 -6
  18. data/ext/ffi_c/StructByValue.c +2 -7
  19. data/ext/ffi_c/StructLayout.c +2 -5
  20. data/ext/ffi_c/Thread.c +0 -5
  21. data/ext/ffi_c/Thread.h +1 -6
  22. data/ext/ffi_c/Type.c +1 -1
  23. data/ext/ffi_c/Variadic.c +2 -7
  24. data/ext/ffi_c/extconf.rb +17 -4
  25. data/ext/ffi_c/libffi/.travis/bfin-sim.exp +1 -1
  26. data/ext/ffi_c/libffi/.travis/m32r-sim.exp +1 -1
  27. data/ext/ffi_c/libffi/.travis/moxie-sim.exp +1 -1
  28. data/ext/ffi_c/libffi/.travis/or1k-sim.exp +1 -1
  29. data/ext/ffi_c/libffi/.travis/powerpc-eabisim.exp +1 -1
  30. data/ext/ffi_c/libffi/.travis/wine-sim.exp +1 -1
  31. data/ext/ffi_c/libffi/Makefile.am +48 -58
  32. data/ext/ffi_c/libffi/README.md +4 -0
  33. data/ext/ffi_c/libffi/config.guess +552 -331
  34. data/ext/ffi_c/libffi/config.sub +1321 -1306
  35. data/ext/ffi_c/libffi/configure.ac +6 -1
  36. data/ext/ffi_c/libffi/configure.host +32 -20
  37. data/ext/ffi_c/libffi/doc/Makefile.am +3 -0
  38. data/ext/ffi_c/libffi/doc/libffi.texi +997 -0
  39. data/ext/ffi_c/libffi/doc/version.texi +4 -0
  40. data/ext/ffi_c/libffi/generate-darwin-source-and-headers.py +1 -1
  41. data/ext/ffi_c/libffi/msvcc.sh +11 -11
  42. data/ext/ffi_c/libffi/src/aarch64/ffi.c +45 -35
  43. data/ext/ffi_c/libffi/src/aarch64/ffitarget.h +10 -5
  44. data/ext/ffi_c/libffi/src/aarch64/internal.h +1 -0
  45. data/ext/ffi_c/libffi/src/aarch64/sysv.S +1 -1
  46. data/ext/ffi_c/libffi/src/aarch64/win64_armasm.S +1 -1
  47. data/ext/ffi_c/libffi/src/arm/ffi.c +22 -0
  48. data/ext/ffi_c/libffi/src/arm/sysv.S +4 -4
  49. data/ext/ffi_c/libffi/src/closures.c +23 -6
  50. data/ext/ffi_c/libffi/src/csky/ffi.c +395 -0
  51. data/ext/ffi_c/libffi/src/csky/ffitarget.h +63 -0
  52. data/ext/ffi_c/libffi/src/csky/sysv.S +371 -0
  53. data/ext/ffi_c/libffi/src/dlmalloc.c +1 -1
  54. data/ext/ffi_c/libffi/src/kvx/asm.h +5 -0
  55. data/ext/ffi_c/libffi/src/kvx/ffi.c +273 -0
  56. data/ext/ffi_c/libffi/src/kvx/ffitarget.h +75 -0
  57. data/ext/ffi_c/libffi/src/kvx/sysv.S +127 -0
  58. data/ext/ffi_c/libffi/src/mips/ffi.c +5 -1
  59. data/ext/ffi_c/libffi/src/mips/ffitarget.h +1 -1
  60. data/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c +13 -1
  61. data/ext/ffi_c/libffi/src/powerpc/ffi_powerpc.h +1 -1
  62. data/ext/ffi_c/libffi/src/powerpc/linux64.S +8 -0
  63. data/ext/ffi_c/libffi/src/powerpc/linux64_closure.S +13 -1
  64. data/ext/ffi_c/libffi/src/prep_cif.c +1 -1
  65. data/ext/ffi_c/libffi/src/x86/ffi.c +8 -2
  66. data/ext/ffi_c/libffi/src/x86/ffi64.c +7 -0
  67. data/ext/ffi_c/libffi/src/x86/ffiw64.c +5 -0
  68. data/ext/ffi_c/libffi/src/x86/sysv.S +2 -2
  69. data/ext/ffi_c/libffi/src/x86/unix64.S +1 -2
  70. data/ext/ffi_c/libffi/src/x86/win64.S +3 -2
  71. data/ext/ffi_c/libffi/src/x86/win64_intel.S +3 -2
  72. data/ext/ffi_c/libffi/testsuite/lib/libffi.exp +22 -2
  73. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-call.c +4 -4
  74. data/ext/ffi_c/libffi/testsuite/libffi.bhaible/test-callback.c +2 -2
  75. data/ext/ffi_c/libffi/testsuite/libffi.closures/huge_struct.c +2 -0
  76. data/ffi.gemspec +1 -1
  77. data/lib/ffi.rb +2 -2
  78. data/lib/ffi/abstract_memory.rb +44 -0
  79. data/lib/ffi/ffi.rb +1 -0
  80. data/lib/ffi/library.rb +1 -1
  81. data/lib/ffi/platform.rb +15 -6
  82. data/lib/ffi/platform/aarch64-darwin/types.conf +130 -0
  83. data/lib/ffi/platform/aarch64-openbsd/types.conf +134 -0
  84. data/lib/ffi/platform/x86_64-haiku/types.conf +117 -0
  85. data/lib/ffi/platform/x86_64-msys/types.conf +119 -0
  86. data/lib/ffi/pointer.rb +21 -7
  87. data/lib/ffi/version.rb +1 -1
  88. metadata +15 -11
  89. data/.appveyor.yml +0 -30
  90. data/.github/workflows/ci.yml +0 -64
  91. data/.gitignore +0 -25
  92. data/.gitmodules +0 -4
  93. data/.travis.yml +0 -58
  94. data/.yardopts +0 -5
  95. data/ext/ffi_c/win32/stdbool.h +0 -8
  96. data/ext/ffi_c/win32/stdint.h +0 -201
@@ -14,7 +14,7 @@
14
14
  #
15
15
  # You should have received a copy of the GNU General Public License
16
16
  # along with DejaGnu; if not, write to the Free Software Foundation,
17
- # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
+ # Inc., 51 Franklin Street, Fifth Floor, MA 02110, USA.
18
18
 
19
19
  # This is a list of toolchains that are supported on this board.
20
20
  set_board_info target_install {i686-w64-mingw32}
@@ -44,65 +44,55 @@ if FFI_DEBUG
44
44
  libffi_la_SOURCES += src/debug.c
45
45
  endif
46
46
 
47
- noinst_HEADERS = \
48
- src/aarch64/ffitarget.h src/aarch64/internal.h \
47
+ noinst_HEADERS = src/aarch64/ffitarget.h src/aarch64/internal.h \
49
48
  src/alpha/ffitarget.h src/alpha/internal.h \
50
- src/arc/ffitarget.h \
51
- src/arm/ffitarget.h src/arm/internal.h \
52
- src/avr32/ffitarget.h \
53
- src/bfin/ffitarget.h \
54
- src/cris/ffitarget.h \
55
- src/frv/ffitarget.h \
49
+ src/arc/ffitarget.h src/arm/ffitarget.h src/arm/internal.h \
50
+ src/avr32/ffitarget.h src/bfin/ffitarget.h \
51
+ src/cris/ffitarget.h src/csky/ffitarget.h src/frv/ffitarget.h \
56
52
  src/ia64/ffitarget.h src/ia64/ia64_flags.h \
57
- src/m32r/ffitarget.h \
58
- src/m68k/ffitarget.h \
59
- src/m88k/ffitarget.h \
60
- src/metag/ffitarget.h \
61
- src/microblaze/ffitarget.h \
62
- src/mips/ffitarget.h \
63
- src/moxie/ffitarget.h \
64
- src/nios2/ffitarget.h \
65
- src/or1k/ffitarget.h \
66
- src/pa/ffitarget.h \
67
- src/powerpc/ffitarget.h src/powerpc/asm.h src/powerpc/ffi_powerpc.h \
68
- src/riscv/ffitarget.h \
69
- src/s390/ffitarget.h src/s390/internal.h \
70
- src/sh/ffitarget.h \
71
- src/sh64/ffitarget.h \
72
- src/sparc/ffitarget.h src/sparc/internal.h \
73
- src/tile/ffitarget.h \
74
- src/vax/ffitarget.h \
75
- src/x86/ffitarget.h src/x86/internal.h src/x86/internal64.h src/x86/asmnames.h \
76
- src/xtensa/ffitarget.h \
77
- src/dlmalloc.c
78
-
79
- EXTRA_libffi_la_SOURCES = src/aarch64/ffi.c src/aarch64/sysv.S \
80
- src/aarch64/win64_armasm.S src/alpha/ffi.c src/alpha/osf.S \
81
- src/arc/ffi.c src/arc/arcompact.S src/arm/ffi.c \
82
- src/arm/sysv.S src/arm/ffi.c src/arm/sysv_msvc_arm32.S \
83
- src/avr32/ffi.c src/avr32/sysv.S src/bfin/ffi.c \
84
- src/bfin/sysv.S src/cris/ffi.c src/cris/sysv.S src/frv/ffi.c \
85
- src/frv/eabi.S src/ia64/ffi.c src/ia64/unix.S src/m32r/ffi.c \
86
- src/m32r/sysv.S src/m68k/ffi.c src/m68k/sysv.S src/m88k/ffi.c \
87
- src/m88k/obsd.S src/metag/ffi.c src/metag/sysv.S \
88
- src/microblaze/ffi.c src/microblaze/sysv.S src/mips/ffi.c \
89
- src/mips/o32.S src/mips/n32.S src/moxie/ffi.c \
90
- src/moxie/eabi.S src/nios2/ffi.c src/nios2/sysv.S \
91
- src/or1k/ffi.c src/or1k/sysv.S src/pa/ffi.c src/pa/linux.S \
92
- src/pa/hpux32.S src/powerpc/ffi.c src/powerpc/ffi_sysv.c \
93
- src/powerpc/ffi_linux64.c src/powerpc/sysv.S \
94
- src/powerpc/linux64.S src/powerpc/linux64_closure.S \
95
- src/powerpc/ppc_closure.S src/powerpc/aix.S \
96
- src/powerpc/darwin.S src/powerpc/aix_closure.S \
97
- src/powerpc/darwin_closure.S src/powerpc/ffi_darwin.c \
98
- src/riscv/ffi.c src/riscv/sysv.S src/s390/ffi.c \
99
- src/s390/sysv.S src/sh/ffi.c src/sh/sysv.S src/sh64/ffi.c \
100
- src/sh64/sysv.S src/sparc/ffi.c src/sparc/ffi64.c \
101
- src/sparc/v8.S src/sparc/v9.S src/tile/ffi.c src/tile/tile.S \
102
- src/vax/ffi.c src/vax/elfbsd.S src/x86/ffi.c src/x86/sysv.S \
103
- src/x86/ffiw64.c src/x86/win64.S src/x86/ffi64.c \
104
- src/x86/unix64.S src/x86/sysv_intel.S src/x86/win64_intel.S \
105
- src/xtensa/ffi.c src/xtensa/sysv.S
53
+ src/m32r/ffitarget.h src/m68k/ffitarget.h \
54
+ src/m88k/ffitarget.h src/metag/ffitarget.h \
55
+ src/microblaze/ffitarget.h src/mips/ffitarget.h \
56
+ src/moxie/ffitarget.h src/nios2/ffitarget.h \
57
+ src/or1k/ffitarget.h src/pa/ffitarget.h \
58
+ src/powerpc/ffitarget.h src/powerpc/asm.h \
59
+ src/powerpc/ffi_powerpc.h src/riscv/ffitarget.h \
60
+ src/s390/ffitarget.h src/s390/internal.h src/sh/ffitarget.h \
61
+ src/sh64/ffitarget.h src/sparc/ffitarget.h \
62
+ src/sparc/internal.h src/tile/ffitarget.h src/vax/ffitarget.h \
63
+ src/x86/ffitarget.h src/x86/internal.h src/x86/internal64.h \
64
+ src/x86/asmnames.h src/xtensa/ffitarget.h src/dlmalloc.c \
65
+ src/kvx/ffitarget.h
66
+
67
+ EXTRA_libffi_la_SOURCES = src/aarch64/ffi.c src/aarch64/sysv.S \
68
+ src/aarch64/win64_armasm.S src/alpha/ffi.c src/alpha/osf.S \
69
+ src/arc/ffi.c src/arc/arcompact.S src/arm/ffi.c \
70
+ src/arm/sysv.S src/arm/ffi.c src/arm/sysv_msvc_arm32.S \
71
+ src/avr32/ffi.c src/avr32/sysv.S src/bfin/ffi.c \
72
+ src/bfin/sysv.S src/cris/ffi.c src/cris/sysv.S src/frv/ffi.c \
73
+ src/csky/ffi.c src/csky/sysv.S src/frv/eabi.S src/ia64/ffi.c \
74
+ src/ia64/unix.S src/m32r/ffi.c src/m32r/sysv.S src/m68k/ffi.c \
75
+ src/m68k/sysv.S src/m88k/ffi.c src/m88k/obsd.S \
76
+ src/metag/ffi.c src/metag/sysv.S src/microblaze/ffi.c \
77
+ src/microblaze/sysv.S src/mips/ffi.c src/mips/o32.S \
78
+ src/mips/n32.S src/moxie/ffi.c src/moxie/eabi.S \
79
+ src/nios2/ffi.c src/nios2/sysv.S src/or1k/ffi.c \
80
+ src/or1k/sysv.S src/pa/ffi.c src/pa/linux.S src/pa/hpux32.S \
81
+ src/powerpc/ffi.c src/powerpc/ffi_sysv.c \
82
+ src/powerpc/ffi_linux64.c src/powerpc/sysv.S \
83
+ src/powerpc/linux64.S src/powerpc/linux64_closure.S \
84
+ src/powerpc/ppc_closure.S src/powerpc/aix.S \
85
+ src/powerpc/darwin.S src/powerpc/aix_closure.S \
86
+ src/powerpc/darwin_closure.S src/powerpc/ffi_darwin.c \
87
+ src/riscv/ffi.c src/riscv/sysv.S src/s390/ffi.c \
88
+ src/s390/sysv.S src/sh/ffi.c src/sh/sysv.S src/sh64/ffi.c \
89
+ src/sh64/sysv.S src/sparc/ffi.c src/sparc/ffi64.c \
90
+ src/sparc/v8.S src/sparc/v9.S src/tile/ffi.c src/tile/tile.S \
91
+ src/vax/ffi.c src/vax/elfbsd.S src/x86/ffi.c src/x86/sysv.S \
92
+ src/x86/ffiw64.c src/x86/win64.S src/x86/ffi64.c \
93
+ src/x86/unix64.S src/x86/sysv_intel.S src/x86/win64_intel.S \
94
+ src/xtensa/ffi.c src/xtensa/sysv.S src/kvx/ffi.c \
95
+ src/kvx/sysv.S
106
96
 
107
97
  TARGET_OBJ = @TARGET_OBJ@
108
98
  libffi_la_LIBADD = $(TARGET_OBJ)
@@ -145,7 +135,7 @@ libffi_version_info = -version-info `grep -v '^\#' $(srcdir)/libtool-version`
145
135
 
146
136
  libffi.map: $(top_srcdir)/libffi.map.in
147
137
  $(COMPILE) -D$(TARGET) -DGENERATE_LIBFFI_MAP \
148
- -E -x assembler-with-cpp -o $@ $<
138
+ -E -x assembler-with-cpp -o $@ $(top_srcdir)/libffi.map.in
149
139
 
150
140
  libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS)
151
141
  libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep)
@@ -60,7 +60,9 @@ tested:
60
60
  | ARM | Windows | MSVC |
61
61
  | AVR32 | Linux | GCC |
62
62
  | Blackfin | uClinux | GCC |
63
+ | CSKY | Linux | GCC |
63
64
  | HPPA | HPUX | GCC |
65
+ | KVX | Linux | GCC |
64
66
  | IA-64 | Linux | GCC |
65
67
  | M68K | FreeMiNT | GCC |
66
68
  | M68K | Linux | GCC |
@@ -197,6 +199,7 @@ History
197
199
  See the git log for details at http://github.com/libffi/libffi.
198
200
 
199
201
  3.4 TBD
202
+ Add support for Alibaba's CSKY architecture.
200
203
  Add support for Intel Control-flow Enforcement Technology (CET).
201
204
  Add support for ARM Pointer Authentication (PA).
202
205
  Fix 32-bit PPC regression.
@@ -434,6 +437,7 @@ developers:
434
437
  avr32 Bradley Smith
435
438
  blackfin Alexandre Keunecke I. de Mendonca
436
439
  cris Simon Posnjak, Hans-Peter Nilsson
440
+ csky Ma Jun, Zhang Wenmeng
437
441
  frv Anthony Green
438
442
  ia64 Hans Boehm
439
443
  m32r Kazuhiro Inaoka
@@ -1,8 +1,8 @@
1
1
  #! /bin/sh
2
2
  # Attempt to guess a canonical system name.
3
- # Copyright 1992-2017 Free Software Foundation, Inc.
3
+ # Copyright 1992-2020 Free Software Foundation, Inc.
4
4
 
5
- timestamp='2017-05-11'
5
+ timestamp='2020-07-12'
6
6
 
7
7
  # This file is free software; you can redistribute it and/or modify it
8
8
  # under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@ timestamp='2017-05-11'
15
15
  # General Public License for more details.
16
16
  #
17
17
  # You should have received a copy of the GNU General Public License
18
- # along with this program; if not, see <http://www.gnu.org/licenses/>.
18
+ # along with this program; if not, see <https://www.gnu.org/licenses/>.
19
19
  #
20
20
  # As a special exception to the GNU General Public License, if you
21
21
  # distribute this file as part of a program that contains a
@@ -27,7 +27,7 @@ timestamp='2017-05-11'
27
27
  # Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
28
28
  #
29
29
  # You can get the latest version of this script from:
30
- # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
30
+ # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
31
31
  #
32
32
  # Please send patches to <config-patches@gnu.org>.
33
33
 
@@ -39,7 +39,7 @@ Usage: $0 [OPTION]
39
39
 
40
40
  Output the configuration name of the system \`$me' is run on.
41
41
 
42
- Operation modes:
42
+ Options:
43
43
  -h, --help print this help, then exit
44
44
  -t, --time-stamp print date of last modification, then exit
45
45
  -v, --version print version number, then exit
@@ -50,7 +50,7 @@ version="\
50
50
  GNU config.guess ($timestamp)
51
51
 
52
52
  Originally written by Per Bothner.
53
- Copyright 1992-2017 Free Software Foundation, Inc.
53
+ Copyright 1992-2020 Free Software Foundation, Inc.
54
54
 
55
55
  This is free software; see the source for copying conditions. There is NO
56
56
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -84,8 +84,6 @@ if test $# != 0; then
84
84
  exit 1
85
85
  fi
86
86
 
87
- trap 'exit 1' 1 2 15
88
-
89
87
  # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
90
88
  # compiler to aid in system detection is discouraged as it requires
91
89
  # temporary files to be created and, as you can see below, it is a
@@ -96,34 +94,40 @@ trap 'exit 1' 1 2 15
96
94
 
97
95
  # Portable tmp directory creation inspired by the Autoconf team.
98
96
 
99
- set_cc_for_build='
100
- trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
101
- trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
102
- : ${TMPDIR=/tmp} ;
103
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
104
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
105
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
106
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
107
- dummy=$tmp/dummy ;
108
- tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
109
- case $CC_FOR_BUILD,$HOST_CC,$CC in
110
- ,,) echo "int x;" > $dummy.c ;
111
- for c in cc gcc c89 c99 ; do
112
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
113
- CC_FOR_BUILD="$c"; break ;
114
- fi ;
115
- done ;
116
- if test x"$CC_FOR_BUILD" = x ; then
117
- CC_FOR_BUILD=no_compiler_found ;
118
- fi
119
- ;;
120
- ,,*) CC_FOR_BUILD=$CC ;;
121
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
122
- 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
+ }
123
127
 
124
128
  # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
125
129
  # (ghazi@noc.rutgers.edu 1994-08-24)
126
- if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
130
+ if test -f /.attbin/uname ; then
127
131
  PATH=$PATH:/.attbin ; export PATH
128
132
  fi
129
133
 
@@ -132,14 +136,14 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
132
136
  UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
133
137
  UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
134
138
 
135
- case "${UNAME_SYSTEM}" in
139
+ case "$UNAME_SYSTEM" in
136
140
  Linux|GNU|GNU/*)
137
141
  # If the system lacks a compiler, then just pick glibc.
138
142
  # We could probably try harder.
139
143
  LIBC=gnu
140
144
 
141
- eval $set_cc_for_build
142
- cat <<-EOF > $dummy.c
145
+ set_cc_for_build
146
+ cat <<-EOF > "$dummy.c"
143
147
  #include <features.h>
144
148
  #if defined(__UCLIBC__)
145
149
  LIBC=uclibc
@@ -149,13 +153,20 @@ Linux|GNU|GNU/*)
149
153
  LIBC=gnu
150
154
  #endif
151
155
  EOF
152
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
156
+ eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`"
157
+
158
+ # If ldd exists, use it to detect musl libc.
159
+ if command -v ldd >/dev/null && \
160
+ ldd --version 2>&1 | grep -q ^musl
161
+ then
162
+ LIBC=musl
163
+ fi
153
164
  ;;
154
165
  esac
155
166
 
156
167
  # Note: order is significant - the case branches are not exclusive.
157
168
 
158
- case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
169
+ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
159
170
  *:NetBSD:*:*)
160
171
  # NetBSD (nbsd) targets should (where applicable) match one or
161
172
  # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
@@ -169,30 +180,30 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
169
180
  # portion of the name. We always set it to "unknown".
170
181
  sysctl="sysctl -n hw.machine_arch"
171
182
  UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
172
- /sbin/$sysctl 2>/dev/null || \
173
- /usr/sbin/$sysctl 2>/dev/null || \
183
+ "/sbin/$sysctl" 2>/dev/null || \
184
+ "/usr/sbin/$sysctl" 2>/dev/null || \
174
185
  echo unknown)`
175
- case "${UNAME_MACHINE_ARCH}" in
186
+ case "$UNAME_MACHINE_ARCH" in
176
187
  armeb) machine=armeb-unknown ;;
177
188
  arm*) machine=arm-unknown ;;
178
189
  sh3el) machine=shl-unknown ;;
179
190
  sh3eb) machine=sh-unknown ;;
180
191
  sh5el) machine=sh5le-unknown ;;
181
192
  earmv*)
182
- arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
183
- endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
184
- machine=${arch}${endian}-unknown
193
+ arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
194
+ endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'`
195
+ machine="${arch}${endian}"-unknown
185
196
  ;;
186
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
197
+ *) machine="$UNAME_MACHINE_ARCH"-unknown ;;
187
198
  esac
188
199
  # The Operating System including object format, if it has switched
189
200
  # to ELF recently (or will in the future) and ABI.
190
- case "${UNAME_MACHINE_ARCH}" in
201
+ case "$UNAME_MACHINE_ARCH" in
191
202
  earm*)
192
203
  os=netbsdelf
193
204
  ;;
194
205
  arm*|i386|m68k|ns32k|sh3*|sparc|vax)
195
- eval $set_cc_for_build
206
+ set_cc_for_build
196
207
  if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
197
208
  | grep -q __ELF__
198
209
  then
@@ -208,10 +219,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
208
219
  ;;
209
220
  esac
210
221
  # Determine ABI tags.
211
- case "${UNAME_MACHINE_ARCH}" in
222
+ case "$UNAME_MACHINE_ARCH" in
212
223
  earm*)
213
224
  expr='s/^earmv[0-9]/-eabi/;s/eb$//'
214
- abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
225
+ abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"`
215
226
  ;;
216
227
  esac
217
228
  # The OS release
@@ -219,45 +230,60 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
219
230
  # thus, need a distinct triplet. However, they do not need
220
231
  # kernel version information, so it can be replaced with a
221
232
  # suitable tag, in the style of linux-gnu.
222
- case "${UNAME_VERSION}" in
233
+ case "$UNAME_VERSION" in
223
234
  Debian*)
224
235
  release='-gnu'
225
236
  ;;
226
237
  *)
227
- release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
238
+ release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2`
228
239
  ;;
229
240
  esac
230
241
  # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
231
242
  # contains redundant information, the shorter form:
232
243
  # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
233
- echo "${machine}-${os}${release}${abi}"
244
+ echo "$machine-${os}${release}${abi-}"
234
245
  exit ;;
235
246
  *:Bitrig:*:*)
236
247
  UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
237
- echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
248
+ echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE"
238
249
  exit ;;
239
250
  *:OpenBSD:*:*)
240
251
  UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
241
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
252
+ echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE"
242
253
  exit ;;
243
254
  *:LibertyBSD:*:*)
244
255
  UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
245
- echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
256
+ echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE"
257
+ exit ;;
258
+ *:MidnightBSD:*:*)
259
+ echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE"
246
260
  exit ;;
247
261
  *:ekkoBSD:*:*)
248
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
262
+ echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE"
249
263
  exit ;;
250
264
  *:SolidBSD:*:*)
251
- echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
265
+ echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE"
266
+ exit ;;
267
+ *:OS108:*:*)
268
+ echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE"
252
269
  exit ;;
253
270
  macppc:MirBSD:*:*)
254
- echo powerpc-unknown-mirbsd${UNAME_RELEASE}
271
+ echo powerpc-unknown-mirbsd"$UNAME_RELEASE"
255
272
  exit ;;
256
273
  *:MirBSD:*:*)
257
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
274
+ echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE"
258
275
  exit ;;
259
276
  *:Sortix:*:*)
260
- echo ${UNAME_MACHINE}-unknown-sortix
277
+ echo "$UNAME_MACHINE"-unknown-sortix
278
+ exit ;;
279
+ *:Twizzler:*:*)
280
+ echo "$UNAME_MACHINE"-unknown-twizzler
281
+ exit ;;
282
+ *:Redox:*:*)
283
+ echo "$UNAME_MACHINE"-unknown-redox
284
+ exit ;;
285
+ mips:OSF1:*.*)
286
+ echo mips-dec-osf1
261
287
  exit ;;
262
288
  alpha:OSF1:*:*)
263
289
  case $UNAME_RELEASE in
@@ -310,28 +336,19 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
310
336
  # A Tn.n version is a released field test version.
311
337
  # A Xn.n version is an unreleased experimental baselevel.
312
338
  # 1.2 uses "1.2" for uname -r.
313
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
339
+ echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`"
314
340
  # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
315
341
  exitcode=$?
316
342
  trap '' 0
317
343
  exit $exitcode ;;
318
- Alpha\ *:Windows_NT*:*)
319
- # How do we know it's Interix rather than the generic POSIX subsystem?
320
- # Should we change UNAME_MACHINE based on the output of uname instead
321
- # of the specific Alpha model?
322
- echo alpha-pc-interix
323
- exit ;;
324
- 21064:Windows_NT:50:3)
325
- echo alpha-dec-winnt3.5
326
- exit ;;
327
344
  Amiga*:UNIX_System_V:4.0:*)
328
345
  echo m68k-unknown-sysv4
329
346
  exit ;;
330
347
  *:[Aa]miga[Oo][Ss]:*:*)
331
- echo ${UNAME_MACHINE}-unknown-amigaos
348
+ echo "$UNAME_MACHINE"-unknown-amigaos
332
349
  exit ;;
333
350
  *:[Mm]orph[Oo][Ss]:*:*)
334
- echo ${UNAME_MACHINE}-unknown-morphos
351
+ echo "$UNAME_MACHINE"-unknown-morphos
335
352
  exit ;;
336
353
  *:OS/390:*:*)
337
354
  echo i370-ibm-openedition
@@ -343,7 +360,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
343
360
  echo powerpc-ibm-os400
344
361
  exit ;;
345
362
  arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
346
- echo arm-acorn-riscix${UNAME_RELEASE}
363
+ echo arm-acorn-riscix"$UNAME_RELEASE"
347
364
  exit ;;
348
365
  arm*:riscos:*:*|arm*:RISCOS:*:*)
349
366
  echo arm-unknown-riscos
@@ -370,19 +387,19 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
370
387
  sparc) echo sparc-icl-nx7; exit ;;
371
388
  esac ;;
372
389
  s390x:SunOS:*:*)
373
- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
390
+ echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
374
391
  exit ;;
375
392
  sun4H:SunOS:5.*:*)
376
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
393
+ echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
377
394
  exit ;;
378
395
  sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
379
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
396
+ echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
380
397
  exit ;;
381
398
  i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
382
- echo i386-pc-auroraux${UNAME_RELEASE}
399
+ echo i386-pc-auroraux"$UNAME_RELEASE"
383
400
  exit ;;
384
401
  i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
385
- eval $set_cc_for_build
402
+ set_cc_for_build
386
403
  SUN_ARCH=i386
387
404
  # If there is a compiler, see if it is configured for 64-bit objects.
388
405
  # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
@@ -395,13 +412,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
395
412
  SUN_ARCH=x86_64
396
413
  fi
397
414
  fi
398
- echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
415
+ echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
399
416
  exit ;;
400
417
  sun4*:SunOS:6*:*)
401
418
  # According to config.sub, this is the proper way to canonicalize
402
419
  # SunOS6. Hard to guess exactly what SunOS6 will be like, but
403
420
  # it's likely to be more like Solaris than SunOS4.
404
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
421
+ echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
405
422
  exit ;;
406
423
  sun4*:SunOS:*:*)
407
424
  case "`/usr/bin/arch -k`" in
@@ -410,25 +427,25 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
410
427
  ;;
411
428
  esac
412
429
  # Japanese Language versions have a version number like `4.1.3-JL'.
413
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
430
+ echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`"
414
431
  exit ;;
415
432
  sun3*:SunOS:*:*)
416
- echo m68k-sun-sunos${UNAME_RELEASE}
433
+ echo m68k-sun-sunos"$UNAME_RELEASE"
417
434
  exit ;;
418
435
  sun*:*:4.2BSD:*)
419
436
  UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
420
- test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3
437
+ test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3
421
438
  case "`/bin/arch`" in
422
439
  sun3)
423
- echo m68k-sun-sunos${UNAME_RELEASE}
440
+ echo m68k-sun-sunos"$UNAME_RELEASE"
424
441
  ;;
425
442
  sun4)
426
- echo sparc-sun-sunos${UNAME_RELEASE}
443
+ echo sparc-sun-sunos"$UNAME_RELEASE"
427
444
  ;;
428
445
  esac
429
446
  exit ;;
430
447
  aushp:SunOS:*:*)
431
- echo sparc-auspex-sunos${UNAME_RELEASE}
448
+ echo sparc-auspex-sunos"$UNAME_RELEASE"
432
449
  exit ;;
433
450
  # The situation for MiNT is a little confusing. The machine name
434
451
  # can be virtually everything (everything which is not
@@ -439,44 +456,44 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
439
456
  # MiNT. But MiNT is downward compatible to TOS, so this should
440
457
  # be no problem.
441
458
  atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
442
- echo m68k-atari-mint${UNAME_RELEASE}
459
+ echo m68k-atari-mint"$UNAME_RELEASE"
443
460
  exit ;;
444
461
  atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
445
- echo m68k-atari-mint${UNAME_RELEASE}
462
+ echo m68k-atari-mint"$UNAME_RELEASE"
446
463
  exit ;;
447
464
  *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
448
- echo m68k-atari-mint${UNAME_RELEASE}
465
+ echo m68k-atari-mint"$UNAME_RELEASE"
449
466
  exit ;;
450
467
  milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
451
- echo m68k-milan-mint${UNAME_RELEASE}
468
+ echo m68k-milan-mint"$UNAME_RELEASE"
452
469
  exit ;;
453
470
  hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
454
- echo m68k-hades-mint${UNAME_RELEASE}
471
+ echo m68k-hades-mint"$UNAME_RELEASE"
455
472
  exit ;;
456
473
  *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
457
- echo m68k-unknown-mint${UNAME_RELEASE}
474
+ echo m68k-unknown-mint"$UNAME_RELEASE"
458
475
  exit ;;
459
476
  m68k:machten:*:*)
460
- echo m68k-apple-machten${UNAME_RELEASE}
477
+ echo m68k-apple-machten"$UNAME_RELEASE"
461
478
  exit ;;
462
479
  powerpc:machten:*:*)
463
- echo powerpc-apple-machten${UNAME_RELEASE}
480
+ echo powerpc-apple-machten"$UNAME_RELEASE"
464
481
  exit ;;
465
482
  RISC*:Mach:*:*)
466
483
  echo mips-dec-mach_bsd4.3
467
484
  exit ;;
468
485
  RISC*:ULTRIX:*:*)
469
- echo mips-dec-ultrix${UNAME_RELEASE}
486
+ echo mips-dec-ultrix"$UNAME_RELEASE"
470
487
  exit ;;
471
488
  VAX*:ULTRIX*:*:*)
472
- echo vax-dec-ultrix${UNAME_RELEASE}
489
+ echo vax-dec-ultrix"$UNAME_RELEASE"
473
490
  exit ;;
474
491
  2020:CLIX:*:* | 2430:CLIX:*:*)
475
- echo clipper-intergraph-clix${UNAME_RELEASE}
492
+ echo clipper-intergraph-clix"$UNAME_RELEASE"
476
493
  exit ;;
477
494
  mips:*:*:UMIPS | mips:*:*:RISCos)
478
- eval $set_cc_for_build
479
- sed 's/^ //' << EOF >$dummy.c
495
+ set_cc_for_build
496
+ sed 's/^ //' << EOF > "$dummy.c"
480
497
  #ifdef __cplusplus
481
498
  #include <stdio.h> /* for printf() prototype */
482
499
  int main (int argc, char *argv[]) {
@@ -485,23 +502,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
485
502
  #endif
486
503
  #if defined (host_mips) && defined (MIPSEB)
487
504
  #if defined (SYSTYPE_SYSV)
488
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
505
+ printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
489
506
  #endif
490
507
  #if defined (SYSTYPE_SVR4)
491
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
508
+ printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
492
509
  #endif
493
510
  #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
494
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
511
+ printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0);
495
512
  #endif
496
513
  #endif
497
514
  exit (-1);
498
515
  }
499
516
  EOF
500
- $CC_FOR_BUILD -o $dummy $dummy.c &&
501
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
502
- SYSTEM_NAME=`$dummy $dummyarg` &&
517
+ $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
518
+ dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
519
+ SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
503
520
  { echo "$SYSTEM_NAME"; exit; }
504
- echo mips-mips-riscos${UNAME_RELEASE}
521
+ echo mips-mips-riscos"$UNAME_RELEASE"
505
522
  exit ;;
506
523
  Motorola:PowerMAX_OS:*:*)
507
524
  echo powerpc-motorola-powermax
@@ -527,17 +544,17 @@ EOF
527
544
  AViiON:dgux:*:*)
528
545
  # DG/UX returns AViiON for all architectures
529
546
  UNAME_PROCESSOR=`/usr/bin/uname -p`
530
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
547
+ if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
531
548
  then
532
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
533
- [ ${TARGET_BINARY_INTERFACE}x = x ]
549
+ if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
550
+ [ "$TARGET_BINARY_INTERFACE"x = x ]
534
551
  then
535
- echo m88k-dg-dgux${UNAME_RELEASE}
552
+ echo m88k-dg-dgux"$UNAME_RELEASE"
536
553
  else
537
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
554
+ echo m88k-dg-dguxbcs"$UNAME_RELEASE"
538
555
  fi
539
556
  else
540
- echo i586-dg-dgux${UNAME_RELEASE}
557
+ echo i586-dg-dgux"$UNAME_RELEASE"
541
558
  fi
542
559
  exit ;;
543
560
  M88*:DolphinOS:*:*) # DolphinOS (SVR3)
@@ -554,7 +571,7 @@ EOF
554
571
  echo m68k-tektronix-bsd
555
572
  exit ;;
556
573
  *:IRIX*:*:*)
557
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
574
+ echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`"
558
575
  exit ;;
559
576
  ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
560
577
  echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
@@ -566,14 +583,14 @@ EOF
566
583
  if [ -x /usr/bin/oslevel ] ; then
567
584
  IBM_REV=`/usr/bin/oslevel`
568
585
  else
569
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
586
+ IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
570
587
  fi
571
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
588
+ echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV"
572
589
  exit ;;
573
590
  *:AIX:2:3)
574
591
  if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
575
- eval $set_cc_for_build
576
- sed 's/^ //' << EOF >$dummy.c
592
+ set_cc_for_build
593
+ sed 's/^ //' << EOF > "$dummy.c"
577
594
  #include <sys/systemcfg.h>
578
595
 
579
596
  main()
@@ -584,7 +601,7 @@ EOF
584
601
  exit(0);
585
602
  }
586
603
  EOF
587
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
604
+ if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"`
588
605
  then
589
606
  echo "$SYSTEM_NAME"
590
607
  else
@@ -598,7 +615,7 @@ EOF
598
615
  exit ;;
599
616
  *:AIX:*:[4567])
600
617
  IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
601
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
618
+ if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then
602
619
  IBM_ARCH=rs6000
603
620
  else
604
621
  IBM_ARCH=powerpc
@@ -607,18 +624,18 @@ EOF
607
624
  IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
608
625
  awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
609
626
  else
610
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
627
+ IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
611
628
  fi
612
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
629
+ echo "$IBM_ARCH"-ibm-aix"$IBM_REV"
613
630
  exit ;;
614
631
  *:AIX:*:*)
615
632
  echo rs6000-ibm-aix
616
633
  exit ;;
617
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
634
+ ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*)
618
635
  echo romp-ibm-bsd4.4
619
636
  exit ;;
620
637
  ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
621
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
638
+ echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to
622
639
  exit ;; # report: romp-ibm BSD 4.3
623
640
  *:BOSX:*:*)
624
641
  echo rs6000-bull-bosx
@@ -633,28 +650,28 @@ EOF
633
650
  echo m68k-hp-bsd4.4
634
651
  exit ;;
635
652
  9000/[34678]??:HP-UX:*:*)
636
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
637
- case "${UNAME_MACHINE}" in
638
- 9000/31? ) HP_ARCH=m68000 ;;
639
- 9000/[34]?? ) HP_ARCH=m68k ;;
653
+ HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
654
+ case "$UNAME_MACHINE" in
655
+ 9000/31?) HP_ARCH=m68000 ;;
656
+ 9000/[34]??) HP_ARCH=m68k ;;
640
657
  9000/[678][0-9][0-9])
641
658
  if [ -x /usr/bin/getconf ]; then
642
659
  sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
643
660
  sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
644
- case "${sc_cpu_version}" in
661
+ case "$sc_cpu_version" in
645
662
  523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0
646
663
  528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1
647
664
  532) # CPU_PA_RISC2_0
648
- case "${sc_kernel_bits}" in
665
+ case "$sc_kernel_bits" in
649
666
  32) HP_ARCH=hppa2.0n ;;
650
667
  64) HP_ARCH=hppa2.0w ;;
651
668
  '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20
652
669
  esac ;;
653
670
  esac
654
671
  fi
655
- if [ "${HP_ARCH}" = "" ]; then
656
- eval $set_cc_for_build
657
- sed 's/^ //' << EOF >$dummy.c
672
+ if [ "$HP_ARCH" = "" ]; then
673
+ set_cc_for_build
674
+ sed 's/^ //' << EOF > "$dummy.c"
658
675
 
659
676
  #define _HPUX_SOURCE
660
677
  #include <stdlib.h>
@@ -687,13 +704,13 @@ EOF
687
704
  exit (0);
688
705
  }
689
706
  EOF
690
- (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
707
+ (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"`
691
708
  test -z "$HP_ARCH" && HP_ARCH=hppa
692
709
  fi ;;
693
710
  esac
694
- if [ ${HP_ARCH} = hppa2.0w ]
711
+ if [ "$HP_ARCH" = hppa2.0w ]
695
712
  then
696
- eval $set_cc_for_build
713
+ set_cc_for_build
697
714
 
698
715
  # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
699
716
  # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
@@ -712,15 +729,15 @@ EOF
712
729
  HP_ARCH=hppa64
713
730
  fi
714
731
  fi
715
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
732
+ echo "$HP_ARCH"-hp-hpux"$HPUX_REV"
716
733
  exit ;;
717
734
  ia64:HP-UX:*:*)
718
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
719
- echo ia64-hp-hpux${HPUX_REV}
735
+ HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'`
736
+ echo ia64-hp-hpux"$HPUX_REV"
720
737
  exit ;;
721
738
  3050*:HI-UX:*:*)
722
- eval $set_cc_for_build
723
- sed 's/^ //' << EOF >$dummy.c
739
+ set_cc_for_build
740
+ sed 's/^ //' << EOF > "$dummy.c"
724
741
  #include <unistd.h>
725
742
  int
726
743
  main ()
@@ -745,11 +762,11 @@ EOF
745
762
  exit (0);
746
763
  }
747
764
  EOF
748
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
765
+ $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` &&
749
766
  { echo "$SYSTEM_NAME"; exit; }
750
767
  echo unknown-hitachi-hiuxwe2
751
768
  exit ;;
752
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
769
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*)
753
770
  echo hppa1.1-hp-bsd
754
771
  exit ;;
755
772
  9000/8??:4.3bsd:*:*)
@@ -758,7 +775,7 @@ EOF
758
775
  *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
759
776
  echo hppa1.0-hp-mpeix
760
777
  exit ;;
761
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
778
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*)
762
779
  echo hppa1.1-hp-osf
763
780
  exit ;;
764
781
  hp8??:OSF1:*:*)
@@ -766,9 +783,9 @@ EOF
766
783
  exit ;;
767
784
  i*86:OSF1:*:*)
768
785
  if [ -x /usr/sbin/sysversion ] ; then
769
- echo ${UNAME_MACHINE}-unknown-osf1mk
786
+ echo "$UNAME_MACHINE"-unknown-osf1mk
770
787
  else
771
- echo ${UNAME_MACHINE}-unknown-osf1
788
+ echo "$UNAME_MACHINE"-unknown-osf1
772
789
  fi
773
790
  exit ;;
774
791
  parisc*:Lites*:*:*)
@@ -793,131 +810,123 @@ EOF
793
810
  echo c4-convex-bsd
794
811
  exit ;;
795
812
  CRAY*Y-MP:*:*:*)
796
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
813
+ echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
797
814
  exit ;;
798
815
  CRAY*[A-Z]90:*:*:*)
799
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
816
+ echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \
800
817
  | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
801
818
  -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
802
819
  -e 's/\.[^.]*$/.X/'
803
820
  exit ;;
804
821
  CRAY*TS:*:*:*)
805
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
822
+ echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
806
823
  exit ;;
807
824
  CRAY*T3E:*:*:*)
808
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
825
+ echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
809
826
  exit ;;
810
827
  CRAY*SV1:*:*:*)
811
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
828
+ echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
812
829
  exit ;;
813
830
  *:UNICOS/mp:*:*)
814
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
831
+ echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'
815
832
  exit ;;
816
833
  F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
817
834
  FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
818
835
  FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
819
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
836
+ FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'`
820
837
  echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
821
838
  exit ;;
822
839
  5000:UNIX_System_V:4.*:*)
823
840
  FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'`
824
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
841
+ FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'`
825
842
  echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
826
843
  exit ;;
827
844
  i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
828
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
845
+ echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE"
829
846
  exit ;;
830
847
  sparc*:BSD/OS:*:*)
831
- echo sparc-unknown-bsdi${UNAME_RELEASE}
848
+ echo sparc-unknown-bsdi"$UNAME_RELEASE"
832
849
  exit ;;
833
850
  *:BSD/OS:*:*)
834
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
851
+ echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE"
852
+ exit ;;
853
+ arm:FreeBSD:*:*)
854
+ UNAME_PROCESSOR=`uname -p`
855
+ set_cc_for_build
856
+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
857
+ | grep -q __ARM_PCS_VFP
858
+ then
859
+ echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabi
860
+ else
861
+ echo "${UNAME_PROCESSOR}"-unknown-freebsd"`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`"-gnueabihf
862
+ fi
835
863
  exit ;;
836
864
  *:FreeBSD:*:*)
837
865
  UNAME_PROCESSOR=`/usr/bin/uname -p`
838
- case ${UNAME_PROCESSOR} in
866
+ case "$UNAME_PROCESSOR" in
839
867
  amd64)
840
868
  UNAME_PROCESSOR=x86_64 ;;
841
869
  i386)
842
870
  UNAME_PROCESSOR=i586 ;;
843
871
  esac
844
- echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
872
+ echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
845
873
  exit ;;
846
874
  i*:CYGWIN*:*)
847
- echo ${UNAME_MACHINE}-pc-cygwin
875
+ echo "$UNAME_MACHINE"-pc-cygwin
848
876
  exit ;;
849
877
  *:MINGW64*:*)
850
- echo ${UNAME_MACHINE}-pc-mingw64
878
+ echo "$UNAME_MACHINE"-pc-mingw64
851
879
  exit ;;
852
880
  *:MINGW*:*)
853
- echo ${UNAME_MACHINE}-pc-mingw32
881
+ echo "$UNAME_MACHINE"-pc-mingw32
854
882
  exit ;;
855
883
  *:MSYS*:*)
856
- echo ${UNAME_MACHINE}-pc-msys
857
- exit ;;
858
- i*:windows32*:*)
859
- # uname -m includes "-pc" on this system.
860
- echo ${UNAME_MACHINE}-mingw32
884
+ echo "$UNAME_MACHINE"-pc-msys
861
885
  exit ;;
862
886
  i*:PW*:*)
863
- echo ${UNAME_MACHINE}-pc-pw32
887
+ echo "$UNAME_MACHINE"-pc-pw32
864
888
  exit ;;
865
889
  *:Interix*:*)
866
- case ${UNAME_MACHINE} in
890
+ case "$UNAME_MACHINE" in
867
891
  x86)
868
- echo i586-pc-interix${UNAME_RELEASE}
892
+ echo i586-pc-interix"$UNAME_RELEASE"
869
893
  exit ;;
870
894
  authenticamd | genuineintel | EM64T)
871
- echo x86_64-unknown-interix${UNAME_RELEASE}
895
+ echo x86_64-unknown-interix"$UNAME_RELEASE"
872
896
  exit ;;
873
897
  IA64)
874
- echo ia64-unknown-interix${UNAME_RELEASE}
898
+ echo ia64-unknown-interix"$UNAME_RELEASE"
875
899
  exit ;;
876
900
  esac ;;
877
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
878
- echo i${UNAME_MACHINE}-pc-mks
879
- exit ;;
880
- 8664:Windows_NT:*)
881
- echo x86_64-pc-mks
882
- exit ;;
883
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
884
- # How do we know it's Interix rather than the generic POSIX subsystem?
885
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
886
- # UNAME_MACHINE based on the output of uname instead of i386?
887
- echo i586-pc-interix
888
- exit ;;
889
901
  i*:UWIN*:*)
890
- echo ${UNAME_MACHINE}-pc-uwin
902
+ echo "$UNAME_MACHINE"-pc-uwin
891
903
  exit ;;
892
904
  amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
893
- echo x86_64-unknown-cygwin
894
- exit ;;
895
- p*:CYGWIN*:*)
896
- echo powerpcle-unknown-cygwin
905
+ echo x86_64-pc-cygwin
897
906
  exit ;;
898
907
  prep*:SunOS:5.*:*)
899
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
908
+ echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
900
909
  exit ;;
901
910
  *:GNU:*:*)
902
911
  # the GNU system
903
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
912
+ echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`"
904
913
  exit ;;
905
914
  *:GNU/*:*:*)
906
915
  # other systems with GNU libc and userland
907
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
916
+ echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC"
908
917
  exit ;;
909
- i*86:Minix:*:*)
910
- echo ${UNAME_MACHINE}-pc-minix
918
+ *:Minix:*:*)
919
+ echo "$UNAME_MACHINE"-unknown-minix
911
920
  exit ;;
912
921
  aarch64:Linux:*:*)
913
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
922
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
914
923
  exit ;;
915
924
  aarch64_be:Linux:*:*)
916
925
  UNAME_MACHINE=aarch64_be
917
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
926
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
918
927
  exit ;;
919
928
  alpha:Linux:*:*)
920
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
929
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` in
921
930
  EV5) UNAME_MACHINE=alphaev5 ;;
922
931
  EV56) UNAME_MACHINE=alphaev56 ;;
923
932
  PCA56) UNAME_MACHINE=alphapca56 ;;
@@ -928,140 +937,178 @@ EOF
928
937
  esac
929
938
  objdump --private-headers /bin/sh | grep -q ld.so.1
930
939
  if test "$?" = 0 ; then LIBC=gnulibc1 ; fi
931
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
940
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
932
941
  exit ;;
933
942
  arc:Linux:*:* | arceb:Linux:*:*)
934
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
943
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
935
944
  exit ;;
936
945
  arm*:Linux:*:*)
937
- eval $set_cc_for_build
946
+ set_cc_for_build
938
947
  if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
939
948
  | grep -q __ARM_EABI__
940
949
  then
941
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
950
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
942
951
  else
943
952
  if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
944
953
  | grep -q __ARM_PCS_VFP
945
954
  then
946
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
955
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi
947
956
  else
948
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
957
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf
949
958
  fi
950
959
  fi
951
960
  exit ;;
952
961
  avr32*:Linux:*:*)
953
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
962
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
954
963
  exit ;;
955
964
  cris:Linux:*:*)
956
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
965
+ echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
957
966
  exit ;;
958
967
  crisv32:Linux:*:*)
959
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
968
+ echo "$UNAME_MACHINE"-axis-linux-"$LIBC"
960
969
  exit ;;
961
970
  e2k:Linux:*:*)
962
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
971
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
963
972
  exit ;;
964
973
  frv:Linux:*:*)
965
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
974
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
966
975
  exit ;;
967
976
  hexagon:Linux:*:*)
968
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
977
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
969
978
  exit ;;
970
979
  i*86:Linux:*:*)
971
- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
980
+ echo "$UNAME_MACHINE"-pc-linux-"$LIBC"
972
981
  exit ;;
973
982
  ia64:Linux:*:*)
974
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
983
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
975
984
  exit ;;
976
985
  k1om:Linux:*:*)
977
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
986
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
978
987
  exit ;;
979
988
  m32r*:Linux:*:*)
980
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
989
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
981
990
  exit ;;
982
991
  m68*:Linux:*:*)
983
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
992
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
984
993
  exit ;;
985
994
  mips:Linux:*:* | mips64:Linux:*:*)
986
- eval $set_cc_for_build
987
- sed 's/^ //' << EOF >$dummy.c
995
+ set_cc_for_build
996
+ IS_GLIBC=0
997
+ test x"${LIBC}" = xgnu && IS_GLIBC=1
998
+ sed 's/^ //' << EOF > "$dummy.c"
988
999
  #undef CPU
989
- #undef ${UNAME_MACHINE}
990
- #undef ${UNAME_MACHINE}el
1000
+ #undef mips
1001
+ #undef mipsel
1002
+ #undef mips64
1003
+ #undef mips64el
1004
+ #if ${IS_GLIBC} && defined(_ABI64)
1005
+ LIBCABI=gnuabi64
1006
+ #else
1007
+ #if ${IS_GLIBC} && defined(_ABIN32)
1008
+ LIBCABI=gnuabin32
1009
+ #else
1010
+ LIBCABI=${LIBC}
1011
+ #endif
1012
+ #endif
1013
+
1014
+ #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1015
+ CPU=mipsisa64r6
1016
+ #else
1017
+ #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6
1018
+ CPU=mipsisa32r6
1019
+ #else
1020
+ #if defined(__mips64)
1021
+ CPU=mips64
1022
+ #else
1023
+ CPU=mips
1024
+ #endif
1025
+ #endif
1026
+ #endif
1027
+
991
1028
  #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
992
- CPU=${UNAME_MACHINE}el
1029
+ MIPS_ENDIAN=el
993
1030
  #else
994
1031
  #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
995
- CPU=${UNAME_MACHINE}
1032
+ MIPS_ENDIAN=
996
1033
  #else
997
- CPU=
1034
+ MIPS_ENDIAN=
998
1035
  #endif
999
1036
  #endif
1000
1037
  EOF
1001
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
1002
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
1038
+ eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'`"
1039
+ test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
1003
1040
  ;;
1004
1041
  mips64el:Linux:*:*)
1005
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1042
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1006
1043
  exit ;;
1007
1044
  openrisc*:Linux:*:*)
1008
- echo or1k-unknown-linux-${LIBC}
1045
+ echo or1k-unknown-linux-"$LIBC"
1009
1046
  exit ;;
1010
1047
  or32:Linux:*:* | or1k*:Linux:*:*)
1011
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1048
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1012
1049
  exit ;;
1013
1050
  padre:Linux:*:*)
1014
- echo sparc-unknown-linux-${LIBC}
1051
+ echo sparc-unknown-linux-"$LIBC"
1015
1052
  exit ;;
1016
1053
  parisc64:Linux:*:* | hppa64:Linux:*:*)
1017
- echo hppa64-unknown-linux-${LIBC}
1054
+ echo hppa64-unknown-linux-"$LIBC"
1018
1055
  exit ;;
1019
1056
  parisc:Linux:*:* | hppa:Linux:*:*)
1020
1057
  # Look for CPU level
1021
1058
  case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
1022
- PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
1023
- PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
1024
- *) echo hppa-unknown-linux-${LIBC} ;;
1059
+ PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;;
1060
+ PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;;
1061
+ *) echo hppa-unknown-linux-"$LIBC" ;;
1025
1062
  esac
1026
1063
  exit ;;
1027
1064
  ppc64:Linux:*:*)
1028
- echo powerpc64-unknown-linux-${LIBC}
1065
+ echo powerpc64-unknown-linux-"$LIBC"
1029
1066
  exit ;;
1030
1067
  ppc:Linux:*:*)
1031
- echo powerpc-unknown-linux-${LIBC}
1068
+ echo powerpc-unknown-linux-"$LIBC"
1032
1069
  exit ;;
1033
1070
  ppc64le:Linux:*:*)
1034
- echo powerpc64le-unknown-linux-${LIBC}
1071
+ echo powerpc64le-unknown-linux-"$LIBC"
1035
1072
  exit ;;
1036
1073
  ppcle:Linux:*:*)
1037
- echo powerpcle-unknown-linux-${LIBC}
1074
+ echo powerpcle-unknown-linux-"$LIBC"
1038
1075
  exit ;;
1039
1076
  riscv32:Linux:*:* | riscv64:Linux:*:*)
1040
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1077
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1041
1078
  exit ;;
1042
1079
  s390:Linux:*:* | s390x:Linux:*:*)
1043
- echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
1080
+ echo "$UNAME_MACHINE"-ibm-linux-"$LIBC"
1044
1081
  exit ;;
1045
1082
  sh64*:Linux:*:*)
1046
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1083
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1047
1084
  exit ;;
1048
1085
  sh*:Linux:*:*)
1049
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1086
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1050
1087
  exit ;;
1051
1088
  sparc:Linux:*:* | sparc64:Linux:*:*)
1052
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1089
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1053
1090
  exit ;;
1054
1091
  tile*:Linux:*:*)
1055
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1092
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1056
1093
  exit ;;
1057
1094
  vax:Linux:*:*)
1058
- echo ${UNAME_MACHINE}-dec-linux-${LIBC}
1095
+ echo "$UNAME_MACHINE"-dec-linux-"$LIBC"
1059
1096
  exit ;;
1060
1097
  x86_64:Linux:*:*)
1061
- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
1098
+ set_cc_for_build
1099
+ LIBCABI=$LIBC
1100
+ if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
1101
+ if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
1102
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1103
+ grep IS_X32 >/dev/null
1104
+ then
1105
+ LIBCABI="$LIBC"x32
1106
+ fi
1107
+ fi
1108
+ echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI"
1062
1109
  exit ;;
1063
1110
  xtensa*:Linux:*:*)
1064
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
1111
+ echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
1065
1112
  exit ;;
1066
1113
  i*86:DYNIX/ptx:4*:*)
1067
1114
  # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@@ -1075,34 +1122,34 @@ EOF
1075
1122
  # I am not positive that other SVR4 systems won't match this,
1076
1123
  # I just have to hope. -- rms.
1077
1124
  # Use sysv4.2uw... so that sysv4* matches it.
1078
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1125
+ echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION"
1079
1126
  exit ;;
1080
1127
  i*86:OS/2:*:*)
1081
1128
  # If we were able to find `uname', then EMX Unix compatibility
1082
1129
  # is probably installed.
1083
- echo ${UNAME_MACHINE}-pc-os2-emx
1130
+ echo "$UNAME_MACHINE"-pc-os2-emx
1084
1131
  exit ;;
1085
1132
  i*86:XTS-300:*:STOP)
1086
- echo ${UNAME_MACHINE}-unknown-stop
1133
+ echo "$UNAME_MACHINE"-unknown-stop
1087
1134
  exit ;;
1088
1135
  i*86:atheos:*:*)
1089
- echo ${UNAME_MACHINE}-unknown-atheos
1136
+ echo "$UNAME_MACHINE"-unknown-atheos
1090
1137
  exit ;;
1091
1138
  i*86:syllable:*:*)
1092
- echo ${UNAME_MACHINE}-pc-syllable
1139
+ echo "$UNAME_MACHINE"-pc-syllable
1093
1140
  exit ;;
1094
1141
  i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
1095
- echo i386-unknown-lynxos${UNAME_RELEASE}
1142
+ echo i386-unknown-lynxos"$UNAME_RELEASE"
1096
1143
  exit ;;
1097
1144
  i*86:*DOS:*:*)
1098
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
1145
+ echo "$UNAME_MACHINE"-pc-msdosdjgpp
1099
1146
  exit ;;
1100
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1101
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1147
+ i*86:*:4.*:*)
1148
+ UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'`
1102
1149
  if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1103
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1150
+ echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL"
1104
1151
  else
1105
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1152
+ echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL"
1106
1153
  fi
1107
1154
  exit ;;
1108
1155
  i*86:*:5:[678]*)
@@ -1112,12 +1159,12 @@ EOF
1112
1159
  *Pentium) UNAME_MACHINE=i586 ;;
1113
1160
  *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1114
1161
  esac
1115
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1162
+ echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}"
1116
1163
  exit ;;
1117
1164
  i*86:*:3.2:*)
1118
1165
  if test -f /usr/options/cb.name; then
1119
1166
  UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1120
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1167
+ echo "$UNAME_MACHINE"-pc-isc"$UNAME_REL"
1121
1168
  elif /bin/uname -X 2>/dev/null >/dev/null ; then
1122
1169
  UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1123
1170
  (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
@@ -1127,9 +1174,9 @@ EOF
1127
1174
  && UNAME_MACHINE=i686
1128
1175
  (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1129
1176
  && UNAME_MACHINE=i686
1130
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1177
+ echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL"
1131
1178
  else
1132
- echo ${UNAME_MACHINE}-pc-sysv32
1179
+ echo "$UNAME_MACHINE"-pc-sysv32
1133
1180
  fi
1134
1181
  exit ;;
1135
1182
  pc:*:*:*)
@@ -1149,9 +1196,9 @@ EOF
1149
1196
  exit ;;
1150
1197
  i860:*:4.*:*) # i860-SVR4
1151
1198
  if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1152
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1199
+ echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4
1153
1200
  else # Add other i860-SVR4 vendors below as they are discovered.
1154
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
1201
+ echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4
1155
1202
  fi
1156
1203
  exit ;;
1157
1204
  mini*:CTIX:SYS*5:*)
@@ -1171,9 +1218,9 @@ EOF
1171
1218
  test -r /etc/.relid \
1172
1219
  && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1173
1220
  /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1174
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1221
+ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1175
1222
  /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1176
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1223
+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1177
1224
  3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1178
1225
  /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1179
1226
  && { echo i486-ncr-sysv4; exit; } ;;
@@ -1182,28 +1229,28 @@ EOF
1182
1229
  test -r /etc/.relid \
1183
1230
  && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1184
1231
  /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1185
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1232
+ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; }
1186
1233
  /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1187
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
1234
+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; }
1188
1235
  /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
1189
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1236
+ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;;
1190
1237
  m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1191
- echo m68k-unknown-lynxos${UNAME_RELEASE}
1238
+ echo m68k-unknown-lynxos"$UNAME_RELEASE"
1192
1239
  exit ;;
1193
1240
  mc68030:UNIX_System_V:4.*:*)
1194
1241
  echo m68k-atari-sysv4
1195
1242
  exit ;;
1196
1243
  TSUNAMI:LynxOS:2.*:*)
1197
- echo sparc-unknown-lynxos${UNAME_RELEASE}
1244
+ echo sparc-unknown-lynxos"$UNAME_RELEASE"
1198
1245
  exit ;;
1199
1246
  rs6000:LynxOS:2.*:*)
1200
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
1247
+ echo rs6000-unknown-lynxos"$UNAME_RELEASE"
1201
1248
  exit ;;
1202
1249
  PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
1203
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
1250
+ echo powerpc-unknown-lynxos"$UNAME_RELEASE"
1204
1251
  exit ;;
1205
1252
  SM[BE]S:UNIX_SV:*:*)
1206
- echo mips-dde-sysv${UNAME_RELEASE}
1253
+ echo mips-dde-sysv"$UNAME_RELEASE"
1207
1254
  exit ;;
1208
1255
  RM*:ReliantUNIX-*:*:*)
1209
1256
  echo mips-sni-sysv4
@@ -1214,7 +1261,7 @@ EOF
1214
1261
  *:SINIX-*:*:*)
1215
1262
  if uname -p 2>/dev/null >/dev/null ; then
1216
1263
  UNAME_MACHINE=`(uname -p) 2>/dev/null`
1217
- echo ${UNAME_MACHINE}-sni-sysv4
1264
+ echo "$UNAME_MACHINE"-sni-sysv4
1218
1265
  else
1219
1266
  echo ns32k-sni-sysv
1220
1267
  fi
@@ -1234,23 +1281,23 @@ EOF
1234
1281
  exit ;;
1235
1282
  i*86:VOS:*:*)
1236
1283
  # From Paul.Green@stratus.com.
1237
- echo ${UNAME_MACHINE}-stratus-vos
1284
+ echo "$UNAME_MACHINE"-stratus-vos
1238
1285
  exit ;;
1239
1286
  *:VOS:*:*)
1240
1287
  # From Paul.Green@stratus.com.
1241
1288
  echo hppa1.1-stratus-vos
1242
1289
  exit ;;
1243
1290
  mc68*:A/UX:*:*)
1244
- echo m68k-apple-aux${UNAME_RELEASE}
1291
+ echo m68k-apple-aux"$UNAME_RELEASE"
1245
1292
  exit ;;
1246
1293
  news*:NEWS-OS:6*:*)
1247
1294
  echo mips-sony-newsos6
1248
1295
  exit ;;
1249
1296
  R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1250
1297
  if [ -d /usr/nec ]; then
1251
- echo mips-nec-sysv${UNAME_RELEASE}
1298
+ echo mips-nec-sysv"$UNAME_RELEASE"
1252
1299
  else
1253
- echo mips-unknown-sysv${UNAME_RELEASE}
1300
+ echo mips-unknown-sysv"$UNAME_RELEASE"
1254
1301
  fi
1255
1302
  exit ;;
1256
1303
  BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
@@ -1269,60 +1316,71 @@ EOF
1269
1316
  echo x86_64-unknown-haiku
1270
1317
  exit ;;
1271
1318
  SX-4:SUPER-UX:*:*)
1272
- echo sx4-nec-superux${UNAME_RELEASE}
1319
+ echo sx4-nec-superux"$UNAME_RELEASE"
1273
1320
  exit ;;
1274
1321
  SX-5:SUPER-UX:*:*)
1275
- echo sx5-nec-superux${UNAME_RELEASE}
1322
+ echo sx5-nec-superux"$UNAME_RELEASE"
1276
1323
  exit ;;
1277
1324
  SX-6:SUPER-UX:*:*)
1278
- echo sx6-nec-superux${UNAME_RELEASE}
1325
+ echo sx6-nec-superux"$UNAME_RELEASE"
1279
1326
  exit ;;
1280
1327
  SX-7:SUPER-UX:*:*)
1281
- echo sx7-nec-superux${UNAME_RELEASE}
1328
+ echo sx7-nec-superux"$UNAME_RELEASE"
1282
1329
  exit ;;
1283
1330
  SX-8:SUPER-UX:*:*)
1284
- echo sx8-nec-superux${UNAME_RELEASE}
1331
+ echo sx8-nec-superux"$UNAME_RELEASE"
1285
1332
  exit ;;
1286
1333
  SX-8R:SUPER-UX:*:*)
1287
- echo sx8r-nec-superux${UNAME_RELEASE}
1334
+ echo sx8r-nec-superux"$UNAME_RELEASE"
1288
1335
  exit ;;
1289
1336
  SX-ACE:SUPER-UX:*:*)
1290
- echo sxace-nec-superux${UNAME_RELEASE}
1337
+ echo sxace-nec-superux"$UNAME_RELEASE"
1291
1338
  exit ;;
1292
1339
  Power*:Rhapsody:*:*)
1293
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
1340
+ echo powerpc-apple-rhapsody"$UNAME_RELEASE"
1294
1341
  exit ;;
1295
1342
  *:Rhapsody:*:*)
1296
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1343
+ echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE"
1344
+ exit ;;
1345
+ arm64:Darwin:*:*)
1346
+ echo aarch64-apple-darwin"$UNAME_RELEASE"
1297
1347
  exit ;;
1298
1348
  *:Darwin:*:*)
1299
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1300
- eval $set_cc_for_build
1301
- if test "$UNAME_PROCESSOR" = unknown ; then
1302
- UNAME_PROCESSOR=powerpc
1349
+ UNAME_PROCESSOR=`uname -p`
1350
+ case $UNAME_PROCESSOR in
1351
+ unknown) UNAME_PROCESSOR=powerpc ;;
1352
+ esac
1353
+ if command -v xcode-select > /dev/null 2> /dev/null && \
1354
+ ! xcode-select --print-path > /dev/null 2> /dev/null ; then
1355
+ # Avoid executing cc if there is no toolchain installed as
1356
+ # cc will be a stub that puts up a graphical alert
1357
+ # prompting the user to install developer tools.
1358
+ CC_FOR_BUILD=no_compiler_found
1359
+ else
1360
+ set_cc_for_build
1303
1361
  fi
1304
- if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
1305
- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
1306
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1307
- (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1308
- grep IS_64BIT_ARCH >/dev/null
1309
- then
1310
- case $UNAME_PROCESSOR in
1311
- i386) UNAME_PROCESSOR=x86_64 ;;
1312
- powerpc) UNAME_PROCESSOR=powerpc64 ;;
1313
- esac
1314
- fi
1362
+ if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
1363
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
1364
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1365
+ grep IS_64BIT_ARCH >/dev/null
1366
+ then
1367
+ case $UNAME_PROCESSOR in
1368
+ i386) UNAME_PROCESSOR=x86_64 ;;
1369
+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
1370
+ esac
1371
+ fi
1372
+ # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc
1373
+ if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \
1374
+ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
1375
+ grep IS_PPC >/dev/null
1376
+ then
1377
+ UNAME_PROCESSOR=powerpc
1315
1378
  fi
1316
1379
  elif test "$UNAME_PROCESSOR" = i386 ; then
1317
- # Avoid executing cc on OS X 10.9, as it ships with a stub
1318
- # that puts up a graphical alert prompting to install
1319
- # developer tools. Any system running Mac OS X 10.7 or
1320
- # later (Darwin 11 and later) is required to have a 64-bit
1321
- # processor. This is not true of the ARM version of Darwin
1322
- # that Apple uses in portable devices.
1323
- UNAME_PROCESSOR=x86_64
1380
+ # uname -m returns i386 or x86_64
1381
+ UNAME_PROCESSOR=$UNAME_MACHINE
1324
1382
  fi
1325
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1383
+ echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE"
1326
1384
  exit ;;
1327
1385
  *:procnto*:*:* | *:QNX:[0123456789]*:*)
1328
1386
  UNAME_PROCESSOR=`uname -p`
@@ -1330,22 +1388,25 @@ EOF
1330
1388
  UNAME_PROCESSOR=i386
1331
1389
  UNAME_MACHINE=pc
1332
1390
  fi
1333
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1391
+ echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE"
1334
1392
  exit ;;
1335
1393
  *:QNX:*:4*)
1336
1394
  echo i386-pc-qnx
1337
1395
  exit ;;
1338
1396
  NEO-*:NONSTOP_KERNEL:*:*)
1339
- echo neo-tandem-nsk${UNAME_RELEASE}
1397
+ echo neo-tandem-nsk"$UNAME_RELEASE"
1340
1398
  exit ;;
1341
1399
  NSE-*:NONSTOP_KERNEL:*:*)
1342
- echo nse-tandem-nsk${UNAME_RELEASE}
1400
+ echo nse-tandem-nsk"$UNAME_RELEASE"
1343
1401
  exit ;;
1344
1402
  NSR-*:NONSTOP_KERNEL:*:*)
1345
- echo nsr-tandem-nsk${UNAME_RELEASE}
1403
+ echo nsr-tandem-nsk"$UNAME_RELEASE"
1404
+ exit ;;
1405
+ NSV-*:NONSTOP_KERNEL:*:*)
1406
+ echo nsv-tandem-nsk"$UNAME_RELEASE"
1346
1407
  exit ;;
1347
1408
  NSX-*:NONSTOP_KERNEL:*:*)
1348
- echo nsx-tandem-nsk${UNAME_RELEASE}
1409
+ echo nsx-tandem-nsk"$UNAME_RELEASE"
1349
1410
  exit ;;
1350
1411
  *:NonStop-UX:*:*)
1351
1412
  echo mips-compaq-nonstopux
@@ -1354,18 +1415,19 @@ EOF
1354
1415
  echo bs2000-siemens-sysv
1355
1416
  exit ;;
1356
1417
  DS/*:UNIX_System_V:*:*)
1357
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1418
+ echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE"
1358
1419
  exit ;;
1359
1420
  *:Plan9:*:*)
1360
1421
  # "uname -m" is not consistent, so use $cputype instead. 386
1361
1422
  # is converted to i386 for consistency with other x86
1362
1423
  # operating systems.
1424
+ # shellcheck disable=SC2154
1363
1425
  if test "$cputype" = 386; then
1364
1426
  UNAME_MACHINE=i386
1365
1427
  else
1366
1428
  UNAME_MACHINE="$cputype"
1367
1429
  fi
1368
- echo ${UNAME_MACHINE}-unknown-plan9
1430
+ echo "$UNAME_MACHINE"-unknown-plan9
1369
1431
  exit ;;
1370
1432
  *:TOPS-10:*:*)
1371
1433
  echo pdp10-unknown-tops10
@@ -1386,14 +1448,14 @@ EOF
1386
1448
  echo pdp10-unknown-its
1387
1449
  exit ;;
1388
1450
  SEI:*:*:SEIUX)
1389
- echo mips-sei-seiux${UNAME_RELEASE}
1451
+ echo mips-sei-seiux"$UNAME_RELEASE"
1390
1452
  exit ;;
1391
1453
  *:DragonFly:*:*)
1392
- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1454
+ echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`"
1393
1455
  exit ;;
1394
1456
  *:*VMS:*:*)
1395
1457
  UNAME_MACHINE=`(uname -p) 2>/dev/null`
1396
- case "${UNAME_MACHINE}" in
1458
+ case "$UNAME_MACHINE" in
1397
1459
  A*) echo alpha-dec-vms ; exit ;;
1398
1460
  I*) echo ia64-dec-vms ; exit ;;
1399
1461
  V*) echo vax-dec-vms ; exit ;;
@@ -1402,32 +1464,190 @@ EOF
1402
1464
  echo i386-pc-xenix
1403
1465
  exit ;;
1404
1466
  i*86:skyos:*:*)
1405
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'`
1467
+ echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`"
1406
1468
  exit ;;
1407
1469
  i*86:rdos:*:*)
1408
- echo ${UNAME_MACHINE}-pc-rdos
1470
+ echo "$UNAME_MACHINE"-pc-rdos
1409
1471
  exit ;;
1410
1472
  i*86:AROS:*:*)
1411
- echo ${UNAME_MACHINE}-pc-aros
1473
+ echo "$UNAME_MACHINE"-pc-aros
1412
1474
  exit ;;
1413
1475
  x86_64:VMkernel:*:*)
1414
- echo ${UNAME_MACHINE}-unknown-esx
1476
+ echo "$UNAME_MACHINE"-unknown-esx
1415
1477
  exit ;;
1416
1478
  amd64:Isilon\ OneFS:*:*)
1417
1479
  echo x86_64-unknown-onefs
1418
1480
  exit ;;
1481
+ *:Unleashed:*:*)
1482
+ echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
1483
+ exit ;;
1484
+ esac
1485
+
1486
+ # No uname command or uname output not recognized.
1487
+ set_cc_for_build
1488
+ cat > "$dummy.c" <<EOF
1489
+ #ifdef _SEQUENT_
1490
+ #include <sys/types.h>
1491
+ #include <sys/utsname.h>
1492
+ #endif
1493
+ #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1494
+ #if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1495
+ #include <signal.h>
1496
+ #if defined(_SIZE_T_) || defined(SIGLOST)
1497
+ #include <sys/utsname.h>
1498
+ #endif
1499
+ #endif
1500
+ #endif
1501
+ main ()
1502
+ {
1503
+ #if defined (sony)
1504
+ #if defined (MIPSEB)
1505
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
1506
+ I don't know.... */
1507
+ printf ("mips-sony-bsd\n"); exit (0);
1508
+ #else
1509
+ #include <sys/param.h>
1510
+ printf ("m68k-sony-newsos%s\n",
1511
+ #ifdef NEWSOS4
1512
+ "4"
1513
+ #else
1514
+ ""
1515
+ #endif
1516
+ ); exit (0);
1517
+ #endif
1518
+ #endif
1519
+
1520
+ #if defined (NeXT)
1521
+ #if !defined (__ARCHITECTURE__)
1522
+ #define __ARCHITECTURE__ "m68k"
1523
+ #endif
1524
+ int version;
1525
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1526
+ if (version < 4)
1527
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1528
+ else
1529
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1530
+ exit (0);
1531
+ #endif
1532
+
1533
+ #if defined (MULTIMAX) || defined (n16)
1534
+ #if defined (UMAXV)
1535
+ printf ("ns32k-encore-sysv\n"); exit (0);
1536
+ #else
1537
+ #if defined (CMU)
1538
+ printf ("ns32k-encore-mach\n"); exit (0);
1539
+ #else
1540
+ printf ("ns32k-encore-bsd\n"); exit (0);
1541
+ #endif
1542
+ #endif
1543
+ #endif
1544
+
1545
+ #if defined (__386BSD__)
1546
+ printf ("i386-pc-bsd\n"); exit (0);
1547
+ #endif
1548
+
1549
+ #if defined (sequent)
1550
+ #if defined (i386)
1551
+ printf ("i386-sequent-dynix\n"); exit (0);
1552
+ #endif
1553
+ #if defined (ns32000)
1554
+ printf ("ns32k-sequent-dynix\n"); exit (0);
1555
+ #endif
1556
+ #endif
1557
+
1558
+ #if defined (_SEQUENT_)
1559
+ struct utsname un;
1560
+
1561
+ uname(&un);
1562
+ if (strncmp(un.version, "V2", 2) == 0) {
1563
+ printf ("i386-sequent-ptx2\n"); exit (0);
1564
+ }
1565
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1566
+ printf ("i386-sequent-ptx1\n"); exit (0);
1567
+ }
1568
+ printf ("i386-sequent-ptx\n"); exit (0);
1569
+ #endif
1570
+
1571
+ #if defined (vax)
1572
+ #if !defined (ultrix)
1573
+ #include <sys/param.h>
1574
+ #if defined (BSD)
1575
+ #if BSD == 43
1576
+ printf ("vax-dec-bsd4.3\n"); exit (0);
1577
+ #else
1578
+ #if BSD == 199006
1579
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
1580
+ #else
1581
+ printf ("vax-dec-bsd\n"); exit (0);
1582
+ #endif
1583
+ #endif
1584
+ #else
1585
+ printf ("vax-dec-bsd\n"); exit (0);
1586
+ #endif
1587
+ #else
1588
+ #if defined(_SIZE_T_) || defined(SIGLOST)
1589
+ struct utsname un;
1590
+ uname (&un);
1591
+ printf ("vax-dec-ultrix%s\n", un.release); exit (0);
1592
+ #else
1593
+ printf ("vax-dec-ultrix\n"); exit (0);
1594
+ #endif
1595
+ #endif
1596
+ #endif
1597
+ #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__)
1598
+ #if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__)
1599
+ #if defined(_SIZE_T_) || defined(SIGLOST)
1600
+ struct utsname *un;
1601
+ uname (&un);
1602
+ printf ("mips-dec-ultrix%s\n", un.release); exit (0);
1603
+ #else
1604
+ printf ("mips-dec-ultrix\n"); exit (0);
1605
+ #endif
1606
+ #endif
1607
+ #endif
1608
+
1609
+ #if defined (alliant) && defined (i860)
1610
+ printf ("i860-alliant-bsd\n"); exit (0);
1611
+ #endif
1612
+
1613
+ exit (1);
1614
+ }
1615
+ EOF
1616
+
1617
+ $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1618
+ { echo "$SYSTEM_NAME"; exit; }
1619
+
1620
+ # Apollos put the system type in the environment.
1621
+ test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
1622
+
1623
+ echo "$0: unable to guess system type" >&2
1624
+
1625
+ case "$UNAME_MACHINE:$UNAME_SYSTEM" in
1626
+ mips:Linux | mips64:Linux)
1627
+ # If we got here on MIPS GNU/Linux, output extra information.
1628
+ cat >&2 <<EOF
1629
+
1630
+ NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize
1631
+ the system type. Please install a C compiler and try again.
1632
+ EOF
1633
+ ;;
1419
1634
  esac
1420
1635
 
1421
1636
  cat >&2 <<EOF
1422
- $0: unable to guess system type
1423
1637
 
1424
1638
  This script (version $timestamp), has failed to recognize the
1425
- operating system you are using. If your script is old, overwrite
1426
- config.guess and config.sub with the latest versions from:
1639
+ operating system you are using. If your script is old, overwrite *all*
1640
+ copies of config.guess and config.sub with the latest versions from:
1427
1641
 
1428
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
1642
+ https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess
1429
1643
  and
1430
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
1644
+ https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub
1645
+ EOF
1646
+
1647
+ year=`echo $timestamp | sed 's,-.*,,'`
1648
+ # shellcheck disable=SC2003
1649
+ if test "`expr "\`date +%Y\`" - "$year"`" -lt 3 ; then
1650
+ cat >&2 <<EOF
1431
1651
 
1432
1652
  If $0 has already been updated, send the following data and any
1433
1653
  information you think might be pertinent to config-patches@gnu.org to
@@ -1450,16 +1670,17 @@ hostinfo = `(hostinfo) 2>/dev/null`
1450
1670
  /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
1451
1671
  /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1452
1672
 
1453
- UNAME_MACHINE = ${UNAME_MACHINE}
1454
- UNAME_RELEASE = ${UNAME_RELEASE}
1455
- UNAME_SYSTEM = ${UNAME_SYSTEM}
1456
- UNAME_VERSION = ${UNAME_VERSION}
1673
+ UNAME_MACHINE = "$UNAME_MACHINE"
1674
+ UNAME_RELEASE = "$UNAME_RELEASE"
1675
+ UNAME_SYSTEM = "$UNAME_SYSTEM"
1676
+ UNAME_VERSION = "$UNAME_VERSION"
1457
1677
  EOF
1678
+ fi
1458
1679
 
1459
1680
  exit 1
1460
1681
 
1461
1682
  # Local variables:
1462
- # eval: (add-hook 'write-file-hooks 'time-stamp)
1683
+ # eval: (add-hook 'before-save-hook 'time-stamp)
1463
1684
  # time-stamp-start: "timestamp='"
1464
1685
  # time-stamp-format: "%:y-%02m-%02d"
1465
1686
  # time-stamp-end: "'"