Merge lp:~davbo/ubuntu/trusty/jq/merge-debian-changes into lp:ubuntu/trusty/jq

Proposed by David King on 2017-04-13
Status: Rejected
Rejected by: Tyler Hicks on 2017-08-04
Proposed branch: lp:~davbo/ubuntu/trusty/jq/merge-debian-changes
Merge into: lp:ubuntu/trusty/jq
Diff against target: 56338 lines (+50308/-2769)
100 files modified
.pc/applied-patches (+0/-4)
.pc/disable-valgrind-tests.patch/configure.ac (+0/-65)
.pc/disable-valgrind-tests.patch/tests/run (+0/-3)
.pc/enable-full-manpages.patch/Makefile.am (+0/-123)
.pc/init-automake-once.patch/configure.ac (+0/-66)
.pc/remove-unecessary-rakefile-deps.patch/docs/Rakefile (+0/-146)
AUTHORS (+1/-0)
Makefile.am (+57/-25)
README (+35/-0)
README.md (+21/-9)
builtin.c (+207/-36)
builtin.h (+3/-14)
bytecode.c (+49/-17)
bytecode.h (+44/-4)
compile.c (+39/-45)
compile.h (+5/-8)
config.h.in (+0/-32)
config/ar-lib (+270/-0)
config/compile (+7/-3)
config/config.guess (+1558/-0)
config/config.sub (+1791/-0)
config/depcomp (+269/-186)
config/install-sh (+7/-7)
config/ltmain.sh (+9661/-0)
config/m4/find-func-no-libs.m4 (+8/-0)
config/m4/find-func-no-libs2.m4 (+62/-0)
config/m4/find-func.m4 (+9/-0)
config/m4/libtool.m4 (+7997/-0)
config/m4/ltoptions.m4 (+384/-0)
config/m4/ltsugar.m4 (+123/-0)
config/m4/ltversion.m4 (+23/-0)
config/m4/lt~obsolete.m4 (+98/-0)
config/m4/misc.m4 (+3/-0)
config/missing (+159/-275)
config/test-driver (+139/-0)
config/ylwrap (+115/-94)
configure (+15847/-0)
configure.ac (+65/-10)
debian/changelog (+7/-0)
debian/patches/big-endian-fix.patch (+42/-0)
debian/patches/disable-shared-lib.patch (+41/-0)
debian/patches/disable-valgrind-tests.patch (+7/-10)
debian/patches/enable-full-manpages.patch (+0/-46)
debian/patches/enable-manpages.patch (+18/-0)
debian/patches/heap-buffer-overflow.patch (+32/-0)
debian/patches/init-automake-once.patch (+0/-26)
debian/patches/patch-version-into-build.patch (+17/-0)
debian/patches/series (+6/-2)
debian/patches/stack-exhaustion.patch (+62/-0)
docs/Rakefile (+7/-2)
docs/content/1.tutorial/default.yml (+271/-190)
docs/content/2.download/default.yml (+1/-1)
docs/content/3.manual/manual.yml (+451/-49)
docs/content/index/index.yml (+6/-1)
docs/public/css/base.css (+77/-0)
docs/site.yml (+1/-1)
exec_stack.h (+82/-0)
execute.c (+359/-176)
execute.h (+0/-20)
forkable_stack.h (+0/-172)
frame_layout.h (+0/-104)
gen_utf8_tables.py (+0/-32)
jq.1 (+1937/-0)
jq.h (+23/-0)
jq.spec (+7/-2)
jq_parser.h (+2/-0)
jq_test.c (+38/-17)
jv.c (+544/-290)
jv.h (+57/-32)
jv_alloc.c (+118/-4)
jv_alloc.h (+2/-0)
jv_aux.c (+55/-27)
jv_aux.h (+0/-20)
jv_dtoa.c (+1/-1)
jv_dtoa.h (+1/-1)
jv_file.c (+46/-0)
jv_parse.c (+45/-5)
jv_parse.h (+0/-37)
jv_print.c (+44/-5)
jv_unicode.c (+43/-18)
jv_unicode.h (+1/-1)
jv_utf8_tables.h (+2/-0)
lexer.c (+2347/-0)
lexer.h (+362/-0)
lexer.l (+5/-1)
libm.h (+34/-0)
locfile.c (+103/-0)
locfile.h (+10/-62)
main.c (+91/-58)
opcode.c (+0/-31)
opcode.h (+0/-41)
opcode_list.h (+2/-0)
parser.c (+3235/-0)
parser.h (+174/-0)
parser.y (+181/-46)
scripts/crosscompile (+0/-31)
scripts/version (+5/-0)
setup.sh (+0/-32)
tests/all.test (+242/-1)
tests/run (+8/-2)
To merge this branch: bzr merge lp:~davbo/ubuntu/trusty/jq/merge-debian-changes
Reviewer Review Type Date Requested Status
Tyler Hicks Disapprove on 2017-08-04
Seth Arnold (community) Needs Fixing on 2017-05-02
Ubuntu Security Sponsors Team packaging security 2017-04-13 Pending
Review via email: mp+322510@code.launchpad.net

Description of the change

Merged the updated 1.4 jq package from Debian jessie and applied their patches which resolve the following CVEs:
 - CVE-2015-8863
 - CVE-2016-4074

Tested locally with the caveat that my machine is running 16.04 Xenial.

To post a comment you must log in.
9. By David King on 2017-04-13

Remove generated autotools files

Seth Arnold (seth-arnold) wrote :

Hello David,

Thanks for trying to address outstanding security issues in Ubuntu. However, this isn't really the best approach to take for these issues:

- Sadly this 'merge proposal' mechanism still exists even though it's entirely unused these days. Please prefer the method documented in https://wiki.ubuntu.com/SecurityTeam/UpdatePreparation#Packaging for security fixes.
- These changes are quite drastic for two security fixes; it's almost always better to find the smallest possible patches that address an issue rather than taking in wholesale new versions, because wholesale new versions are more likely to introduce bugs. Small security-only patches are also usually easier to review.

Thanks

review: Needs Fixing
Tyler Hicks (tyhicks) wrote :

Hello - I'm going to mark this merge as 'rejected' since there has been no progress since Seth's comment 3 months ago. We'd love for you to follow the instructions he provided and then we'd sponsor the resulting debdiff. Details are available here:

  https://wiki.ubuntu.com/SecurityTeam/SponsorsQueue#Notes_for_Contributors

review: Disapprove

Unmerged revisions

9. By David King on 2017-04-13

Remove generated autotools files

8. By David King on 2017-04-13

Update changelog

7. By David King on 2017-04-12

Pulled latest patch files from Debian jessie

6. By David King on 2017-04-12

New upstream release.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file '.pc/applied-patches'
2--- .pc/applied-patches 2013-10-02 21:25:22 +0000
3+++ .pc/applied-patches 1970-01-01 00:00:00 +0000
4@@ -1,4 +0,0 @@
5-init-automake-once.patch
6-remove-unecessary-rakefile-deps.patch
7-enable-full-manpages.patch
8-disable-valgrind-tests.patch
9
10=== removed directory '.pc/disable-valgrind-tests.patch'
11=== removed file '.pc/disable-valgrind-tests.patch/configure.ac'
12--- .pc/disable-valgrind-tests.patch/configure.ac 2013-10-02 21:25:22 +0000
13+++ .pc/disable-valgrind-tests.patch/configure.ac 1970-01-01 00:00:00 +0000
14@@ -1,65 +0,0 @@
15-AC_INIT([jq], [1.3], [mu@netsoc.tcd.ie],
16- [jq], [http://stedolan.github.com/jq/])
17-
18-dnl Created autoconf implementation thompson@dtosolutions, 26NOV12
19-AC_PREREQ([2.61])
20-AC_CONFIG_AUX_DIR([config])
21-AM_INIT_AUTOMAKE([parallel-tests foreign -Wall])
22-AM_SILENT_RULES([yes])
23-AC_PROG_CC
24-AC_PROG_CC_STDC
25-AC_PROG_CPP_WERROR
26-AC_PROG_YACC
27-
28-AM_PROG_CC_C_O
29-
30-dnl couldn't use AM_PROG_LEX as it doesn't support header files like the
31-dnl AC_PROG_YACC macros...
32-
33-dnl
34-dnl these program checks should probably be deleted
35-dnl
36-
37-AC_PROG_LEX
38-if test "x$LEX" != xflex; then
39- LEX="$SHELL $missing_dir/missing flex"
40-fi
41-
42-
43-dnl Check for valgrind
44-AC_CHECK_PROGS(valgrind_cmd, valgrind)
45-if test "x$valgrind_cmd" = "x" ; then
46- AC_MSG_WARN([valgrind is required to test jq.])
47-fi
48-
49-
50-dnl Don't attempt to build docs if there's no Ruby lying around
51-AC_ARG_ENABLE([docs],
52- AC_HELP_STRING([--disable-docs], [don't build docs]))
53-
54-AS_IF([test "x$enable_docs" != "xno"],[
55- AC_CHECK_PROGS(bundle_cmd, bundle)
56- AS_IF([test "x$bundle_cmd" = "x" || \
57- ! ( cd ${srcdir}/docs; "$bundle_cmd" check 2>/dev/null )],[
58- AC_MSG_WARN([no bundler])
59- cat <<EOF
60-*****************************************************************
61-* Ruby dependencies for building jq documentation not found. *
62-* You can still build, install and hack on jq, but the manpage *
63-* will not be rebuilt and some of the tests won't run. *
64-* See docs/README.md for how to install the docs dependencies. *
65-*****************************************************************
66-EOF
67- enable_docs=no
68- ])
69-])
70-
71-AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" != xno])
72-AC_SUBST([BUNDLER], ["$bundle_cmd"])
73-
74-dnl AC_CONFIG_MACRO_DIR([m4])
75-AC_CONFIG_HEADERS(config.h)
76-AC_CONFIG_FILES([Makefile])
77-AC_OUTPUT
78-
79-
80
81=== removed directory '.pc/disable-valgrind-tests.patch/tests'
82=== removed file '.pc/disable-valgrind-tests.patch/tests/run'
83--- .pc/disable-valgrind-tests.patch/tests/run 2013-10-02 21:25:22 +0000
84+++ .pc/disable-valgrind-tests.patch/tests/run 1970-01-01 00:00:00 +0000
85@@ -1,3 +0,0 @@
86-#!/bin/sh
87-
88-cat $@ | valgrind --error-exitcode=1 -q --leak-check=full ./jq --run-tests
89\ No newline at end of file
90
91=== removed directory '.pc/enable-full-manpages.patch'
92=== removed file '.pc/enable-full-manpages.patch/Makefile.am'
93--- .pc/enable-full-manpages.patch/Makefile.am 2013-10-02 21:25:22 +0000
94+++ .pc/enable-full-manpages.patch/Makefile.am 1970-01-01 00:00:00 +0000
95@@ -1,123 +0,0 @@
96-### C source files to be built and distributed.
97-
98-JQ_INCS = jq_parser.h builtin.h bytecode.h compile.h execute.h \
99- forkable_stack.h frame_layout.h jv.h jv_alloc.h jv_aux.h jv_dtoa.h \
100- jv_parse.h jv_unicode.h locfile.h opcode.h opcode_list.h parser.y \
101- jv_utf8_tables.h lexer.l
102-
103-JQ_SRC = opcode.c bytecode.c compile.c execute.c builtin.c jv.c \
104- jv_parse.c jv_print.c jv_dtoa.c jv_unicode.c jv_aux.c jv_alloc.c \
105- jq_test.c ${JQ_INCS}
106-
107-
108-### C build options
109-
110-AM_CFLAGS = -Wextra -Wall -Wno-missing-field-initializers \
111- -Wno-unused-parameter -Wno-unused-function
112-
113-
114-### Generating the lexer and parser
115-
116-# While there is some autoconf macro support for lex/flex, it doesn't support
117-# header file creation so we'll use good old make
118-BUILT_SOURCES = lexer.h lexer.c parser.h parser.c
119-lexer.c: lexer.l
120- flex -o lexer.c --header-file=lexer.h $<
121-lexer.h: lexer.c
122-
123-# Tell YACC (bison) autoconf macros that you want a header file created.
124-# If the --warnings=all fails, you probably have an old version of bison
125-# OSX ships an old bison, so update with homebrew or macports
126-AM_YFLAGS = --warnings=all -d
127-
128-
129-### Building the jq binary
130-
131-main.c: config.h
132-
133-bin_PROGRAMS = jq
134-jq_SOURCES = ${JQ_SRC} main.c
135-
136-
137-### Tests (make check)
138-
139-TESTS = tests/all.test
140-TEST_LOG_COMPILER = ${srcdir}/tests/run
141-
142-
143-### Building the manpage
144-
145-# If ENABLE_DOCS is not set, just copy jq.1.default to jq.1
146-# The real_docs target succeeds (possibly after building jq.1) only if ENABLE_DOCS is set
147-# Thus, making "dist" depend on "real_docs" ensures that we never build a tarball with
148-# a stub manpage.
149-
150-man_MANS = jq.1
151-.PHONY: real_docs
152-if ENABLE_DOCS
153-jq.1: $(srcdir)/docs/content/3.manual/manual.yml
154- ( cd ${abs_srcdir}/docs; '$(BUNDLER)' exec rake manpage ) > $@ || { rm -f $@; false; }
155-jq.1.default: $(srcdir)/docs/default_manpage.md
156- ( cd ${abs_srcdir}/docs; '$(BUNDLER)' exec rake manpage_default ) > $@ || { rm -f $@; false; }
157-real_docs: jq.1
158- if cmp jq.1 $(srcdir)/jq.1.default > /dev/null; then\
159- rm -f jq.1; $(MAKE) $(AM_MAKEFLAGS) jq.1;\
160- fi
161-else
162-jq.1: $(srcdir)/jq.1.default
163- cp $^ $@
164-real_docs:
165- @echo "Ruby dependencies not found, cannot build manpage." > /dev/stderr
166- @echo "Follow the instructions in docs/README.md to install them" > /dev/stderr
167- @echo "and then rerun ./configure" > /dev/stderr
168- false
169-endif
170-
171-
172-### Packaging
173-
174-docs/site.yml: configure.ac
175- sed 's/^jq_version: .*/jq_version: "$(VERSION)"/' $@ > $@.new
176- mv $@.new $@
177-
178-install-binaries: $(BUILT_SOURCES)
179- $(MAKE) $(AM_MAKEFLAGS) install-exec
180-
181-# Ensure "make dist" fails when we can't build the real manpage
182-dist-hook: real_docs
183-
184-DOC_FILES = docs/content docs/public docs/templates docs/site.yml \
185- docs/Gemfile docs/Gemfile.lock docs/Rakefile docs/README.md \
186- docs/default_manpage.md jq.1.default
187-
188-# setup is only used by distribution developers, not package developers.
189-# Still, as a matter of allowing patching, its not a bad idea to distribute
190-# the developer setup script in the tarball.
191-EXTRA_DIST = config.h.in $(BUILT_SOURCES) $(man_MANS) $(TESTS) \
192- $(TEST_LOG_COMPILER) gen_utf8_tables.py jq.spec \
193- $(DOC_FILES)
194-
195-# README.md is expected in Github projects, good stuff in it, so we'll
196-# distribute it and install it with the package in the doc directory.
197-docdir = ${datadir}/doc/${PACKAGE}
198-dist_doc_DATA = README.md COPYING AUTHORS README
199-
200-releasetag:
201- git tag -s "jq-$$(cat VERSION)" -m "jq release $$(cat VERSION)"
202-
203-RELEASE ?= 1
204-rpm: jq
205- @echo "Packaging jq as an RPM ..."
206- mkdir -p rpm/SOURCES rpm/BUILD rpm/BUILDROOT rpm/RPMS rpm/SPECS
207- cp jq-$$(cat VERSION).tar.gz rpm/SOURCES/
208- rpmbuild -tb --define "_topdir ${PWD}/rpm" --define "_prefix /usr" --define "myver $$(cat VERSION)" --define "myrel ${RELEASE}" rpm/SOURCES/jq-$$(cat VERSION).tar.gz
209- find rpm/RPMS/ -name "*.rpm" -exec mv {} ./ \;
210- rm -rf rpm
211-
212-dist-clean-local:
213- rm -f ${BUILT_SOURCES}
214-
215-# Not sure why this doesn't get cleaned up automatically, guess
216-# automake used to man pages which are hand coded?
217-clean-local:
218- rm -f jq.1
219
220=== removed directory '.pc/init-automake-once.patch'
221=== removed file '.pc/init-automake-once.patch/configure.ac'
222--- .pc/init-automake-once.patch/configure.ac 2013-10-02 21:25:22 +0000
223+++ .pc/init-automake-once.patch/configure.ac 1970-01-01 00:00:00 +0000
224@@ -1,66 +0,0 @@
225-AC_INIT([jq], [1.3], [mu@netsoc.tcd.ie],
226- [jq], [http://stedolan.github.com/jq/])
227-
228-dnl Created autoconf implementation thompson@dtosolutions, 26NOV12
229-AC_PREREQ([2.61])
230-AC_CONFIG_AUX_DIR([config])
231-AM_INIT_AUTOMAKE([parallel-tests foreign])
232-AM_SILENT_RULES([yes])
233-AC_PROG_CC
234-AC_PROG_CC_STDC
235-AC_PROG_CPP_WERROR
236-AC_PROG_YACC
237-
238-AM_PROG_CC_C_O
239-
240-dnl couldn't use AM_PROG_LEX as it doesn't support header files like the
241-dnl AC_PROG_YACC macros...
242-
243-dnl
244-dnl these program checks should probably be deleted
245-dnl
246-
247-AC_PROG_LEX
248-if test "x$LEX" != xflex; then
249- LEX="$SHELL $missing_dir/missing flex"
250-fi
251-
252-
253-dnl Check for valgrind
254-AC_CHECK_PROGS(valgrind_cmd, valgrind)
255-if test "x$valgrind_cmd" = "x" ; then
256- AC_MSG_WARN([valgrind is required to test jq.])
257-fi
258-
259-
260-dnl Don't attempt to build docs if there's no Ruby lying around
261-AC_ARG_ENABLE([docs],
262- AC_HELP_STRING([--disable-docs], [don't build docs]))
263-
264-AS_IF([test "x$enable_docs" != "xno"],[
265- AC_CHECK_PROGS(bundle_cmd, bundle)
266- AS_IF([test "x$bundle_cmd" = "x" || \
267- ! ( cd ${srcdir}/docs; "$bundle_cmd" check 2>/dev/null )],[
268- AC_MSG_WARN([no bundler])
269- cat <<EOF
270-*****************************************************************
271-* Ruby dependencies for building jq documentation not found. *
272-* You can still build, install and hack on jq, but the manpage *
273-* will not be rebuilt and some of the tests won't run. *
274-* See docs/README.md for how to install the docs dependencies. *
275-*****************************************************************
276-EOF
277- enable_docs=no
278- ])
279-])
280-
281-AM_CONDITIONAL([ENABLE_DOCS], [test "x$enable_docs" != xno])
282-AC_SUBST([BUNDLER], ["$bundle_cmd"])
283-
284-dnl AC_CONFIG_MACRO_DIR([m4])
285-AC_CONFIG_HEADERS(config.h)
286-AM_INIT_AUTOMAKE([-Wall])
287-AC_CONFIG_FILES([Makefile])
288-AC_OUTPUT
289-
290-
291
292=== removed directory '.pc/remove-unecessary-rakefile-deps.patch'
293=== removed directory '.pc/remove-unecessary-rakefile-deps.patch/docs'
294=== removed file '.pc/remove-unecessary-rakefile-deps.patch/docs/Rakefile'
295--- .pc/remove-unecessary-rakefile-deps.patch/docs/Rakefile 2013-10-02 21:25:22 +0000
296+++ .pc/remove-unecessary-rakefile-deps.patch/docs/Rakefile 1970-01-01 00:00:00 +0000
297@@ -1,146 +0,0 @@
298-require 'yaml'
299-require 'bonsai'
300-require 'liquid'
301-require 'maruku'
302-require 'json'
303-require 'ronn'
304-require 'tempfile'
305-require 'yaml'
306-
307-module ExtraFilters
308- def markdownify(input)
309- Maruku.new(input).to_html
310- end
311-
312- def sanitize(input)
313- input.gsub(/[^a-zA-Z0-9_]/,"")
314- end
315-
316- def json(input)
317- input.to_json
318- end
319-
320- def unique(input)
321- @n = (@n || 0) + 1
322- input + @n.to_s
323- end
324-end
325-
326-Liquid::Template.register_filter(ExtraFilters)
327-
328-
329-task :serve do
330- begin
331- Bonsai.log "Press Control+C to quit"
332-
333- require 'rack'
334- require 'sinatra'
335- require 'watch'
336- require 'launchy'
337-
338- Bonsai.root_dir = Dir.pwd
339-
340- server = fork {
341- app = Rack::Builder.app {
342- map "/jq" do
343- use Bonsai::StaticPassThrough, :root => Bonsai.root_dir + "/output", :urls => ["/"]
344- end
345- run Bonsai::DevelopmentServer
346- }
347- Rack::Handler.default.run(app, :Port => 5000) do
348- Launchy.open("http://localhost:5000/jq/")
349- end
350- }
351- Watch.new("{content,templates,public}/**/*") { Bonsai::Exporter.process! }
352- rescue Interrupt
353- Process.kill("QUIT", server)
354- Process.wait(server)
355- exit
356- end
357-end
358-
359-task :build do
360- Bonsai.root_dir = Dir.pwd
361- Bonsai::Exporter.publish!
362-end
363-
364-$BINARIES = {
365- :osx32 => "--host=i686-apple-darwin10 CFLAGS='-m32 -g -O'",
366- :osx64 => "--host=i686-apple-darwin10 CFLAGS='-m64 -g -O'",
367- :win32 => "--host=i686-w64-mingw32 CFLAGS='-g -O'",
368- :win64 => "--host=x86_64-w64-mingw32 CFLAGS='-g -O'",
369- :linux32 => "--host=x86_64-linux-gnu CFLAGS='-m32 -g -O'",
370- :linux64 => "--host=x86_64-linux-gnu CFLAGS='-m64 -g -O'"
371-}
372-
373-$BINARIES.each do |name, args|
374- file "../build/#{name}" do |t|
375- sh "MAKEFLAGS=-j4 ../scripts/crosscompile #{name} #{args}"
376- end
377- task :binaries => ["../build/#{name}"]
378-end
379-
380-task :binaries => ["output/download"] do
381- $BINARIES.each do |name, args|
382- FileUtils.cp_r "../build/#{name}", "output/download/"
383- end
384-end
385-
386-def load_manual
387- YAML::ENGINE.yamler = 'syck'
388- YAML::load(File.open("content/3.manual/manual.yml"))
389-end
390-
391-task :manpage do
392- Tempfile.open "manpage" do |f|
393- manual = load_manual
394- f.puts manual['manpage_intro']
395- f.puts manual['body']
396- manual['sections'].each do |section|
397-
398- f.puts "## #{section['title'].upcase}\n"
399- f.puts section['body']
400- f.puts ""
401- (section['entries'] || []).each do |entry|
402- f.puts "### #{entry['title']}\n"
403- f.puts entry['body']
404- f.puts ""
405- (entry['examples'] || []).each do |example|
406- f.puts " jq '#{example['program']}'"
407- f.puts " #{example['input']}"
408- f.puts " => #{example['output'].join(", ")}"
409- f.puts
410- end
411- end
412- f.puts ""
413- end
414- f.puts manual['manpage_epilogue']
415- f.close
416- puts Ronn::Document.new(f.path).convert('roff').gsub(/<\/?code>/,"")
417- end
418-end
419-
420-task :manpage_default => ["default_manpage.md"] do
421- puts Ronn::Document.new("default_manpage.md").convert('roff').gsub(/<\/?code>/,"")
422-end
423-
424-task :mantests do
425- load_manual['sections'].each do |section|
426- (section['entries'] || []).each do |entry|
427- (entry['examples'] || []).each do |example|
428- puts example['program'].gsub("\n", " ")
429- puts example['input']
430- example['output'].each do |s| puts s end
431- puts
432- end
433- end
434- end
435-end
436-
437-directory "output/download/source"
438-task :tarball => ["output/download/source"] do
439- sh "cd ..; ./configure && make dist && make distclean"
440- sh "cp ../jq-*.tar.gz output/download/source"
441-end
442-
443-task :dist => [:build, :binaries, :tarball]
444
445=== modified file 'AUTHORS'
446--- AUTHORS 2013-10-02 21:25:22 +0000
447+++ AUTHORS 2017-04-13 17:33:55 +0000
448@@ -4,3 +4,4 @@
449 Contributions by
450 Anthony Shortland <anthony.shortland@me.com> - rpmbuild target
451 Lee Thompson <stagr.lee@gmail.com> - autoconf stuff
452+Nicolas Williams <nico@cryptonector.com> - library-fication, autoconf stuff, misc
453
454=== modified file 'Makefile.am'
455--- Makefile.am 2013-10-02 21:25:22 +0000
456+++ Makefile.am 2017-04-13 17:33:55 +0000
457@@ -1,13 +1,12 @@
458 ### C source files to be built and distributed.
459
460-JQ_INCS = jq_parser.h builtin.h bytecode.h compile.h execute.h \
461- forkable_stack.h frame_layout.h jv.h jv_alloc.h jv_aux.h jv_dtoa.h \
462- jv_parse.h jv_unicode.h locfile.h opcode.h opcode_list.h parser.y \
463- jv_utf8_tables.h lexer.l
464+LIBJQ_INCS = jq_parser.h builtin.h bytecode.h compile.h exec_stack.h \
465+ libm.h jv_alloc.h jv_dtoa.h jv_unicode.h locfile.h \
466+ opcode_list.h parser.y jv_utf8_tables.h lexer.l
467
468-JQ_SRC = opcode.c bytecode.c compile.c execute.c builtin.c jv.c \
469- jv_parse.c jv_print.c jv_dtoa.c jv_unicode.c jv_aux.c jv_alloc.c \
470- jq_test.c ${JQ_INCS}
471+LIBJQ_SRC = locfile.c bytecode.c compile.c execute.c builtin.c jv.c \
472+ jv_parse.c jv_print.c jv_dtoa.c jv_unicode.c jv_aux.c jv_file.c \
473+ jv_alloc.c jq_test.c ${LIBJQ_INCS}
474
475
476 ### C build options
477@@ -15,14 +14,15 @@
478 AM_CFLAGS = -Wextra -Wall -Wno-missing-field-initializers \
479 -Wno-unused-parameter -Wno-unused-function
480
481+ACLOCAL_AMFLAGS = -I config/m4
482
483 ### Generating the lexer and parser
484
485 # While there is some autoconf macro support for lex/flex, it doesn't support
486 # header file creation so we'll use good old make
487-BUILT_SOURCES = lexer.h lexer.c parser.h parser.c
488+BUILT_SOURCES = lexer.h lexer.c parser.h parser.c version.h
489 lexer.c: lexer.l
490- flex -o lexer.c --header-file=lexer.h $<
491+ $(AM_V_LEX) flex -o lexer.c --header-file=lexer.h $<
492 lexer.h: lexer.c
493
494 # Tell YACC (bison) autoconf macros that you want a header file created.
495@@ -30,14 +30,31 @@
496 # OSX ships an old bison, so update with homebrew or macports
497 AM_YFLAGS = --warnings=all -d
498
499+### libjq
500+
501+lib_LTLIBRARIES = libjq.la
502+libjq_la_SOURCES = ${LIBJQ_SRC}
503+libjq_la_LIBADD = -lm
504+libjq_la_LDFLAGS = -export-symbols-regex '^j[qv]_' -version-info 1:4:0
505+
506+include_HEADERS = jv.h jq.h
507+
508
509 ### Building the jq binary
510
511-main.c: config.h
512+# Remake the version.h header file if, and only if, the git ID has changed
513+.PHONY: .FORCE
514+.FORCE:
515+generate_ver = ver="`{ $(srcdir)/scripts/version || echo '$(VERSION)' ; } | sed 's/.*/\#define JQ_VERSION \"&\"/'`"
516+.remake-version-h: .FORCE
517+ @ $(generate_ver); test "x`cat version.h 2>/dev/null`" = "x$$ver" || touch .remake-version-h
518+version.h: .remake-version-h
519+ $(AM_V_GEN) $(generate_ver); echo "$$ver" > $@
520
521 bin_PROGRAMS = jq
522-jq_SOURCES = ${JQ_SRC} main.c
523-
524+jq_SOURCES = main.c
525+jq_LDFLAGS = -static-libtool-libs
526+jq_LDADD = libjq.la -lm
527
528 ### Tests (make check)
529
530@@ -54,14 +71,25 @@
531
532 man_MANS = jq.1
533 .PHONY: real_docs
534+if ENABLE_DOCS
535 jq.1: $(srcdir)/docs/content/3.manual/manual.yml
536- ( cd ${abs_srcdir}/docs; exec rake manpage ) > $@ || { rm -f $@; false; }
537+ $(AM_V_GEN) ( cd ${abs_srcdir}/docs; '$(BUNDLER)' exec rake manpage ) > $@ || { rm -f $@; false; }
538 jq.1.default: $(srcdir)/docs/default_manpage.md
539- ( cd ${abs_srcdir}/docs; exec rake manpage_default ) > $@ || { rm -f $@; false; }
540+ $(AM_V_GEN) ( cd ${abs_srcdir}/docs; '$(BUNDLER)' exec rake manpage_default ) > $@ || { rm -f $@; false; }
541 real_docs: jq.1
542 if cmp jq.1 $(srcdir)/jq.1.default > /dev/null; then\
543 rm -f jq.1; $(MAKE) $(AM_MAKEFLAGS) jq.1;\
544 fi
545+else
546+jq.1: $(srcdir)/jq.1.default
547+ $(AM_V_GEN) cp $^ $@
548+real_docs:
549+ @echo "Ruby dependencies not found, cannot build manpage." > /dev/stderr
550+ @echo "Follow the instructions in docs/README.md to install them" > /dev/stderr
551+ @echo "and then rerun ./configure" > /dev/stderr
552+ false
553+endif
554+
555
556 ### Packaging
557
558@@ -82,24 +110,21 @@
559 # setup is only used by distribution developers, not package developers.
560 # Still, as a matter of allowing patching, its not a bad idea to distribute
561 # the developer setup script in the tarball.
562-EXTRA_DIST = config.h.in $(BUILT_SOURCES) $(man_MANS) $(TESTS) \
563- $(TEST_LOG_COMPILER) gen_utf8_tables.py jq.spec \
564- $(DOC_FILES)
565+EXTRA_DIST = $(man_MANS) $(TESTS) $(TEST_LOG_COMPILER) jq.spec \
566+ $(DOC_FILES) scripts/version parser.h parser.c lexer.h \
567+ lexer.c
568
569 # README.md is expected in Github projects, good stuff in it, so we'll
570 # distribute it and install it with the package in the doc directory.
571 docdir = ${datadir}/doc/${PACKAGE}
572-dist_doc_DATA = README.md AUTHORS
573-
574-releasetag:
575- git tag -s "jq-$$(cat VERSION)" -m "jq release $$(cat VERSION)"
576+dist_doc_DATA = README.md COPYING AUTHORS README
577
578 RELEASE ?= 1
579-rpm: jq
580+rpm: dist jq.spec
581 @echo "Packaging jq as an RPM ..."
582 mkdir -p rpm/SOURCES rpm/BUILD rpm/BUILDROOT rpm/RPMS rpm/SPECS
583- cp jq-$$(cat VERSION).tar.gz rpm/SOURCES/
584- rpmbuild -tb --define "_topdir ${PWD}/rpm" --define "_prefix /usr" --define "myver $$(cat VERSION)" --define "myrel ${RELEASE}" rpm/SOURCES/jq-$$(cat VERSION).tar.gz
585+ cp jq-$(VERSION).tar.gz rpm/SOURCES/
586+ rpmbuild -tb --define "_topdir ${PWD}/rpm" --define "_prefix /usr" --define "myver $(VERSION)" --define "myrel ${RELEASE}" rpm/SOURCES/jq-$(VERSION).tar.gz
587 find rpm/RPMS/ -name "*.rpm" -exec mv {} ./ \;
588 rm -rf rpm
589
590@@ -108,5 +133,12 @@
591
592 # Not sure why this doesn't get cleaned up automatically, guess
593 # automake used to man pages which are hand coded?
594-clean-local:
595+# 'make clean' doesn't delete the manpage if it can't be rebuilt
596+.PHONY: clean-local-docs
597+clean-local-docs:
598+if ENABLE_DOCS
599 rm -f jq.1
600+endif
601+
602+clean-local: clean-local-docs
603+ rm -f version.h .remake-version-h
604
605=== modified symlink 'README'
606=== target was u'README.md'
607--- README 1970-01-01 00:00:00 +0000
608+++ README 2017-04-13 17:33:55 +0000
609@@ -0,0 +1,35 @@
610+jq
611+==
612+
613+jq is a command-line JSON processor.
614+
615+If you want to learn to use jq, read the documentation at
616+[http://stedolan.github.io/jq](http://stedolan.github.io/jq). This
617+documentation is generated from the docs/ folder of this repository.
618+You can also try it online at [http://jqplay.herokuapp.com](http://jqplay.herokuapp.com).
619+
620+If you want to hack on jq, feel free, but be warned that its internals
621+are not well-documented at the moment. Bring a hard hat and a
622+shovel. Also, read the wiki: http://github.com/stedolan/jq/wiki
623+
624+If you're building directly from the latest git, you'll need flex and
625+bison installed. To build, run:
626+
627+ autoreconf -i
628+ ./configure
629+ make -j8
630+ make check
631+
632+After make finishes, you'll be able to use `./jq`. You can also
633+install it using:
634+
635+ sudo make install
636+
637+If you're not using the latest git version but instead building a
638+released tarball (available on the website), then you won't need to
639+run `autoreconf` (and shouldn't), and you won't need flex or bison.
640+
641+To cross-compile for OS X and Windows, see docs/Rakefile's build task
642+and scripts/crosscompile. You'll need a cross-compilation environment,
643+such as Mingw for cross-compiling for Windows.
644+
645
646=== modified file 'README.md'
647--- README.md 2013-10-02 21:25:22 +0000
648+++ README.md 2017-04-13 17:33:55 +0000
649@@ -4,20 +4,32 @@
650 jq is a command-line JSON processor.
651
652 If you want to learn to use jq, read the documentation at
653-[http://stedolan.github.com/jq](http://stedolan.github.com/jq). This
654+[http://stedolan.github.io/jq](http://stedolan.github.io/jq). This
655 documentation is generated from the docs/ folder of this repository.
656+You can also try it online at [http://jqplay.herokuapp.com](http://jqplay.herokuapp.com).
657
658 If you want to hack on jq, feel free, but be warned that its internals
659 are not well-documented at the moment. Bring a hard hat and a
660 shovel. Also, read the wiki: http://github.com/stedolan/jq/wiki
661
662-To build jq, run
663+If you're building directly from the latest git, you'll need flex and
664+bison installed. To build, run:
665
666+ autoreconf -i
667 ./configure
668- make
669- sudo make install (optionally)
670-
671-If you've just checked out the latest version from git (rather than
672-using a released source tarball) then you'll need to run this first:
673-
674- autoreconf
675+ make -j8
676+ make check
677+
678+After make finishes, you'll be able to use `./jq`. You can also
679+install it using:
680+
681+ sudo make install
682+
683+If you're not using the latest git version but instead building a
684+released tarball (available on the website), then you won't need to
685+run `autoreconf` (and shouldn't), and you won't need flex or bison.
686+
687+To cross-compile for OS X and Windows, see docs/Rakefile's build task
688+and scripts/crosscompile. You'll need a cross-compilation environment,
689+such as Mingw for cross-compiling for Windows.
690+
691
692=== removed directory 'build'
693=== modified file 'builtin.c'
694--- builtin.c 2013-10-02 21:25:22 +0000
695+++ builtin.c 2017-04-13 17:33:55 +0000
696@@ -1,29 +1,15 @@
697+#include <math.h>
698+#include <stdlib.h>
699 #include <string.h>
700+#include <assert.h>
701 #include "builtin.h"
702 #include "compile.h"
703 #include "jq_parser.h"
704+#include "bytecode.h"
705 #include "locfile.h"
706-#include "jv_aux.h"
707 #include "jv_unicode.h"
708
709
710-
711-typedef jv (*func_1)(jv);
712-typedef jv (*func_2)(jv,jv);
713-typedef jv (*func_3)(jv,jv,jv);
714-typedef jv (*func_4)(jv,jv,jv,jv);
715-typedef jv (*func_5)(jv,jv,jv,jv,jv);
716-jv cfunction_invoke(struct cfunction* function, jv input[]) {
717- switch (function->nargs) {
718- case 1: return ((func_1)function->fptr)(input[0]);
719- case 2: return ((func_2)function->fptr)(input[0], input[1]);
720- case 3: return ((func_3)function->fptr)(input[0], input[1], input[2]);
721- case 4: return ((func_4)function->fptr)(input[0], input[1], input[2], input[3]);
722- case 5: return ((func_5)function->fptr)(input[0], input[1], input[2], input[3], input[4]);
723- default: return jv_invalid_with_msg(jv_string("Function takes too many arguments"));
724- }
725-}
726-
727 static jv type_error(jv bad, const char* msg) {
728 jv err = jv_invalid_with_msg(jv_string_fmt("%s %s",
729 jv_kind_name(jv_get_kind(bad)),
730@@ -64,6 +50,18 @@
731 }
732 }
733
734+#define LIBM_DD(name) \
735+static jv f_ ## name(jv input) { \
736+ if (jv_get_kind(input) != JV_KIND_NUMBER) { \
737+ return type_error(input, "number required"); \
738+ } \
739+ jv ret = jv_number(name(jv_number_value(input))); \
740+ jv_free(input); \
741+ return ret; \
742+}
743+#include "libm.h"
744+#undef LIBM_DD
745+
746 static jv f_negate(jv input) {
747 if (jv_get_kind(input) != JV_KIND_NUMBER) {
748 return type_error(input, "cannot be negated");
749@@ -73,6 +71,64 @@
750 return ret;
751 }
752
753+static jv f_startswith(jv a, jv b) {
754+ int alen = jv_string_length_bytes(jv_copy(a));
755+ int blen = jv_string_length_bytes(jv_copy(b));
756+ jv ret;
757+
758+ if (blen <= alen && memcmp(jv_string_value(a), jv_string_value(b), blen) == 0)
759+ ret = jv_true();
760+ else
761+ ret = jv_false();
762+ jv_free(a);
763+ jv_free(b);
764+ return ret;
765+}
766+
767+static jv f_endswith(jv a, jv b) {
768+ const char *astr = jv_string_value(a);
769+ const char *bstr = jv_string_value(b);
770+ size_t alen = jv_string_length_bytes(jv_copy(a));
771+ size_t blen = jv_string_length_bytes(jv_copy(b));
772+ jv ret;;
773+
774+ if (alen < blen ||
775+ memcmp(astr + (alen - blen), bstr, blen) != 0)
776+ ret = jv_false();
777+ else
778+ ret = jv_true();
779+ jv_free(a);
780+ jv_free(b);
781+ return ret;
782+}
783+
784+static jv f_ltrimstr(jv input, jv left) {
785+ if (jv_get_kind(f_startswith(jv_copy(input), jv_copy(left))) != JV_KIND_TRUE) {
786+ jv_free(left);
787+ return input;
788+ }
789+ /*
790+ * FIXME It'd be better to share the suffix with the original input --
791+ * that we could do, we just can't share prefixes.
792+ */
793+ int prefixlen = jv_string_length_bytes(left);
794+ jv res = jv_string_sized(jv_string_value(input) + prefixlen,
795+ jv_string_length_bytes(jv_copy(input)) - prefixlen);
796+ jv_free(input);
797+ return res;
798+}
799+
800+static jv f_rtrimstr(jv input, jv right) {
801+ if (jv_get_kind(f_endswith(jv_copy(input), jv_copy(right))) == JV_KIND_TRUE) {
802+ jv res = jv_string_sized(jv_string_value(input),
803+ jv_string_length_bytes(jv_copy(input)) - jv_string_length_bytes(right));
804+ jv_free(input);
805+ return res;
806+ }
807+ jv_free(right);
808+ return input;
809+}
810+
811 static jv f_minus(jv input, jv a, jv b) {
812 jv_free(input);
813 if (jv_get_kind(a) == JV_KIND_NUMBER && jv_get_kind(b) == JV_KIND_NUMBER) {
814@@ -100,9 +156,34 @@
815 }
816
817 static jv f_multiply(jv input, jv a, jv b) {
818+ jv_kind ak = jv_get_kind(a);
819+ jv_kind bk = jv_get_kind(b);
820 jv_free(input);
821- if (jv_get_kind(a) == JV_KIND_NUMBER && jv_get_kind(b) == JV_KIND_NUMBER) {
822+ if (ak == JV_KIND_NUMBER && bk == JV_KIND_NUMBER) {
823 return jv_number(jv_number_value(a) * jv_number_value(b));
824+ } else if ((ak == JV_KIND_STRING && bk == JV_KIND_NUMBER) ||
825+ (ak == JV_KIND_NUMBER && bk == JV_KIND_STRING)) {
826+ jv str = a;
827+ jv num = b;
828+ if (ak == JV_KIND_NUMBER) {
829+ str = b;
830+ num = a;
831+ }
832+ int n;
833+ size_t alen = jv_string_length_bytes(jv_copy(str));
834+ jv res = str;
835+
836+ for (n = jv_number_value(num) - 1; n > 0; n--)
837+ res = jv_string_append_buf(res, jv_string_value(str), alen);
838+
839+ jv_free(num);
840+ if (n < 0) {
841+ jv_free(str);
842+ return jv_null();
843+ }
844+ return res;
845+ } else if (ak == JV_KIND_OBJECT && bk == JV_KIND_OBJECT) {
846+ return jv_object_merge_recursive(a, b);
847 } else {
848 return type_error2(a, b, "cannot be multiplied");
849 }
850@@ -112,6 +193,17 @@
851 jv_free(input);
852 if (jv_get_kind(a) == JV_KIND_NUMBER && jv_get_kind(b) == JV_KIND_NUMBER) {
853 return jv_number(jv_number_value(a) / jv_number_value(b));
854+ } else if (jv_get_kind(a) == JV_KIND_STRING && jv_get_kind(b) == JV_KIND_STRING) {
855+ return jv_string_split(a, b);
856+ } else {
857+ return type_error2(a, b, "cannot be divided");
858+ }
859+}
860+
861+static jv f_mod(jv input, jv a, jv b) {
862+ jv_free(input);
863+ if (jv_get_kind(a) == JV_KIND_NUMBER && jv_get_kind(b) == JV_KIND_NUMBER) {
864+ return jv_number((intmax_t)jv_number_value(a) % (intmax_t)jv_number_value(b));
865 } else {
866 return type_error2(a, b, "cannot be divided");
867 }
868@@ -167,6 +259,19 @@
869 }
870 }
871
872+static jv f_dump(jv input) {
873+ return jv_dump_string(input, 0);
874+}
875+
876+static jv f_json_parse(jv input) {
877+ if (jv_get_kind(input) != JV_KIND_STRING)
878+ return type_error(input, "only strings can be parsed");
879+ jv res = jv_parse_sized(jv_string_value(input),
880+ jv_string_length_bytes(jv_copy(input)));
881+ jv_free(input);
882+ return res;
883+}
884+
885 static jv f_tonumber(jv input) {
886 if (jv_get_kind(input) == JV_KIND_NUMBER) {
887 return input;
888@@ -188,6 +293,8 @@
889 return jv_number(jv_object_length(input));
890 } else if (jv_get_kind(input) == JV_KIND_STRING) {
891 return jv_number(jv_string_length_codepoints(input));
892+ } else if (jv_get_kind(input) == JV_KIND_NUMBER) {
893+ return jv_number(fabs(jv_number_value(input)));
894 } else if (jv_get_kind(input) == JV_KIND_NULL) {
895 jv_free(input);
896 return jv_number(0);
897@@ -468,15 +575,29 @@
898 return jv_invalid_with_msg(msg);
899 }
900
901+#define LIBM_DD(name) \
902+ {(cfunction_ptr)f_ ## name, "_" #name, 1},
903+
904 static const struct cfunction function_list[] = {
905+#include "libm.h"
906 {(cfunction_ptr)f_plus, "_plus", 3},
907 {(cfunction_ptr)f_negate, "_negate", 1},
908 {(cfunction_ptr)f_minus, "_minus", 3},
909 {(cfunction_ptr)f_multiply, "_multiply", 3},
910 {(cfunction_ptr)f_divide, "_divide", 3},
911+ {(cfunction_ptr)f_mod, "_mod", 3},
912+ {(cfunction_ptr)f_dump, "tojson", 1},
913+ {(cfunction_ptr)f_json_parse, "fromjson", 1},
914 {(cfunction_ptr)f_tonumber, "tonumber", 1},
915 {(cfunction_ptr)f_tostring, "tostring", 1},
916 {(cfunction_ptr)f_keys, "keys", 1},
917+ {(cfunction_ptr)f_startswith, "startswith", 2},
918+ {(cfunction_ptr)f_endswith, "endswith", 2},
919+ {(cfunction_ptr)f_ltrimstr, "ltrimstr", 2},
920+ {(cfunction_ptr)f_rtrimstr, "rtrimstr", 2},
921+ {(cfunction_ptr)jv_string_split, "split", 2},
922+ {(cfunction_ptr)jv_string_explode, "explode", 1},
923+ {(cfunction_ptr)jv_string_implode, "implode", 1},
924 {(cfunction_ptr)jv_setpath, "setpath", 3}, // FIXME typechecking
925 {(cfunction_ptr)jv_getpath, "getpath", 2},
926 {(cfunction_ptr)jv_delpaths, "delpaths", 2},
927@@ -500,6 +621,7 @@
928 {(cfunction_ptr)f_error, "error", 2},
929 {(cfunction_ptr)f_format, "format", 2},
930 };
931+#undef LIBM_DD
932
933 struct bytecoded_builtin { const char* name; block code; };
934 static block bind_bytecoded_builtins(block b) {
935@@ -526,56 +648,105 @@
936 };
937 for (unsigned i=0; i<sizeof(builtin_def_1arg)/sizeof(builtin_def_1arg[0]); i++) {
938 builtins = BLOCK(builtins, gen_function(builtin_def_1arg[i].name,
939- gen_op_block_unbound(CLOSURE_PARAM, "arg"),
940+ gen_param("arg"),
941 builtin_def_1arg[i].code));
942 }
943 }
944 {
945- block rangevar = block_bind(gen_op_var_unbound(STOREV, "rangevar"),
946- gen_noop(), OP_HAS_VARIABLE);
947+ block rangevar = gen_op_var_fresh(STOREV, "rangevar");
948 block init = BLOCK(gen_op_simple(DUP), gen_call("start", gen_noop()), rangevar);
949 block range = BLOCK(init,
950 gen_call("end", gen_noop()),
951- gen_op_var_bound(RANGE, rangevar));
952+ gen_op_bound(RANGE, rangevar));
953 builtins = BLOCK(builtins, gen_function("range",
954- BLOCK(gen_op_block_unbound(CLOSURE_PARAM, "start"),
955- gen_op_block_unbound(CLOSURE_PARAM, "end")),
956+ BLOCK(gen_param("start"), gen_param("end")),
957 range));
958 }
959
960 return block_bind_referenced(builtins, b, OP_IS_CALL_PSEUDO);
961 }
962
963+#define LIBM_DD(name) "def " #name ": _" #name ";",
964+
965 static const char* const jq_builtins[] = {
966 "def map(f): [.[] | f];",
967 "def select(f): if f then . else empty end;",
968 "def sort_by(f): _sort_by_impl(map([f]));",
969 "def group_by(f): _group_by_impl(map([f]));",
970 "def unique: group_by(.) | map(.[0]);",
971+ "def unique_by(f): group_by(f) | map(.[0]);",
972 "def max_by(f): _max_by_impl(map([f]));",
973 "def min_by(f): _min_by_impl(map([f]));",
974+#include "libm.h"
975 "def add: reduce .[] as $x (null; . + $x);",
976 "def del(f): delpaths([path(f)]);",
977 "def _assign(paths; value): value as $v | reduce path(paths) as $p (.; setpath($p; $v));",
978 "def _modify(paths; update): reduce path(paths) as $p (.; setpath($p; getpath($p) | update));",
979 "def recurse(f): ., (f | select(. != null) | recurse(f));",
980+ "def recurse_down: recurse(.[]?);",
981 "def to_entries: [keys[] as $k | {key: $k, value: .[$k]}];",
982 "def from_entries: map({(.key): .value}) | add;",
983 "def with_entries(f): to_entries | map(f) | from_entries;",
984 "def reverse: [.[length - 1 - range(0;length)]];",
985+ "def indices(i): if type == \"array\" and (i|type) == \"array\" then .[i] elif type == \"array\" then .[[i]] else .[i] end;",
986+ "def index(i): if type == \"array\" and (i|type) == \"array\" then .[i] elif type == \"array\" then .[[i]] else .[i] end | .[0];",
987+ "def rindex(i): if type == \"array\" and (i|type) == \"array\" then .[i] elif type == \"array\" then .[[i]] else .[i] end | .[-1:][0];",
988+ "def paths: path(recurse(if (type|. == \"array\" or . == \"object\") then .[] else empty end))|select(length > 0);",
989+ "def leaf_paths: . as $dot|paths|select(. as $p|$dot|getpath($p)|type|. != \"array\" and . != \"object\");",
990+ "def any: reduce .[] as $i (false; . or $i);",
991+ "def all: reduce .[] as $i (true; . and $i);",
992+ "def arrays: select(type == \"array\");",
993+ "def objects: select(type == \"object\");",
994+ "def iterables: arrays, objects;",
995+ "def booleans: select(type == \"boolean\");",
996+ "def numbers: select(type == \"number\");",
997+ "def strings: select(type == \"string\");",
998+ "def nulls: select(type == \"null\");",
999+ "def values: arrays, objects, booleans, numbers, strings;",
1000+ "def scalars: select(. == null or . == true or . == false or type == \"number\" or type == \"string\");",
1001+ "def join(x): reduce .[] as $i (\"\"; . + (if . == \"\" then $i else x + $i end));",
1002 };
1003-
1004-
1005-block builtins_bind(block b) {
1006+#undef LIBM_DD
1007+
1008+
1009+static int builtins_bind_one(jq_state *jq, block* bb, const char* code) {
1010+ struct locfile src;
1011+ locfile_init(&src, jq, code, strlen(code));
1012+ block funcs;
1013+ int nerrors = jq_parse_library(&src, &funcs);
1014+ if (nerrors == 0) {
1015+ *bb = block_bind_referenced(funcs, *bb, OP_IS_CALL_PSEUDO);
1016+ }
1017+ locfile_free(&src);
1018+ return nerrors;
1019+}
1020+
1021+static int slurp_lib(jq_state *jq, block* bb) {
1022+ int nerrors = 0;
1023+ char* home = getenv("HOME");
1024+ if (home) { // silently ignore no $HOME
1025+ jv filename = jv_string_append_str(jv_string(home), "/.jq");
1026+ jv data = jv_load_file(jv_string_value(filename), 1);
1027+ if (jv_is_valid(data)) {
1028+ nerrors = builtins_bind_one(jq, bb, jv_string_value(data) );
1029+ }
1030+ jv_free(filename);
1031+ jv_free(data);
1032+ }
1033+ return nerrors;
1034+}
1035+
1036+int builtins_bind(jq_state *jq, block* bb) {
1037+ int nerrors = slurp_lib(jq, bb);
1038+ if (nerrors) {
1039+ block_free(*bb);
1040+ return nerrors;
1041+ }
1042 for (int i=(int)(sizeof(jq_builtins)/sizeof(jq_builtins[0]))-1; i>=0; i--) {
1043- struct locfile src;
1044- locfile_init(&src, jq_builtins[i], strlen(jq_builtins[i]));
1045- block funcs;
1046- int nerrors = jq_parse_library(&src, &funcs);
1047+ nerrors = builtins_bind_one(jq, bb, jq_builtins[i]);
1048 assert(!nerrors);
1049- b = block_bind_referenced(funcs, b, OP_IS_CALL_PSEUDO);
1050- locfile_free(&src);
1051 }
1052- b = bind_bytecoded_builtins(b);
1053- return gen_cbinding(function_list, sizeof(function_list)/sizeof(function_list[0]), b);
1054+ *bb = bind_bytecoded_builtins(*bb);
1055+ *bb = gen_cbinding(function_list, sizeof(function_list)/sizeof(function_list[0]), *bb);
1056+ return nerrors;
1057 }
1058
1059=== modified file 'builtin.h'
1060--- builtin.h 2012-12-21 23:28:59 +0000
1061+++ builtin.h 2017-04-13 17:33:55 +0000
1062@@ -1,21 +1,10 @@
1063 #ifndef BUILTIN_H
1064 #define BUILTIN_H
1065
1066+#include "jq.h"
1067+#include "bytecode.h"
1068 #include "compile.h"
1069
1070-block builtins_bind(block);
1071-
1072-
1073-typedef void (*cfunction_ptr)(void);
1074-
1075-struct cfunction {
1076- cfunction_ptr fptr;
1077- const char* name;
1078- int nargs;
1079-};
1080-
1081-
1082-jv cfunction_invoke(struct cfunction* function, jv input[]);
1083-
1084+int builtins_bind(jq_state *, block*);
1085
1086 #endif
1087
1088=== modified file 'bytecode.c'
1089--- bytecode.c 2013-10-02 21:25:22 +0000
1090+++ bytecode.c 2017-04-13 17:33:55 +0000
1091@@ -3,9 +3,39 @@
1092 #include <stdlib.h>
1093
1094 #include "bytecode.h"
1095-#include "opcode.h"
1096 #include "jv_alloc.h"
1097
1098+// flags, length
1099+#define NONE 0, 1
1100+#define CONSTANT OP_HAS_CONSTANT, 2
1101+#define VARIABLE (OP_HAS_VARIABLE | OP_HAS_BINDING), 3
1102+#define BRANCH OP_HAS_BRANCH, 2
1103+#define CFUNC (OP_HAS_CFUNC | OP_HAS_BINDING), 3
1104+#define UFUNC (OP_HAS_UFUNC | OP_HAS_BINDING | OP_IS_CALL_PSEUDO), 4
1105+#define DEFINITION (OP_IS_CALL_PSEUDO | OP_HAS_BINDING), 0
1106+#define CLOSURE_REF_IMM (OP_IS_CALL_PSEUDO | OP_HAS_BINDING), 2
1107+
1108+#define OP(name, imm, in, out) \
1109+ {name, #name, imm, in, out},
1110+
1111+static const struct opcode_description opcode_descriptions[] = {
1112+#include "opcode_list.h"
1113+};
1114+
1115+static const struct opcode_description invalid_opcode_description = {
1116+ -1, "#INVALID", 0, 0, 0, 0
1117+};
1118+
1119+
1120+const struct opcode_description* opcode_describe(opcode op) {
1121+ if ((int)op >= 0 && (int)op < NUM_OPCODES) {
1122+ return &opcode_descriptions[op];
1123+ } else {
1124+ return &invalid_opcode_description;
1125+ }
1126+}
1127+
1128+
1129 static int bytecode_operation_length(uint16_t* codeptr) {
1130 int length = opcode_describe(*codeptr)->length;
1131 if (*codeptr == CALL_JQ) {
1132@@ -14,6 +44,22 @@
1133 return length;
1134 }
1135
1136+static void dump_code(int indent, struct bytecode* bc) {
1137+ int pc = 0;
1138+ while (pc < bc->codelen) {
1139+ printf("%*s", indent, "");
1140+ dump_operation(bc, bc->code + pc);
1141+ printf("\n");
1142+ pc += bytecode_operation_length(bc->code + pc);
1143+ }
1144+}
1145+
1146+static void symbol_table_free(struct symbol_table* syms) {
1147+ jv_mem_free(syms->cfunctions);
1148+ jv_free(syms->cfunc_names);
1149+ jv_mem_free(syms);
1150+}
1151+
1152 void dump_disassembly(int indent, struct bytecode* bc) {
1153 if (bc->nclosures > 0) {
1154 printf("%*s[params: ", indent, "");
1155@@ -37,16 +83,6 @@
1156 }
1157 }
1158
1159-void dump_code(int indent, struct bytecode* bc) {
1160- int pc = 0;
1161- while (pc < bc->codelen) {
1162- printf("%*s", indent, "");
1163- dump_operation(bc, bc->code + pc);
1164- printf("\n");
1165- pc += bytecode_operation_length(bc->code + pc);
1166- }
1167-}
1168-
1169 static struct bytecode* getlevel(struct bytecode* bc, int level) {
1170 while (level > 0) {
1171 bc = bc->parent;
1172@@ -109,13 +145,9 @@
1173 }
1174 }
1175
1176-void symbol_table_free(struct symbol_table* syms) {
1177- jv_mem_free(syms->cfunctions);
1178- jv_free(syms->cfunc_names);
1179- jv_mem_free(syms);
1180-}
1181-
1182 void bytecode_free(struct bytecode* bc) {
1183+ if (!bc)
1184+ return;
1185 jv_mem_free(bc->code);
1186 jv_free(bc->constants);
1187 for (int i=0; i<bc->nsubfunctions; i++)
1188
1189=== modified file 'bytecode.h'
1190--- bytecode.h 2013-10-02 21:25:22 +0000
1191+++ bytecode.h 2017-04-13 17:33:55 +0000
1192@@ -3,10 +3,52 @@
1193 #include <stdint.h>
1194
1195 #include "jv.h"
1196-#include "opcode.h"
1197-#include "builtin.h"
1198+
1199+typedef enum {
1200+#define OP(name, imm, in, out) name,
1201+#include "opcode_list.h"
1202+#undef OP
1203+} opcode;
1204+
1205+enum {
1206+ NUM_OPCODES =
1207+#define OP(name, imm, in, out) +1
1208+#include "opcode_list.h"
1209+#undef OP
1210+};
1211+
1212+enum {
1213+ OP_HAS_CONSTANT = 2,
1214+ OP_HAS_VARIABLE = 4,
1215+ OP_HAS_BRANCH = 8,
1216+ OP_HAS_CFUNC = 32,
1217+ OP_HAS_UFUNC = 64,
1218+ OP_IS_CALL_PSEUDO = 128,
1219+ OP_HAS_BINDING = 1024,
1220+};
1221+struct opcode_description {
1222+ opcode op;
1223+ const char* name;
1224+
1225+ int flags;
1226+
1227+ // length in 16-bit units
1228+ int length;
1229+
1230+ int stack_in, stack_out;
1231+};
1232+
1233+const struct opcode_description* opcode_describe(opcode op);
1234+
1235
1236 #define MAX_CFUNCTION_ARGS 10
1237+typedef void (*cfunction_ptr)();
1238+struct cfunction {
1239+ cfunction_ptr fptr;
1240+ const char* name;
1241+ int nargs;
1242+};
1243+
1244 struct symbol_table {
1245 struct cfunction* cfunctions;
1246 int ncfunctions;
1247@@ -39,10 +81,8 @@
1248 };
1249
1250 void dump_disassembly(int, struct bytecode* code);
1251-void dump_code(int, struct bytecode* code);
1252 void dump_operation(struct bytecode* bc, uint16_t* op);
1253
1254-void symbol_table_free(struct symbol_table* syms);
1255 void bytecode_free(struct bytecode* bc);
1256
1257 #endif
1258
1259=== modified file 'compile.c'
1260--- compile.c 2013-10-02 21:25:22 +0000
1261+++ compile.c 2017-04-13 17:33:55 +0000
1262@@ -1,8 +1,9 @@
1263+#ifndef _GNU_SOURCE
1264 #define _GNU_SOURCE // for strdup
1265+#endif
1266 #include <assert.h>
1267 #include <string.h>
1268 #include <stdlib.h>
1269-#include "opcode.h"
1270 #include "compile.h"
1271 #include "bytecode.h"
1272 #include "locfile.h"
1273@@ -153,33 +154,26 @@
1274 b.first->imm.target = target.last;
1275 }
1276
1277-block gen_op_var_unbound(opcode op, const char* name) {
1278+block gen_op_unbound(opcode op, const char* name) {
1279+ assert(opcode_describe(op)->flags & OP_HAS_BINDING);
1280+ inst* i = inst_new(op);
1281+ i->symbol = strdup(name);
1282+ return inst_block(i);
1283+}
1284+
1285+block gen_op_var_fresh(opcode op, const char* name) {
1286 assert(opcode_describe(op)->flags & OP_HAS_VARIABLE);
1287- inst* i = inst_new(op);
1288- i->symbol = strdup(name);
1289- return inst_block(i);
1290-}
1291-
1292-block gen_op_var_bound(opcode op, block binder) {
1293- assert(block_is_single(binder));
1294- block b = gen_op_var_unbound(op, binder.first->symbol);
1295- b.first->bound_by = binder.first;
1296- return b;
1297-}
1298-
1299-block gen_op_block_unbound(opcode op, const char* name) {
1300- assert(opcode_describe(op)->flags & OP_IS_CALL_PSEUDO);
1301- inst* i = inst_new(op);
1302- i->symbol = strdup(name);
1303- return inst_block(i);
1304-}
1305-
1306-block gen_op_block_bound(opcode op, block binder) {
1307- assert(block_is_single(binder));
1308- block b = gen_op_block_unbound(op, binder.first->symbol);
1309- b.first->bound_by = binder.first;
1310- return b;
1311-}
1312+ return block_bind(gen_op_unbound(op, name),
1313+ gen_noop(), OP_HAS_VARIABLE);
1314+}
1315+
1316+block gen_op_bound(opcode op, block binder) {
1317+ assert(block_is_single(binder));
1318+ block b = gen_op_unbound(op, binder.first->symbol);
1319+ b.first->bound_by = binder.first;
1320+ return b;
1321+}
1322+
1323
1324 static void inst_join(inst* a, inst* b) {
1325 assert(a && b);
1326@@ -280,12 +274,16 @@
1327 return b;
1328 }
1329
1330+block gen_param(const char* name) {
1331+ return gen_op_unbound(CLOSURE_PARAM, name);
1332+}
1333+
1334 block gen_lambda(block body) {
1335 return gen_function("@lambda", gen_noop(), body);
1336 }
1337
1338 block gen_call(const char* name, block args) {
1339- block b = gen_op_block_unbound(CALL_JQ, name);
1340+ block b = gen_op_unbound(CALL_JQ, name);
1341 b.first->arglist = args;
1342 return b;
1343 }
1344@@ -306,30 +304,27 @@
1345
1346
1347 block gen_collect(block expr) {
1348- block array_var = block_bind(gen_op_var_unbound(STOREV, "collect"),
1349- gen_noop(), OP_HAS_VARIABLE);
1350+ block array_var = gen_op_var_fresh(STOREV, "collect");
1351 block c = BLOCK(gen_op_simple(DUP), gen_const(jv_array()), array_var);
1352
1353- block tail = BLOCK(gen_op_var_bound(APPEND, array_var),
1354+ block tail = BLOCK(gen_op_bound(APPEND, array_var),
1355 gen_op_simple(BACKTRACK));
1356
1357 return BLOCK(c,
1358 gen_op_target(FORK, tail),
1359 expr,
1360 tail,
1361- gen_op_var_bound(LOADVN, array_var));
1362+ gen_op_bound(LOADVN, array_var));
1363 }
1364
1365 block gen_reduce(const char* varname, block source, block init, block body) {
1366- block res_var = block_bind(gen_op_var_unbound(STOREV, "reduce"),
1367- gen_noop(), OP_HAS_VARIABLE);
1368-
1369+ block res_var = gen_op_var_fresh(STOREV, "reduce");
1370 block loop = BLOCK(gen_op_simple(DUP),
1371 source,
1372- block_bind(gen_op_var_unbound(STOREV, varname),
1373- BLOCK(gen_op_var_bound(LOADVN, res_var),
1374+ block_bind(gen_op_unbound(STOREV, varname),
1375+ BLOCK(gen_op_bound(LOADVN, res_var),
1376 body,
1377- gen_op_var_bound(STOREV, res_var)),
1378+ gen_op_bound(STOREV, res_var)),
1379 OP_HAS_VARIABLE),
1380 gen_op_simple(BACKTRACK));
1381 return BLOCK(gen_op_simple(DUP),
1382@@ -337,19 +332,18 @@
1383 res_var,
1384 gen_op_target(FORK, loop),
1385 loop,
1386- gen_op_var_bound(LOADVN, res_var));
1387+ gen_op_bound(LOADVN, res_var));
1388 }
1389
1390 block gen_definedor(block a, block b) {
1391 // var found := false
1392- block found_var = block_bind(gen_op_var_unbound(STOREV, "found"),
1393- gen_noop(), OP_HAS_VARIABLE);
1394+ block found_var = gen_op_var_fresh(STOREV, "found");
1395 block init = BLOCK(gen_op_simple(DUP), gen_const(jv_false()), found_var);
1396
1397 // if found, backtrack. Otherwise execute b
1398 block backtrack = gen_op_simple(BACKTRACK);
1399 block tail = BLOCK(gen_op_simple(DUP),
1400- gen_op_var_bound(LOADV, found_var),
1401+ gen_op_bound(LOADV, found_var),
1402 gen_op_target(JUMP_F, backtrack),
1403 backtrack,
1404 gen_op_simple(POP),
1405@@ -361,7 +355,7 @@
1406 // found := true, produce result
1407 block if_found = BLOCK(gen_op_simple(DUP),
1408 gen_const(jv_true()),
1409- gen_op_var_bound(STOREV, found_var),
1410+ gen_op_bound(STOREV, found_var),
1411 gen_op_target(JUMP, tail));
1412
1413 return BLOCK(init,
1414@@ -400,7 +394,7 @@
1415
1416 block gen_var_binding(block var, const char* name, block body) {
1417 return BLOCK(gen_op_simple(DUP), var,
1418- block_bind(gen_op_var_unbound(STOREV, name),
1419+ block_bind(gen_op_unbound(STOREV, name),
1420 body, OP_HAS_VARIABLE));
1421 }
1422
1423@@ -475,7 +469,7 @@
1424 break;
1425 case CLOSURE_CREATE:
1426 block_append(&prelude, b);
1427- block_append(&callargs, gen_op_block_bound(CLOSURE_REF, b));
1428+ block_append(&callargs, gen_op_bound(CLOSURE_REF, b));
1429 break;
1430 }
1431 actual_args++;
1432
1433=== modified file 'compile.h'
1434--- compile.h 2013-10-02 21:25:22 +0000
1435+++ compile.h 2017-04-13 17:33:55 +0000
1436@@ -2,13 +2,9 @@
1437 #define COMPILE_H
1438 #include <stdint.h>
1439 #include "jv.h"
1440-#include "opcode.h"
1441+#include "bytecode.h"
1442 #include "locfile.h"
1443
1444-struct bytecode;
1445-struct symbol_table;
1446-struct cfunction;
1447-
1448 struct inst;
1449 typedef struct inst inst;
1450
1451@@ -24,11 +20,12 @@
1452 block gen_op_simple(opcode op);
1453 block gen_const(jv constant);
1454 block gen_op_target(opcode op, block target);
1455-block gen_op_var_unbound(opcode op, const char* name);
1456-block gen_op_var_bound(opcode op, block binder);
1457-block gen_op_block_unbound(opcode op, const char* name);
1458+block gen_op_unbound(opcode op, const char* name);
1459+block gen_op_bound(opcode op, block binder);
1460+block gen_op_var_fresh(opcode op, const char* name);
1461
1462 block gen_function(const char* name, block formals, block body);
1463+block gen_param(const char* name);
1464 block gen_lambda(block body);
1465 block gen_call(const char* name, block body);
1466 block gen_subexp(block a);
1467
1468=== removed file 'config.h.in'
1469--- config.h.in 2013-10-02 21:25:22 +0000
1470+++ config.h.in 1970-01-01 00:00:00 +0000
1471@@ -1,32 +0,0 @@
1472-/* config.h.in. Generated from configure.ac by autoheader. */
1473-
1474-/* Define to 1 if your C compiler doesn't accept -c and -o together. */
1475-#undef NO_MINUS_C_MINUS_O
1476-
1477-/* Name of package */
1478-#undef PACKAGE
1479-
1480-/* Define to the address where bug reports for this package should be sent. */
1481-#undef PACKAGE_BUGREPORT
1482-
1483-/* Define to the full name of this package. */
1484-#undef PACKAGE_NAME
1485-
1486-/* Define to the full name and version of this package. */
1487-#undef PACKAGE_STRING
1488-
1489-/* Define to the one symbol short name of this package. */
1490-#undef PACKAGE_TARNAME
1491-
1492-/* Define to the home page for this package. */
1493-#undef PACKAGE_URL
1494-
1495-/* Define to the version of this package. */
1496-#undef PACKAGE_VERSION
1497-
1498-/* Version number of package */
1499-#undef VERSION
1500-
1501-/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
1502- `char[]'. */
1503-#undef YYTEXT_POINTER
1504
1505=== added file 'config/ar-lib'
1506--- config/ar-lib 1970-01-01 00:00:00 +0000
1507+++ config/ar-lib 2017-04-13 17:33:55 +0000
1508@@ -0,0 +1,270 @@
1509+#! /bin/sh
1510+# Wrapper for Microsoft lib.exe
1511+
1512+me=ar-lib
1513+scriptversion=2012-03-01.08; # UTC
1514+
1515+# Copyright (C) 2010-2013 Free Software Foundation, Inc.
1516+# Written by Peter Rosin <peda@lysator.liu.se>.
1517+#
1518+# This program is free software; you can redistribute it and/or modify
1519+# it under the terms of the GNU General Public License as published by
1520+# the Free Software Foundation; either version 2, or (at your option)
1521+# any later version.
1522+#
1523+# This program is distributed in the hope that it will be useful,
1524+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1525+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1526+# GNU General Public License for more details.
1527+#
1528+# You should have received a copy of the GNU General Public License
1529+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1530+
1531+# As a special exception to the GNU General Public License, if you
1532+# distribute this file as part of a program that contains a
1533+# configuration script generated by Autoconf, you may include it under
1534+# the same distribution terms that you use for the rest of that program.
1535+
1536+# This file is maintained in Automake, please report
1537+# bugs to <bug-automake@gnu.org> or send patches to
1538+# <automake-patches@gnu.org>.
1539+
1540+
1541+# func_error message
1542+func_error ()
1543+{
1544+ echo "$me: $1" 1>&2
1545+ exit 1
1546+}
1547+
1548+file_conv=
1549+
1550+# func_file_conv build_file
1551+# Convert a $build file to $host form and store it in $file
1552+# Currently only supports Windows hosts.
1553+func_file_conv ()
1554+{
1555+ file=$1
1556+ case $file in
1557+ / | /[!/]*) # absolute file, and not a UNC file
1558+ if test -z "$file_conv"; then
1559+ # lazily determine how to convert abs files
1560+ case `uname -s` in
1561+ MINGW*)
1562+ file_conv=mingw
1563+ ;;
1564+ CYGWIN*)
1565+ file_conv=cygwin
1566+ ;;
1567+ *)
1568+ file_conv=wine
1569+ ;;
1570+ esac
1571+ fi
1572+ case $file_conv in
1573+ mingw)
1574+ file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
1575+ ;;
1576+ cygwin)
1577+ file=`cygpath -m "$file" || echo "$file"`
1578+ ;;
1579+ wine)
1580+ file=`winepath -w "$file" || echo "$file"`
1581+ ;;
1582+ esac
1583+ ;;
1584+ esac
1585+}
1586+
1587+# func_at_file at_file operation archive
1588+# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
1589+# for each of them.
1590+# When interpreting the content of the @FILE, do NOT use func_file_conv,
1591+# since the user would need to supply preconverted file names to
1592+# binutils ar, at least for MinGW.
1593+func_at_file ()
1594+{
1595+ operation=$2
1596+ archive=$3
1597+ at_file_contents=`cat "$1"`
1598+ eval set x "$at_file_contents"
1599+ shift
1600+
1601+ for member
1602+ do
1603+ $AR -NOLOGO $operation:"$member" "$archive" || exit $?
1604+ done
1605+}
1606+
1607+case $1 in
1608+ '')
1609+ func_error "no command. Try '$0 --help' for more information."
1610+ ;;
1611+ -h | --h*)
1612+ cat <<EOF
1613+Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]
1614+
1615+Members may be specified in a file named with @FILE.
1616+EOF
1617+ exit $?
1618+ ;;
1619+ -v | --v*)
1620+ echo "$me, version $scriptversion"
1621+ exit $?
1622+ ;;
1623+esac
1624+
1625+if test $# -lt 3; then
1626+ func_error "you must specify a program, an action and an archive"
1627+fi
1628+
1629+AR=$1
1630+shift
1631+while :
1632+do
1633+ if test $# -lt 2; then
1634+ func_error "you must specify a program, an action and an archive"
1635+ fi
1636+ case $1 in
1637+ -lib | -LIB \
1638+ | -ltcg | -LTCG \
1639+ | -machine* | -MACHINE* \
1640+ | -subsystem* | -SUBSYSTEM* \
1641+ | -verbose | -VERBOSE \
1642+ | -wx* | -WX* )
1643+ AR="$AR $1"
1644+ shift
1645+ ;;
1646+ *)
1647+ action=$1
1648+ shift
1649+ break
1650+ ;;
1651+ esac
1652+done
1653+orig_archive=$1
1654+shift
1655+func_file_conv "$orig_archive"
1656+archive=$file
1657+
1658+# strip leading dash in $action
1659+action=${action#-}
1660+
1661+delete=
1662+extract=
1663+list=
1664+quick=
1665+replace=
1666+index=
1667+create=
1668+
1669+while test -n "$action"
1670+do
1671+ case $action in
1672+ d*) delete=yes ;;
1673+ x*) extract=yes ;;
1674+ t*) list=yes ;;
1675+ q*) quick=yes ;;
1676+ r*) replace=yes ;;
1677+ s*) index=yes ;;
1678+ S*) ;; # the index is always updated implicitly
1679+ c*) create=yes ;;
1680+ u*) ;; # TODO: don't ignore the update modifier
1681+ v*) ;; # TODO: don't ignore the verbose modifier
1682+ *)
1683+ func_error "unknown action specified"
1684+ ;;
1685+ esac
1686+ action=${action#?}
1687+done
1688+
1689+case $delete$extract$list$quick$replace,$index in
1690+ yes,* | ,yes)
1691+ ;;
1692+ yesyes*)
1693+ func_error "more than one action specified"
1694+ ;;
1695+ *)
1696+ func_error "no action specified"
1697+ ;;
1698+esac
1699+
1700+if test -n "$delete"; then
1701+ if test ! -f "$orig_archive"; then
1702+ func_error "archive not found"
1703+ fi
1704+ for member
1705+ do
1706+ case $1 in
1707+ @*)
1708+ func_at_file "${1#@}" -REMOVE "$archive"
1709+ ;;
1710+ *)
1711+ func_file_conv "$1"
1712+ $AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
1713+ ;;
1714+ esac
1715+ done
1716+
1717+elif test -n "$extract"; then
1718+ if test ! -f "$orig_archive"; then
1719+ func_error "archive not found"
1720+ fi
1721+ if test $# -gt 0; then
1722+ for member
1723+ do
1724+ case $1 in
1725+ @*)
1726+ func_at_file "${1#@}" -EXTRACT "$archive"
1727+ ;;
1728+ *)
1729+ func_file_conv "$1"
1730+ $AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
1731+ ;;
1732+ esac
1733+ done
1734+ else
1735+ $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
1736+ do
1737+ $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
1738+ done
1739+ fi
1740+
1741+elif test -n "$quick$replace"; then
1742+ if test ! -f "$orig_archive"; then
1743+ if test -z "$create"; then
1744+ echo "$me: creating $orig_archive"
1745+ fi
1746+ orig_archive=
1747+ else
1748+ orig_archive=$archive
1749+ fi
1750+
1751+ for member
1752+ do
1753+ case $1 in
1754+ @*)
1755+ func_file_conv "${1#@}"
1756+ set x "$@" "@$file"
1757+ ;;
1758+ *)
1759+ func_file_conv "$1"
1760+ set x "$@" "$file"
1761+ ;;
1762+ esac
1763+ shift
1764+ shift
1765+ done
1766+
1767+ if test -n "$orig_archive"; then
1768+ $AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
1769+ else
1770+ $AR -NOLOGO -OUT:"$archive" "$@" || exit $?
1771+ fi
1772+
1773+elif test -n "$list"; then
1774+ if test ! -f "$orig_archive"; then
1775+ func_error "archive not found"
1776+ fi
1777+ $AR -NOLOGO -LIST "$archive" || exit $?
1778+fi
1779
1780=== modified file 'config/compile'
1781--- config/compile 2013-10-02 21:25:22 +0000
1782+++ config/compile 2017-04-13 17:33:55 +0000
1783@@ -1,10 +1,9 @@
1784 #! /bin/sh
1785 # Wrapper for compilers which do not understand '-c -o'.
1786
1787-scriptversion=2012-03-05.13; # UTC
1788+scriptversion=2012-10-14.11; # UTC
1789
1790-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free
1791-# Software Foundation, Inc.
1792+# Copyright (C) 1999-2013 Free Software Foundation, Inc.
1793 # Written by Tom Tromey <tromey@cygnus.com>.
1794 #
1795 # This program is free software; you can redistribute it and/or modify
1796@@ -113,6 +112,11 @@
1797 lib=$dir/$lib.lib
1798 break
1799 fi
1800+ if test -f "$dir/lib$lib.a"; then
1801+ found=yes
1802+ lib=$dir/lib$lib.a
1803+ break
1804+ fi
1805 done
1806 IFS=$save_IFS
1807
1808
1809=== added file 'config/config.guess'
1810--- config/config.guess 1970-01-01 00:00:00 +0000
1811+++ config/config.guess 2017-04-13 17:33:55 +0000
1812@@ -0,0 +1,1558 @@
1813+#! /bin/sh
1814+# Attempt to guess a canonical system name.
1815+# Copyright 1992-2013 Free Software Foundation, Inc.
1816+
1817+timestamp='2013-06-10'
1818+
1819+# This file is free software; you can redistribute it and/or modify it
1820+# under the terms of the GNU General Public License as published by
1821+# the Free Software Foundation; either version 3 of the License, or
1822+# (at your option) any later version.
1823+#
1824+# This program is distributed in the hope that it will be useful, but
1825+# WITHOUT ANY WARRANTY; without even the implied warranty of
1826+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1827+# General Public License for more details.
1828+#
1829+# You should have received a copy of the GNU General Public License
1830+# along with this program; if not, see <http://www.gnu.org/licenses/>.
1831+#
1832+# As a special exception to the GNU General Public License, if you
1833+# distribute this file as part of a program that contains a
1834+# configuration script generated by Autoconf, you may include it under
1835+# the same distribution terms that you use for the rest of that
1836+# program. This Exception is an additional permission under section 7
1837+# of the GNU General Public License, version 3 ("GPLv3").
1838+#
1839+# Originally written by Per Bothner.
1840+#
1841+# You can get the latest version of this script from:
1842+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
1843+#
1844+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
1845+
1846+
1847+me=`echo "$0" | sed -e 's,.*/,,'`
1848+
1849+usage="\
1850+Usage: $0 [OPTION]
1851+
1852+Output the configuration name of the system \`$me' is run on.
1853+
1854+Operation modes:
1855+ -h, --help print this help, then exit
1856+ -t, --time-stamp print date of last modification, then exit
1857+ -v, --version print version number, then exit
1858+
1859+Report bugs and patches to <config-patches@gnu.org>."
1860+
1861+version="\
1862+GNU config.guess ($timestamp)
1863+
1864+Originally written by Per Bothner.
1865+Copyright 1992-2013 Free Software Foundation, Inc.
1866+
1867+This is free software; see the source for copying conditions. There is NO
1868+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
1869+
1870+help="
1871+Try \`$me --help' for more information."
1872+
1873+# Parse command line
1874+while test $# -gt 0 ; do
1875+ case $1 in
1876+ --time-stamp | --time* | -t )
1877+ echo "$timestamp" ; exit ;;
1878+ --version | -v )
1879+ echo "$version" ; exit ;;
1880+ --help | --h* | -h )
1881+ echo "$usage"; exit ;;
1882+ -- ) # Stop option processing
1883+ shift; break ;;
1884+ - ) # Use stdin as input.
1885+ break ;;
1886+ -* )
1887+ echo "$me: invalid option $1$help" >&2
1888+ exit 1 ;;
1889+ * )
1890+ break ;;
1891+ esac
1892+done
1893+
1894+if test $# != 0; then
1895+ echo "$me: too many arguments$help" >&2
1896+ exit 1
1897+fi
1898+
1899+trap 'exit 1' 1 2 15
1900+
1901+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
1902+# compiler to aid in system detection is discouraged as it requires
1903+# temporary files to be created and, as you can see below, it is a
1904+# headache to deal with in a portable fashion.
1905+
1906+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
1907+# use `HOST_CC' if defined, but it is deprecated.
1908+
1909+# Portable tmp directory creation inspired by the Autoconf team.
1910+
1911+set_cc_for_build='
1912+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
1913+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
1914+: ${TMPDIR=/tmp} ;
1915+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
1916+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
1917+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
1918+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
1919+dummy=$tmp/dummy ;
1920+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
1921+case $CC_FOR_BUILD,$HOST_CC,$CC in
1922+ ,,) echo "int x;" > $dummy.c ;
1923+ for c in cc gcc c89 c99 ; do
1924+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
1925+ CC_FOR_BUILD="$c"; break ;
1926+ fi ;
1927+ done ;
1928+ if test x"$CC_FOR_BUILD" = x ; then
1929+ CC_FOR_BUILD=no_compiler_found ;
1930+ fi
1931+ ;;
1932+ ,,*) CC_FOR_BUILD=$CC ;;
1933+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
1934+esac ; set_cc_for_build= ;'
1935+
1936+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
1937+# (ghazi@noc.rutgers.edu 1994-08-24)
1938+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
1939+ PATH=$PATH:/.attbin ; export PATH
1940+fi
1941+
1942+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
1943+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
1944+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
1945+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
1946+
1947+case "${UNAME_SYSTEM}" in
1948+Linux|GNU|GNU/*)
1949+ # If the system lacks a compiler, then just pick glibc.
1950+ # We could probably try harder.
1951+ LIBC=gnu
1952+
1953+ eval $set_cc_for_build
1954+ cat <<-EOF > $dummy.c
1955+ #include <features.h>
1956+ #if defined(__UCLIBC__)
1957+ LIBC=uclibc
1958+ #elif defined(__dietlibc__)
1959+ LIBC=dietlibc
1960+ #else
1961+ LIBC=gnu
1962+ #endif
1963+ EOF
1964+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
1965+ ;;
1966+esac
1967+
1968+# Note: order is significant - the case branches are not exclusive.
1969+
1970+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
1971+ *:NetBSD:*:*)
1972+ # NetBSD (nbsd) targets should (where applicable) match one or
1973+ # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
1974+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
1975+ # switched to ELF, *-*-netbsd* would select the old
1976+ # object file format. This provides both forward
1977+ # compatibility and a consistent mechanism for selecting the
1978+ # object file format.
1979+ #
1980+ # Note: NetBSD doesn't particularly care about the vendor
1981+ # portion of the name. We always set it to "unknown".
1982+ sysctl="sysctl -n hw.machine_arch"
1983+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
1984+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
1985+ case "${UNAME_MACHINE_ARCH}" in
1986+ armeb) machine=armeb-unknown ;;
1987+ arm*) machine=arm-unknown ;;
1988+ sh3el) machine=shl-unknown ;;
1989+ sh3eb) machine=sh-unknown ;;
1990+ sh5el) machine=sh5le-unknown ;;
1991+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
1992+ esac
1993+ # The Operating System including object format, if it has switched
1994+ # to ELF recently, or will in the future.
1995+ case "${UNAME_MACHINE_ARCH}" in
1996+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
1997+ eval $set_cc_for_build
1998+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
1999+ | grep -q __ELF__
2000+ then
2001+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
2002+ # Return netbsd for either. FIX?
2003+ os=netbsd
2004+ else
2005+ os=netbsdelf
2006+ fi
2007+ ;;
2008+ *)
2009+ os=netbsd
2010+ ;;
2011+ esac
2012+ # The OS release
2013+ # Debian GNU/NetBSD machines have a different userland, and
2014+ # thus, need a distinct triplet. However, they do not need
2015+ # kernel version information, so it can be replaced with a
2016+ # suitable tag, in the style of linux-gnu.
2017+ case "${UNAME_VERSION}" in
2018+ Debian*)
2019+ release='-gnu'
2020+ ;;
2021+ *)
2022+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
2023+ ;;
2024+ esac
2025+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
2026+ # contains redundant information, the shorter form:
2027+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
2028+ echo "${machine}-${os}${release}"
2029+ exit ;;
2030+ *:Bitrig:*:*)
2031+ UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
2032+ echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
2033+ exit ;;
2034+ *:OpenBSD:*:*)
2035+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
2036+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
2037+ exit ;;
2038+ *:ekkoBSD:*:*)
2039+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
2040+ exit ;;
2041+ *:SolidBSD:*:*)
2042+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
2043+ exit ;;
2044+ macppc:MirBSD:*:*)
2045+ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
2046+ exit ;;
2047+ *:MirBSD:*:*)
2048+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
2049+ exit ;;
2050+ alpha:OSF1:*:*)
2051+ case $UNAME_RELEASE in
2052+ *4.0)
2053+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
2054+ ;;
2055+ *5.*)
2056+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
2057+ ;;
2058+ esac
2059+ # According to Compaq, /usr/sbin/psrinfo has been available on
2060+ # OSF/1 and Tru64 systems produced since 1995. I hope that
2061+ # covers most systems running today. This code pipes the CPU
2062+ # types through head -n 1, so we only detect the type of CPU 0.
2063+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
2064+ case "$ALPHA_CPU_TYPE" in
2065+ "EV4 (21064)")
2066+ UNAME_MACHINE="alpha" ;;
2067+ "EV4.5 (21064)")
2068+ UNAME_MACHINE="alpha" ;;
2069+ "LCA4 (21066/21068)")
2070+ UNAME_MACHINE="alpha" ;;
2071+ "EV5 (21164)")
2072+ UNAME_MACHINE="alphaev5" ;;
2073+ "EV5.6 (21164A)")
2074+ UNAME_MACHINE="alphaev56" ;;
2075+ "EV5.6 (21164PC)")
2076+ UNAME_MACHINE="alphapca56" ;;
2077+ "EV5.7 (21164PC)")
2078+ UNAME_MACHINE="alphapca57" ;;
2079+ "EV6 (21264)")
2080+ UNAME_MACHINE="alphaev6" ;;
2081+ "EV6.7 (21264A)")
2082+ UNAME_MACHINE="alphaev67" ;;
2083+ "EV6.8CB (21264C)")
2084+ UNAME_MACHINE="alphaev68" ;;
2085+ "EV6.8AL (21264B)")
2086+ UNAME_MACHINE="alphaev68" ;;
2087+ "EV6.8CX (21264D)")
2088+ UNAME_MACHINE="alphaev68" ;;
2089+ "EV6.9A (21264/EV69A)")
2090+ UNAME_MACHINE="alphaev69" ;;
2091+ "EV7 (21364)")
2092+ UNAME_MACHINE="alphaev7" ;;
2093+ "EV7.9 (21364A)")
2094+ UNAME_MACHINE="alphaev79" ;;
2095+ esac
2096+ # A Pn.n version is a patched version.
2097+ # A Vn.n version is a released version.
2098+ # A Tn.n version is a released field test version.
2099+ # A Xn.n version is an unreleased experimental baselevel.
2100+ # 1.2 uses "1.2" for uname -r.
2101+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
2102+ # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
2103+ exitcode=$?
2104+ trap '' 0
2105+ exit $exitcode ;;
2106+ Alpha\ *:Windows_NT*:*)
2107+ # How do we know it's Interix rather than the generic POSIX subsystem?
2108+ # Should we change UNAME_MACHINE based on the output of uname instead
2109+ # of the specific Alpha model?
2110+ echo alpha-pc-interix
2111+ exit ;;
2112+ 21064:Windows_NT:50:3)
2113+ echo alpha-dec-winnt3.5
2114+ exit ;;
2115+ Amiga*:UNIX_System_V:4.0:*)
2116+ echo m68k-unknown-sysv4
2117+ exit ;;
2118+ *:[Aa]miga[Oo][Ss]:*:*)
2119+ echo ${UNAME_MACHINE}-unknown-amigaos
2120+ exit ;;
2121+ *:[Mm]orph[Oo][Ss]:*:*)
2122+ echo ${UNAME_MACHINE}-unknown-morphos
2123+ exit ;;
2124+ *:OS/390:*:*)
2125+ echo i370-ibm-openedition
2126+ exit ;;
2127+ *:z/VM:*:*)
2128+ echo s390-ibm-zvmoe
2129+ exit ;;
2130+ *:OS400:*:*)
2131+ echo powerpc-ibm-os400
2132+ exit ;;
2133+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
2134+ echo arm-acorn-riscix${UNAME_RELEASE}
2135+ exit ;;
2136+ arm*:riscos:*:*|arm*:RISCOS:*:*)
2137+ echo arm-unknown-riscos
2138+ exit ;;
2139+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
2140+ echo hppa1.1-hitachi-hiuxmpp
2141+ exit ;;
2142+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
2143+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
2144+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
2145+ echo pyramid-pyramid-sysv3
2146+ else
2147+ echo pyramid-pyramid-bsd
2148+ fi
2149+ exit ;;
2150+ NILE*:*:*:dcosx)
2151+ echo pyramid-pyramid-svr4
2152+ exit ;;
2153+ DRS?6000:unix:4.0:6*)
2154+ echo sparc-icl-nx6
2155+ exit ;;
2156+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
2157+ case `/usr/bin/uname -p` in
2158+ sparc) echo sparc-icl-nx7; exit ;;
2159+ esac ;;
2160+ s390x:SunOS:*:*)
2161+ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
2162+ exit ;;
2163+ sun4H:SunOS:5.*:*)
2164+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
2165+ exit ;;
2166+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
2167+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
2168+ exit ;;
2169+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
2170+ echo i386-pc-auroraux${UNAME_RELEASE}
2171+ exit ;;
2172+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
2173+ eval $set_cc_for_build
2174+ SUN_ARCH="i386"
2175+ # If there is a compiler, see if it is configured for 64-bit objects.
2176+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
2177+ # This test works for both compilers.
2178+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
2179+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
2180+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
2181+ grep IS_64BIT_ARCH >/dev/null
2182+ then
2183+ SUN_ARCH="x86_64"
2184+ fi
2185+ fi
2186+ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
2187+ exit ;;
2188+ sun4*:SunOS:6*:*)
2189+ # According to config.sub, this is the proper way to canonicalize
2190+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
2191+ # it's likely to be more like Solaris than SunOS4.
2192+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
2193+ exit ;;
2194+ sun4*:SunOS:*:*)
2195+ case "`/usr/bin/arch -k`" in
2196+ Series*|S4*)
2197+ UNAME_RELEASE=`uname -v`
2198+ ;;
2199+ esac
2200+ # Japanese Language versions have a version number like `4.1.3-JL'.
2201+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
2202+ exit ;;
2203+ sun3*:SunOS:*:*)
2204+ echo m68k-sun-sunos${UNAME_RELEASE}
2205+ exit ;;
2206+ sun*:*:4.2BSD:*)
2207+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
2208+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
2209+ case "`/bin/arch`" in
2210+ sun3)
2211+ echo m68k-sun-sunos${UNAME_RELEASE}
2212+ ;;
2213+ sun4)
2214+ echo sparc-sun-sunos${UNAME_RELEASE}
2215+ ;;
2216+ esac
2217+ exit ;;
2218+ aushp:SunOS:*:*)
2219+ echo sparc-auspex-sunos${UNAME_RELEASE}
2220+ exit ;;
2221+ # The situation for MiNT is a little confusing. The machine name
2222+ # can be virtually everything (everything which is not
2223+ # "atarist" or "atariste" at least should have a processor
2224+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
2225+ # to the lowercase version "mint" (or "freemint"). Finally
2226+ # the system name "TOS" denotes a system which is actually not
2227+ # MiNT. But MiNT is downward compatible to TOS, so this should
2228+ # be no problem.
2229+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
2230+ echo m68k-atari-mint${UNAME_RELEASE}
2231+ exit ;;
2232+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
2233+ echo m68k-atari-mint${UNAME_RELEASE}
2234+ exit ;;
2235+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
2236+ echo m68k-atari-mint${UNAME_RELEASE}
2237+ exit ;;
2238+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
2239+ echo m68k-milan-mint${UNAME_RELEASE}
2240+ exit ;;
2241+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
2242+ echo m68k-hades-mint${UNAME_RELEASE}
2243+ exit ;;
2244+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
2245+ echo m68k-unknown-mint${UNAME_RELEASE}
2246+ exit ;;
2247+ m68k:machten:*:*)
2248+ echo m68k-apple-machten${UNAME_RELEASE}
2249+ exit ;;
2250+ powerpc:machten:*:*)
2251+ echo powerpc-apple-machten${UNAME_RELEASE}
2252+ exit ;;
2253+ RISC*:Mach:*:*)
2254+ echo mips-dec-mach_bsd4.3
2255+ exit ;;
2256+ RISC*:ULTRIX:*:*)
2257+ echo mips-dec-ultrix${UNAME_RELEASE}
2258+ exit ;;
2259+ VAX*:ULTRIX*:*:*)
2260+ echo vax-dec-ultrix${UNAME_RELEASE}
2261+ exit ;;
2262+ 2020:CLIX:*:* | 2430:CLIX:*:*)
2263+ echo clipper-intergraph-clix${UNAME_RELEASE}
2264+ exit ;;
2265+ mips:*:*:UMIPS | mips:*:*:RISCos)
2266+ eval $set_cc_for_build
2267+ sed 's/^ //' << EOF >$dummy.c
2268+#ifdef __cplusplus
2269+#include <stdio.h> /* for printf() prototype */
2270+ int main (int argc, char *argv[]) {
2271+#else
2272+ int main (argc, argv) int argc; char *argv[]; {
2273+#endif
2274+ #if defined (host_mips) && defined (MIPSEB)
2275+ #if defined (SYSTYPE_SYSV)
2276+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
2277+ #endif
2278+ #if defined (SYSTYPE_SVR4)
2279+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
2280+ #endif
2281+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
2282+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
2283+ #endif
2284+ #endif
2285+ exit (-1);
2286+ }
2287+EOF
2288+ $CC_FOR_BUILD -o $dummy $dummy.c &&
2289+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
2290+ SYSTEM_NAME=`$dummy $dummyarg` &&
2291+ { echo "$SYSTEM_NAME"; exit; }
2292+ echo mips-mips-riscos${UNAME_RELEASE}
2293+ exit ;;
2294+ Motorola:PowerMAX_OS:*:*)
2295+ echo powerpc-motorola-powermax
2296+ exit ;;
2297+ Motorola:*:4.3:PL8-*)
2298+ echo powerpc-harris-powermax
2299+ exit ;;
2300+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
2301+ echo powerpc-harris-powermax
2302+ exit ;;
2303+ Night_Hawk:Power_UNIX:*:*)
2304+ echo powerpc-harris-powerunix
2305+ exit ;;
2306+ m88k:CX/UX:7*:*)
2307+ echo m88k-harris-cxux7
2308+ exit ;;
2309+ m88k:*:4*:R4*)
2310+ echo m88k-motorola-sysv4
2311+ exit ;;
2312+ m88k:*:3*:R3*)
2313+ echo m88k-motorola-sysv3
2314+ exit ;;
2315+ AViiON:dgux:*:*)
2316+ # DG/UX returns AViiON for all architectures
2317+ UNAME_PROCESSOR=`/usr/bin/uname -p`
2318+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
2319+ then
2320+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
2321+ [ ${TARGET_BINARY_INTERFACE}x = x ]
2322+ then
2323+ echo m88k-dg-dgux${UNAME_RELEASE}
2324+ else
2325+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
2326+ fi
2327+ else
2328+ echo i586-dg-dgux${UNAME_RELEASE}
2329+ fi
2330+ exit ;;
2331+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
2332+ echo m88k-dolphin-sysv3
2333+ exit ;;
2334+ M88*:*:R3*:*)
2335+ # Delta 88k system running SVR3
2336+ echo m88k-motorola-sysv3
2337+ exit ;;
2338+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
2339+ echo m88k-tektronix-sysv3
2340+ exit ;;
2341+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
2342+ echo m68k-tektronix-bsd
2343+ exit ;;
2344+ *:IRIX*:*:*)
2345+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
2346+ exit ;;
2347+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
2348+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
2349+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
2350+ i*86:AIX:*:*)
2351+ echo i386-ibm-aix
2352+ exit ;;
2353+ ia64:AIX:*:*)
2354+ if [ -x /usr/bin/oslevel ] ; then
2355+ IBM_REV=`/usr/bin/oslevel`
2356+ else
2357+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
2358+ fi
2359+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
2360+ exit ;;
2361+ *:AIX:2:3)
2362+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
2363+ eval $set_cc_for_build
2364+ sed 's/^ //' << EOF >$dummy.c
2365+ #include <sys/systemcfg.h>
2366+
2367+ main()
2368+ {
2369+ if (!__power_pc())
2370+ exit(1);
2371+ puts("powerpc-ibm-aix3.2.5");
2372+ exit(0);
2373+ }
2374+EOF
2375+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
2376+ then
2377+ echo "$SYSTEM_NAME"
2378+ else
2379+ echo rs6000-ibm-aix3.2.5
2380+ fi
2381+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
2382+ echo rs6000-ibm-aix3.2.4
2383+ else
2384+ echo rs6000-ibm-aix3.2
2385+ fi
2386+ exit ;;
2387+ *:AIX:*:[4567])
2388+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
2389+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
2390+ IBM_ARCH=rs6000
2391+ else
2392+ IBM_ARCH=powerpc
2393+ fi
2394+ if [ -x /usr/bin/oslevel ] ; then
2395+ IBM_REV=`/usr/bin/oslevel`
2396+ else
2397+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
2398+ fi
2399+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
2400+ exit ;;
2401+ *:AIX:*:*)
2402+ echo rs6000-ibm-aix
2403+ exit ;;
2404+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
2405+ echo romp-ibm-bsd4.4
2406+ exit ;;
2407+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
2408+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
2409+ exit ;; # report: romp-ibm BSD 4.3
2410+ *:BOSX:*:*)
2411+ echo rs6000-bull-bosx
2412+ exit ;;
2413+ DPX/2?00:B.O.S.:*:*)
2414+ echo m68k-bull-sysv3
2415+ exit ;;
2416+ 9000/[34]??:4.3bsd:1.*:*)
2417+ echo m68k-hp-bsd
2418+ exit ;;
2419+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
2420+ echo m68k-hp-bsd4.4
2421+ exit ;;
2422+ 9000/[34678]??:HP-UX:*:*)
2423+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
2424+ case "${UNAME_MACHINE}" in
2425+ 9000/31? ) HP_ARCH=m68000 ;;
2426+ 9000/[34]?? ) HP_ARCH=m68k ;;
2427+ 9000/[678][0-9][0-9])
2428+ if [ -x /usr/bin/getconf ]; then
2429+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
2430+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
2431+ case "${sc_cpu_version}" in
2432+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
2433+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
2434+ 532) # CPU_PA_RISC2_0
2435+ case "${sc_kernel_bits}" in
2436+ 32) HP_ARCH="hppa2.0n" ;;
2437+ 64) HP_ARCH="hppa2.0w" ;;
2438+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
2439+ esac ;;
2440+ esac
2441+ fi
2442+ if [ "${HP_ARCH}" = "" ]; then
2443+ eval $set_cc_for_build
2444+ sed 's/^ //' << EOF >$dummy.c
2445+
2446+ #define _HPUX_SOURCE
2447+ #include <stdlib.h>
2448+ #include <unistd.h>
2449+
2450+ int main ()
2451+ {
2452+ #if defined(_SC_KERNEL_BITS)
2453+ long bits = sysconf(_SC_KERNEL_BITS);
2454+ #endif
2455+ long cpu = sysconf (_SC_CPU_VERSION);
2456+
2457+ switch (cpu)
2458+ {
2459+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
2460+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
2461+ case CPU_PA_RISC2_0:
2462+ #if defined(_SC_KERNEL_BITS)
2463+ switch (bits)
2464+ {
2465+ case 64: puts ("hppa2.0w"); break;
2466+ case 32: puts ("hppa2.0n"); break;
2467+ default: puts ("hppa2.0"); break;
2468+ } break;
2469+ #else /* !defined(_SC_KERNEL_BITS) */
2470+ puts ("hppa2.0"); break;
2471+ #endif
2472+ default: puts ("hppa1.0"); break;
2473+ }
2474+ exit (0);
2475+ }
2476+EOF
2477+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
2478+ test -z "$HP_ARCH" && HP_ARCH=hppa
2479+ fi ;;
2480+ esac
2481+ if [ ${HP_ARCH} = "hppa2.0w" ]
2482+ then
2483+ eval $set_cc_for_build
2484+
2485+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
2486+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
2487+ # generating 64-bit code. GNU and HP use different nomenclature:
2488+ #
2489+ # $ CC_FOR_BUILD=cc ./config.guess
2490+ # => hppa2.0w-hp-hpux11.23
2491+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
2492+ # => hppa64-hp-hpux11.23
2493+
2494+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
2495+ grep -q __LP64__
2496+ then
2497+ HP_ARCH="hppa2.0w"
2498+ else
2499+ HP_ARCH="hppa64"
2500+ fi
2501+ fi
2502+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
2503+ exit ;;
2504+ ia64:HP-UX:*:*)
2505+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
2506+ echo ia64-hp-hpux${HPUX_REV}
2507+ exit ;;
2508+ 3050*:HI-UX:*:*)
2509+ eval $set_cc_for_build
2510+ sed 's/^ //' << EOF >$dummy.c
2511+ #include <unistd.h>
2512+ int
2513+ main ()
2514+ {
2515+ long cpu = sysconf (_SC_CPU_VERSION);
2516+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
2517+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
2518+ results, however. */
2519+ if (CPU_IS_PA_RISC (cpu))
2520+ {
2521+ switch (cpu)
2522+ {
2523+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
2524+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
2525+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
2526+ default: puts ("hppa-hitachi-hiuxwe2"); break;
2527+ }
2528+ }
2529+ else if (CPU_IS_HP_MC68K (cpu))
2530+ puts ("m68k-hitachi-hiuxwe2");
2531+ else puts ("unknown-hitachi-hiuxwe2");
2532+ exit (0);
2533+ }
2534+EOF
2535+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
2536+ { echo "$SYSTEM_NAME"; exit; }
2537+ echo unknown-hitachi-hiuxwe2
2538+ exit ;;
2539+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
2540+ echo hppa1.1-hp-bsd
2541+ exit ;;
2542+ 9000/8??:4.3bsd:*:*)
2543+ echo hppa1.0-hp-bsd
2544+ exit ;;
2545+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
2546+ echo hppa1.0-hp-mpeix
2547+ exit ;;
2548+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
2549+ echo hppa1.1-hp-osf
2550+ exit ;;
2551+ hp8??:OSF1:*:*)
2552+ echo hppa1.0-hp-osf
2553+ exit ;;
2554+ i*86:OSF1:*:*)
2555+ if [ -x /usr/sbin/sysversion ] ; then
2556+ echo ${UNAME_MACHINE}-unknown-osf1mk
2557+ else
2558+ echo ${UNAME_MACHINE}-unknown-osf1
2559+ fi
2560+ exit ;;
2561+ parisc*:Lites*:*:*)
2562+ echo hppa1.1-hp-lites
2563+ exit ;;
2564+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
2565+ echo c1-convex-bsd
2566+ exit ;;
2567+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
2568+ if getsysinfo -f scalar_acc
2569+ then echo c32-convex-bsd
2570+ else echo c2-convex-bsd
2571+ fi
2572+ exit ;;
2573+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
2574+ echo c34-convex-bsd
2575+ exit ;;
2576+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
2577+ echo c38-convex-bsd
2578+ exit ;;
2579+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
2580+ echo c4-convex-bsd
2581+ exit ;;
2582+ CRAY*Y-MP:*:*:*)
2583+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
2584+ exit ;;
2585+ CRAY*[A-Z]90:*:*:*)
2586+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
2587+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
2588+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
2589+ -e 's/\.[^.]*$/.X/'
2590+ exit ;;
2591+ CRAY*TS:*:*:*)
2592+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
2593+ exit ;;
2594+ CRAY*T3E:*:*:*)
2595+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
2596+ exit ;;
2597+ CRAY*SV1:*:*:*)
2598+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
2599+ exit ;;
2600+ *:UNICOS/mp:*:*)
2601+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
2602+ exit ;;
2603+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
2604+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
2605+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
2606+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
2607+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
2608+ exit ;;
2609+ 5000:UNIX_System_V:4.*:*)
2610+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
2611+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
2612+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
2613+ exit ;;
2614+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
2615+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
2616+ exit ;;
2617+ sparc*:BSD/OS:*:*)
2618+ echo sparc-unknown-bsdi${UNAME_RELEASE}
2619+ exit ;;
2620+ *:BSD/OS:*:*)
2621+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
2622+ exit ;;
2623+ *:FreeBSD:*:*)
2624+ UNAME_PROCESSOR=`/usr/bin/uname -p`
2625+ case ${UNAME_PROCESSOR} in
2626+ amd64)
2627+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
2628+ *)
2629+ echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
2630+ esac
2631+ exit ;;
2632+ i*:CYGWIN*:*)
2633+ echo ${UNAME_MACHINE}-pc-cygwin
2634+ exit ;;
2635+ *:MINGW64*:*)
2636+ echo ${UNAME_MACHINE}-pc-mingw64
2637+ exit ;;
2638+ *:MINGW*:*)
2639+ echo ${UNAME_MACHINE}-pc-mingw32
2640+ exit ;;
2641+ i*:MSYS*:*)
2642+ echo ${UNAME_MACHINE}-pc-msys
2643+ exit ;;
2644+ i*:windows32*:*)
2645+ # uname -m includes "-pc" on this system.
2646+ echo ${UNAME_MACHINE}-mingw32
2647+ exit ;;
2648+ i*:PW*:*)
2649+ echo ${UNAME_MACHINE}-pc-pw32
2650+ exit ;;
2651+ *:Interix*:*)
2652+ case ${UNAME_MACHINE} in
2653+ x86)
2654+ echo i586-pc-interix${UNAME_RELEASE}
2655+ exit ;;
2656+ authenticamd | genuineintel | EM64T)
2657+ echo x86_64-unknown-interix${UNAME_RELEASE}
2658+ exit ;;
2659+ IA64)
2660+ echo ia64-unknown-interix${UNAME_RELEASE}
2661+ exit ;;
2662+ esac ;;
2663+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
2664+ echo i${UNAME_MACHINE}-pc-mks
2665+ exit ;;
2666+ 8664:Windows_NT:*)
2667+ echo x86_64-pc-mks
2668+ exit ;;
2669+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
2670+ # How do we know it's Interix rather than the generic POSIX subsystem?
2671+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
2672+ # UNAME_MACHINE based on the output of uname instead of i386?
2673+ echo i586-pc-interix
2674+ exit ;;
2675+ i*:UWIN*:*)
2676+ echo ${UNAME_MACHINE}-pc-uwin
2677+ exit ;;
2678+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
2679+ echo x86_64-unknown-cygwin
2680+ exit ;;
2681+ p*:CYGWIN*:*)
2682+ echo powerpcle-unknown-cygwin
2683+ exit ;;
2684+ prep*:SunOS:5.*:*)
2685+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
2686+ exit ;;
2687+ *:GNU:*:*)
2688+ # the GNU system
2689+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
2690+ exit ;;
2691+ *:GNU/*:*:*)
2692+ # other systems with GNU libc and userland
2693+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
2694+ exit ;;
2695+ i*86:Minix:*:*)
2696+ echo ${UNAME_MACHINE}-pc-minix
2697+ exit ;;
2698+ aarch64:Linux:*:*)
2699+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2700+ exit ;;
2701+ aarch64_be:Linux:*:*)
2702+ UNAME_MACHINE=aarch64_be
2703+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2704+ exit ;;
2705+ alpha:Linux:*:*)
2706+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
2707+ EV5) UNAME_MACHINE=alphaev5 ;;
2708+ EV56) UNAME_MACHINE=alphaev56 ;;
2709+ PCA56) UNAME_MACHINE=alphapca56 ;;
2710+ PCA57) UNAME_MACHINE=alphapca56 ;;
2711+ EV6) UNAME_MACHINE=alphaev6 ;;
2712+ EV67) UNAME_MACHINE=alphaev67 ;;
2713+ EV68*) UNAME_MACHINE=alphaev68 ;;
2714+ esac
2715+ objdump --private-headers /bin/sh | grep -q ld.so.1
2716+ if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
2717+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2718+ exit ;;
2719+ arc:Linux:*:* | arceb:Linux:*:*)
2720+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2721+ exit ;;
2722+ arm*:Linux:*:*)
2723+ eval $set_cc_for_build
2724+ if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
2725+ | grep -q __ARM_EABI__
2726+ then
2727+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2728+ else
2729+ if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
2730+ | grep -q __ARM_PCS_VFP
2731+ then
2732+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
2733+ else
2734+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
2735+ fi
2736+ fi
2737+ exit ;;
2738+ avr32*:Linux:*:*)
2739+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2740+ exit ;;
2741+ cris:Linux:*:*)
2742+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
2743+ exit ;;
2744+ crisv32:Linux:*:*)
2745+ echo ${UNAME_MACHINE}-axis-linux-${LIBC}
2746+ exit ;;
2747+ frv:Linux:*:*)
2748+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2749+ exit ;;
2750+ hexagon:Linux:*:*)
2751+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2752+ exit ;;
2753+ i*86:Linux:*:*)
2754+ echo ${UNAME_MACHINE}-pc-linux-${LIBC}
2755+ exit ;;
2756+ ia64:Linux:*:*)
2757+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2758+ exit ;;
2759+ m32r*:Linux:*:*)
2760+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2761+ exit ;;
2762+ m68*:Linux:*:*)
2763+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2764+ exit ;;
2765+ mips:Linux:*:* | mips64:Linux:*:*)
2766+ eval $set_cc_for_build
2767+ sed 's/^ //' << EOF >$dummy.c
2768+ #undef CPU
2769+ #undef ${UNAME_MACHINE}
2770+ #undef ${UNAME_MACHINE}el
2771+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
2772+ CPU=${UNAME_MACHINE}el
2773+ #else
2774+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
2775+ CPU=${UNAME_MACHINE}
2776+ #else
2777+ CPU=
2778+ #endif
2779+ #endif
2780+EOF
2781+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
2782+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
2783+ ;;
2784+ or1k:Linux:*:*)
2785+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2786+ exit ;;
2787+ or32:Linux:*:*)
2788+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2789+ exit ;;
2790+ padre:Linux:*:*)
2791+ echo sparc-unknown-linux-${LIBC}
2792+ exit ;;
2793+ parisc64:Linux:*:* | hppa64:Linux:*:*)
2794+ echo hppa64-unknown-linux-${LIBC}
2795+ exit ;;
2796+ parisc:Linux:*:* | hppa:Linux:*:*)
2797+ # Look for CPU level
2798+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
2799+ PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
2800+ PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
2801+ *) echo hppa-unknown-linux-${LIBC} ;;
2802+ esac
2803+ exit ;;
2804+ ppc64:Linux:*:*)
2805+ echo powerpc64-unknown-linux-${LIBC}
2806+ exit ;;
2807+ ppc:Linux:*:*)
2808+ echo powerpc-unknown-linux-${LIBC}
2809+ exit ;;
2810+ ppc64le:Linux:*:*)
2811+ echo powerpc64le-unknown-linux-${LIBC}
2812+ exit ;;
2813+ ppcle:Linux:*:*)
2814+ echo powerpcle-unknown-linux-${LIBC}
2815+ exit ;;
2816+ s390:Linux:*:* | s390x:Linux:*:*)
2817+ echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
2818+ exit ;;
2819+ sh64*:Linux:*:*)
2820+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2821+ exit ;;
2822+ sh*:Linux:*:*)
2823+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2824+ exit ;;
2825+ sparc:Linux:*:* | sparc64:Linux:*:*)
2826+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2827+ exit ;;
2828+ tile*:Linux:*:*)
2829+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2830+ exit ;;
2831+ vax:Linux:*:*)
2832+ echo ${UNAME_MACHINE}-dec-linux-${LIBC}
2833+ exit ;;
2834+ x86_64:Linux:*:*)
2835+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2836+ exit ;;
2837+ xtensa*:Linux:*:*)
2838+ echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
2839+ exit ;;
2840+ i*86:DYNIX/ptx:4*:*)
2841+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
2842+ # earlier versions are messed up and put the nodename in both
2843+ # sysname and nodename.
2844+ echo i386-sequent-sysv4
2845+ exit ;;
2846+ i*86:UNIX_SV:4.2MP:2.*)
2847+ # Unixware is an offshoot of SVR4, but it has its own version
2848+ # number series starting with 2...
2849+ # I am not positive that other SVR4 systems won't match this,
2850+ # I just have to hope. -- rms.
2851+ # Use sysv4.2uw... so that sysv4* matches it.
2852+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
2853+ exit ;;
2854+ i*86:OS/2:*:*)
2855+ # If we were able to find `uname', then EMX Unix compatibility
2856+ # is probably installed.
2857+ echo ${UNAME_MACHINE}-pc-os2-emx
2858+ exit ;;
2859+ i*86:XTS-300:*:STOP)
2860+ echo ${UNAME_MACHINE}-unknown-stop
2861+ exit ;;
2862+ i*86:atheos:*:*)
2863+ echo ${UNAME_MACHINE}-unknown-atheos
2864+ exit ;;
2865+ i*86:syllable:*:*)
2866+ echo ${UNAME_MACHINE}-pc-syllable
2867+ exit ;;
2868+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
2869+ echo i386-unknown-lynxos${UNAME_RELEASE}
2870+ exit ;;
2871+ i*86:*DOS:*:*)
2872+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
2873+ exit ;;
2874+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
2875+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
2876+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
2877+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
2878+ else
2879+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
2880+ fi
2881+ exit ;;
2882+ i*86:*:5:[678]*)
2883+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
2884+ case `/bin/uname -X | grep "^Machine"` in
2885+ *486*) UNAME_MACHINE=i486 ;;
2886+ *Pentium) UNAME_MACHINE=i586 ;;
2887+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
2888+ esac
2889+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
2890+ exit ;;
2891+ i*86:*:3.2:*)
2892+ if test -f /usr/options/cb.name; then
2893+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
2894+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
2895+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
2896+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
2897+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
2898+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
2899+ && UNAME_MACHINE=i586
2900+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
2901+ && UNAME_MACHINE=i686
2902+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
2903+ && UNAME_MACHINE=i686
2904+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
2905+ else
2906+ echo ${UNAME_MACHINE}-pc-sysv32
2907+ fi
2908+ exit ;;
2909+ pc:*:*:*)
2910+ # Left here for compatibility:
2911+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
2912+ # the processor, so we play safe by assuming i586.
2913+ # Note: whatever this is, it MUST be the same as what config.sub
2914+ # prints for the "djgpp" host, or else GDB configury will decide that
2915+ # this is a cross-build.
2916+ echo i586-pc-msdosdjgpp
2917+ exit ;;
2918+ Intel:Mach:3*:*)
2919+ echo i386-pc-mach3
2920+ exit ;;
2921+ paragon:*:*:*)
2922+ echo i860-intel-osf1
2923+ exit ;;
2924+ i860:*:4.*:*) # i860-SVR4
2925+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
2926+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
2927+ else # Add other i860-SVR4 vendors below as they are discovered.
2928+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
2929+ fi
2930+ exit ;;
2931+ mini*:CTIX:SYS*5:*)
2932+ # "miniframe"
2933+ echo m68010-convergent-sysv
2934+ exit ;;
2935+ mc68k:UNIX:SYSTEM5:3.51m)
2936+ echo m68k-convergent-sysv
2937+ exit ;;
2938+ M680?0:D-NIX:5.3:*)
2939+ echo m68k-diab-dnix
2940+ exit ;;
2941+ M68*:*:R3V[5678]*:*)
2942+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
2943+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
2944+ OS_REL=''
2945+ test -r /etc/.relid \
2946+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
2947+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
2948+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
2949+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
2950+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
2951+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
2952+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
2953+ && { echo i486-ncr-sysv4; exit; } ;;
2954+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
2955+ OS_REL='.3'
2956+ test -r /etc/.relid \
2957+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
2958+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
2959+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
2960+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
2961+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
2962+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
2963+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
2964+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
2965+ echo m68k-unknown-lynxos${UNAME_RELEASE}
2966+ exit ;;
2967+ mc68030:UNIX_System_V:4.*:*)
2968+ echo m68k-atari-sysv4
2969+ exit ;;
2970+ TSUNAMI:LynxOS:2.*:*)
2971+ echo sparc-unknown-lynxos${UNAME_RELEASE}
2972+ exit ;;
2973+ rs6000:LynxOS:2.*:*)
2974+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
2975+ exit ;;
2976+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
2977+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
2978+ exit ;;
2979+ SM[BE]S:UNIX_SV:*:*)
2980+ echo mips-dde-sysv${UNAME_RELEASE}
2981+ exit ;;
2982+ RM*:ReliantUNIX-*:*:*)
2983+ echo mips-sni-sysv4
2984+ exit ;;
2985+ RM*:SINIX-*:*:*)
2986+ echo mips-sni-sysv4
2987+ exit ;;
2988+ *:SINIX-*:*:*)
2989+ if uname -p 2>/dev/null >/dev/null ; then
2990+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
2991+ echo ${UNAME_MACHINE}-sni-sysv4
2992+ else
2993+ echo ns32k-sni-sysv
2994+ fi
2995+ exit ;;
2996+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
2997+ # says <Richard.M.Bartel@ccMail.Census.GOV>
2998+ echo i586-unisys-sysv4
2999+ exit ;;
3000+ *:UNIX_System_V:4*:FTX*)
3001+ # From Gerald Hewes <hewes@openmarket.com>.
3002+ # How about differentiating between stratus architectures? -djm
3003+ echo hppa1.1-stratus-sysv4
3004+ exit ;;
3005+ *:*:*:FTX*)
3006+ # From seanf@swdc.stratus.com.
3007+ echo i860-stratus-sysv4
3008+ exit ;;
3009+ i*86:VOS:*:*)
3010+ # From Paul.Green@stratus.com.
3011+ echo ${UNAME_MACHINE}-stratus-vos
3012+ exit ;;
3013+ *:VOS:*:*)
3014+ # From Paul.Green@stratus.com.
3015+ echo hppa1.1-stratus-vos
3016+ exit ;;
3017+ mc68*:A/UX:*:*)
3018+ echo m68k-apple-aux${UNAME_RELEASE}
3019+ exit ;;
3020+ news*:NEWS-OS:6*:*)
3021+ echo mips-sony-newsos6
3022+ exit ;;
3023+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
3024+ if [ -d /usr/nec ]; then
3025+ echo mips-nec-sysv${UNAME_RELEASE}
3026+ else
3027+ echo mips-unknown-sysv${UNAME_RELEASE}
3028+ fi
3029+ exit ;;
3030+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
3031+ echo powerpc-be-beos
3032+ exit ;;
3033+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
3034+ echo powerpc-apple-beos
3035+ exit ;;
3036+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
3037+ echo i586-pc-beos
3038+ exit ;;
3039+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
3040+ echo i586-pc-haiku
3041+ exit ;;
3042+ x86_64:Haiku:*:*)
3043+ echo x86_64-unknown-haiku
3044+ exit ;;
3045+ SX-4:SUPER-UX:*:*)
3046+ echo sx4-nec-superux${UNAME_RELEASE}
3047+ exit ;;
3048+ SX-5:SUPER-UX:*:*)
3049+ echo sx5-nec-superux${UNAME_RELEASE}
3050+ exit ;;
3051+ SX-6:SUPER-UX:*:*)
3052+ echo sx6-nec-superux${UNAME_RELEASE}
3053+ exit ;;
3054+ SX-7:SUPER-UX:*:*)
3055+ echo sx7-nec-superux${UNAME_RELEASE}
3056+ exit ;;
3057+ SX-8:SUPER-UX:*:*)
3058+ echo sx8-nec-superux${UNAME_RELEASE}
3059+ exit ;;
3060+ SX-8R:SUPER-UX:*:*)
3061+ echo sx8r-nec-superux${UNAME_RELEASE}
3062+ exit ;;
3063+ Power*:Rhapsody:*:*)
3064+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
3065+ exit ;;
3066+ *:Rhapsody:*:*)
3067+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
3068+ exit ;;
3069+ *:Darwin:*:*)
3070+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
3071+ eval $set_cc_for_build
3072+ if test "$UNAME_PROCESSOR" = unknown ; then
3073+ UNAME_PROCESSOR=powerpc
3074+ fi
3075+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
3076+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
3077+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
3078+ grep IS_64BIT_ARCH >/dev/null
3079+ then
3080+ case $UNAME_PROCESSOR in
3081+ i386) UNAME_PROCESSOR=x86_64 ;;
3082+ powerpc) UNAME_PROCESSOR=powerpc64 ;;
3083+ esac
3084+ fi
3085+ fi
3086+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
3087+ exit ;;
3088+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
3089+ UNAME_PROCESSOR=`uname -p`
3090+ if test "$UNAME_PROCESSOR" = "x86"; then
3091+ UNAME_PROCESSOR=i386
3092+ UNAME_MACHINE=pc
3093+ fi
3094+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
3095+ exit ;;
3096+ *:QNX:*:4*)
3097+ echo i386-pc-qnx
3098+ exit ;;
3099+ NEO-?:NONSTOP_KERNEL:*:*)
3100+ echo neo-tandem-nsk${UNAME_RELEASE}
3101+ exit ;;
3102+ NSE-*:NONSTOP_KERNEL:*:*)
3103+ echo nse-tandem-nsk${UNAME_RELEASE}
3104+ exit ;;
3105+ NSR-?:NONSTOP_KERNEL:*:*)
3106+ echo nsr-tandem-nsk${UNAME_RELEASE}
3107+ exit ;;
3108+ *:NonStop-UX:*:*)
3109+ echo mips-compaq-nonstopux
3110+ exit ;;
3111+ BS2000:POSIX*:*:*)
3112+ echo bs2000-siemens-sysv
3113+ exit ;;
3114+ DS/*:UNIX_System_V:*:*)
3115+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
3116+ exit ;;
3117+ *:Plan9:*:*)
3118+ # "uname -m" is not consistent, so use $cputype instead. 386
3119+ # is converted to i386 for consistency with other x86
3120+ # operating systems.
3121+ if test "$cputype" = "386"; then
3122+ UNAME_MACHINE=i386
3123+ else
3124+ UNAME_MACHINE="$cputype"
3125+ fi
3126+ echo ${UNAME_MACHINE}-unknown-plan9
3127+ exit ;;
3128+ *:TOPS-10:*:*)
3129+ echo pdp10-unknown-tops10
3130+ exit ;;
3131+ *:TENEX:*:*)
3132+ echo pdp10-unknown-tenex
3133+ exit ;;
3134+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
3135+ echo pdp10-dec-tops20
3136+ exit ;;
3137+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
3138+ echo pdp10-xkl-tops20
3139+ exit ;;
3140+ *:TOPS-20:*:*)
3141+ echo pdp10-unknown-tops20
3142+ exit ;;
3143+ *:ITS:*:*)
3144+ echo pdp10-unknown-its
3145+ exit ;;
3146+ SEI:*:*:SEIUX)
3147+ echo mips-sei-seiux${UNAME_RELEASE}
3148+ exit ;;
3149+ *:DragonFly:*:*)
3150+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
3151+ exit ;;
3152+ *:*VMS:*:*)
3153+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
3154+ case "${UNAME_MACHINE}" in
3155+ A*) echo alpha-dec-vms ; exit ;;
3156+ I*) echo ia64-dec-vms ; exit ;;
3157+ V*) echo vax-dec-vms ; exit ;;
3158+ esac ;;
3159+ *:XENIX:*:SysV)
3160+ echo i386-pc-xenix
3161+ exit ;;
3162+ i*86:skyos:*:*)
3163+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
3164+ exit ;;
3165+ i*86:rdos:*:*)
3166+ echo ${UNAME_MACHINE}-pc-rdos
3167+ exit ;;
3168+ i*86:AROS:*:*)
3169+ echo ${UNAME_MACHINE}-pc-aros
3170+ exit ;;
3171+ x86_64:VMkernel:*:*)
3172+ echo ${UNAME_MACHINE}-unknown-esx
3173+ exit ;;
3174+esac
3175+
3176+eval $set_cc_for_build
3177+cat >$dummy.c <<EOF
3178+#ifdef _SEQUENT_
3179+# include <sys/types.h>
3180+# include <sys/utsname.h>
3181+#endif
3182+main ()
3183+{
3184+#if defined (sony)
3185+#if defined (MIPSEB)
3186+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
3187+ I don't know.... */
3188+ printf ("mips-sony-bsd\n"); exit (0);
3189+#else
3190+#include <sys/param.h>
3191+ printf ("m68k-sony-newsos%s\n",
3192+#ifdef NEWSOS4
3193+ "4"
3194+#else
3195+ ""
3196+#endif
3197+ ); exit (0);
3198+#endif
3199+#endif
3200+
3201+#if defined (__arm) && defined (__acorn) && defined (__unix)
3202+ printf ("arm-acorn-riscix\n"); exit (0);
3203+#endif
3204+
3205+#if defined (hp300) && !defined (hpux)
3206+ printf ("m68k-hp-bsd\n"); exit (0);
3207+#endif
3208+
3209+#if defined (NeXT)
3210+#if !defined (__ARCHITECTURE__)
3211+#define __ARCHITECTURE__ "m68k"
3212+#endif
3213+ int version;
3214+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
3215+ if (version < 4)
3216+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
3217+ else
3218+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
3219+ exit (0);
3220+#endif
3221+
3222+#if defined (MULTIMAX) || defined (n16)
3223+#if defined (UMAXV)
3224+ printf ("ns32k-encore-sysv\n"); exit (0);
3225+#else
3226+#if defined (CMU)
3227+ printf ("ns32k-encore-mach\n"); exit (0);
3228+#else
3229+ printf ("ns32k-encore-bsd\n"); exit (0);
3230+#endif
3231+#endif
3232+#endif
3233+
3234+#if defined (__386BSD__)
3235+ printf ("i386-pc-bsd\n"); exit (0);
3236+#endif
3237+
3238+#if defined (sequent)
3239+#if defined (i386)
3240+ printf ("i386-sequent-dynix\n"); exit (0);
3241+#endif
3242+#if defined (ns32000)
3243+ printf ("ns32k-sequent-dynix\n"); exit (0);
3244+#endif
3245+#endif
3246+
3247+#if defined (_SEQUENT_)
3248+ struct utsname un;
3249+
3250+ uname(&un);
3251+
3252+ if (strncmp(un.version, "V2", 2) == 0) {
3253+ printf ("i386-sequent-ptx2\n"); exit (0);
3254+ }
3255+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
3256+ printf ("i386-sequent-ptx1\n"); exit (0);
3257+ }
3258+ printf ("i386-sequent-ptx\n"); exit (0);
3259+
3260+#endif
3261+
3262+#if defined (vax)
3263+# if !defined (ultrix)
3264+# include <sys/param.h>
3265+# if defined (BSD)
3266+# if BSD == 43
3267+ printf ("vax-dec-bsd4.3\n"); exit (0);
3268+# else
3269+# if BSD == 199006
3270+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
3271+# else
3272+ printf ("vax-dec-bsd\n"); exit (0);
3273+# endif
3274+# endif
3275+# else
3276+ printf ("vax-dec-bsd\n"); exit (0);
3277+# endif
3278+# else
3279+ printf ("vax-dec-ultrix\n"); exit (0);
3280+# endif
3281+#endif
3282+
3283+#if defined (alliant) && defined (i860)
3284+ printf ("i860-alliant-bsd\n"); exit (0);
3285+#endif
3286+
3287+ exit (1);
3288+}
3289+EOF
3290+
3291+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
3292+ { echo "$SYSTEM_NAME"; exit; }
3293+
3294+# Apollos put the system type in the environment.
3295+
3296+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
3297+
3298+# Convex versions that predate uname can use getsysinfo(1)
3299+
3300+if [ -x /usr/convex/getsysinfo ]
3301+then
3302+ case `getsysinfo -f cpu_type` in
3303+ c1*)
3304+ echo c1-convex-bsd
3305+ exit ;;
3306+ c2*)
3307+ if getsysinfo -f scalar_acc
3308+ then echo c32-convex-bsd
3309+ else echo c2-convex-bsd
3310+ fi
3311+ exit ;;
3312+ c34*)
3313+ echo c34-convex-bsd
3314+ exit ;;
3315+ c38*)
3316+ echo c38-convex-bsd
3317+ exit ;;
3318+ c4*)
3319+ echo c4-convex-bsd
3320+ exit ;;
3321+ esac
3322+fi
3323+
3324+cat >&2 <<EOF
3325+$0: unable to guess system type
3326+
3327+This script, last modified $timestamp, has failed to recognize
3328+the operating system you are using. It is advised that you
3329+download the most up to date version of the config scripts from
3330+
3331+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
3332+and
3333+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
3334+
3335+If the version you run ($0) is already up to date, please
3336+send the following data and any information you think might be
3337+pertinent to <config-patches@gnu.org> in order to provide the needed
3338+information to handle your system.
3339+
3340+config.guess timestamp = $timestamp
3341+
3342+uname -m = `(uname -m) 2>/dev/null || echo unknown`
3343+uname -r = `(uname -r) 2>/dev/null || echo unknown`
3344+uname -s = `(uname -s) 2>/dev/null || echo unknown`
3345+uname -v = `(uname -v) 2>/dev/null || echo unknown`
3346+
3347+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
3348+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
3349+
3350+hostinfo = `(hostinfo) 2>/dev/null`
3351+/bin/universe = `(/bin/universe) 2>/dev/null`
3352+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
3353+/bin/arch = `(/bin/arch) 2>/dev/null`
3354+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
3355+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
3356+
3357+UNAME_MACHINE = ${UNAME_MACHINE}
3358+UNAME_RELEASE = ${UNAME_RELEASE}
3359+UNAME_SYSTEM = ${UNAME_SYSTEM}
3360+UNAME_VERSION = ${UNAME_VERSION}
3361+EOF
3362+
3363+exit 1
3364+
3365+# Local variables:
3366+# eval: (add-hook 'write-file-hooks 'time-stamp)
3367+# time-stamp-start: "timestamp='"
3368+# time-stamp-format: "%:y-%02m-%02d"
3369+# time-stamp-end: "'"
3370+# End:
3371
3372=== added file 'config/config.sub'
3373--- config/config.sub 1970-01-01 00:00:00 +0000
3374+++ config/config.sub 2017-04-13 17:33:55 +0000
3375@@ -0,0 +1,1791 @@
3376+#! /bin/sh
3377+# Configuration validation subroutine script.
3378+# Copyright 1992-2013 Free Software Foundation, Inc.
3379+
3380+timestamp='2013-08-10'
3381+
3382+# This file is free software; you can redistribute it and/or modify it
3383+# under the terms of the GNU General Public License as published by
3384+# the Free Software Foundation; either version 3 of the License, or
3385+# (at your option) any later version.
3386+#
3387+# This program is distributed in the hope that it will be useful, but
3388+# WITHOUT ANY WARRANTY; without even the implied warranty of
3389+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3390+# General Public License for more details.
3391+#
3392+# You should have received a copy of the GNU General Public License
3393+# along with this program; if not, see <http://www.gnu.org/licenses/>.
3394+#
3395+# As a special exception to the GNU General Public License, if you
3396+# distribute this file as part of a program that contains a
3397+# configuration script generated by Autoconf, you may include it under
3398+# the same distribution terms that you use for the rest of that
3399+# program. This Exception is an additional permission under section 7
3400+# of the GNU General Public License, version 3 ("GPLv3").
3401+
3402+
3403+# Please send patches with a ChangeLog entry to config-patches@gnu.org.
3404+#
3405+# Configuration subroutine to validate and canonicalize a configuration type.
3406+# Supply the specified configuration type as an argument.
3407+# If it is invalid, we print an error message on stderr and exit with code 1.
3408+# Otherwise, we print the canonical config type on stdout and succeed.
3409+
3410+# You can get the latest version of this script from:
3411+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
3412+
3413+# This file is supposed to be the same for all GNU packages
3414+# and recognize all the CPU types, system types and aliases
3415+# that are meaningful with *any* GNU software.
3416+# Each package is responsible for reporting which valid configurations
3417+# it does not support. The user should be able to distinguish
3418+# a failure to support a valid configuration from a meaningless
3419+# configuration.
3420+
3421+# The goal of this file is to map all the various variations of a given
3422+# machine specification into a single specification in the form:
3423+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
3424+# or in some cases, the newer four-part form:
3425+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
3426+# It is wrong to echo any other type of specification.
3427+
3428+me=`echo "$0" | sed -e 's,.*/,,'`
3429+
3430+usage="\
3431+Usage: $0 [OPTION] CPU-MFR-OPSYS
3432+ $0 [OPTION] ALIAS
3433+
3434+Canonicalize a configuration name.
3435+
3436+Operation modes:
3437+ -h, --help print this help, then exit
3438+ -t, --time-stamp print date of last modification, then exit
3439+ -v, --version print version number, then exit
3440+
3441+Report bugs and patches to <config-patches@gnu.org>."
3442+
3443+version="\
3444+GNU config.sub ($timestamp)
3445+
3446+Copyright 1992-2013 Free Software Foundation, Inc.
3447+
3448+This is free software; see the source for copying conditions. There is NO
3449+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
3450+
3451+help="
3452+Try \`$me --help' for more information."
3453+
3454+# Parse command line
3455+while test $# -gt 0 ; do
3456+ case $1 in
3457+ --time-stamp | --time* | -t )
3458+ echo "$timestamp" ; exit ;;
3459+ --version | -v )
3460+ echo "$version" ; exit ;;
3461+ --help | --h* | -h )
3462+ echo "$usage"; exit ;;
3463+ -- ) # Stop option processing
3464+ shift; break ;;
3465+ - ) # Use stdin as input.
3466+ break ;;
3467+ -* )
3468+ echo "$me: invalid option $1$help"
3469+ exit 1 ;;
3470+
3471+ *local*)
3472+ # First pass through any local machine types.
3473+ echo $1
3474+ exit ;;
3475+
3476+ * )
3477+ break ;;
3478+ esac
3479+done
3480+
3481+case $# in
3482+ 0) echo "$me: missing argument$help" >&2
3483+ exit 1;;
3484+ 1) ;;
3485+ *) echo "$me: too many arguments$help" >&2
3486+ exit 1;;
3487+esac
3488+
3489+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
3490+# Here we must recognize all the valid KERNEL-OS combinations.
3491+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
3492+case $maybe_os in
3493+ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
3494+ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
3495+ knetbsd*-gnu* | netbsd*-gnu* | \
3496+ kopensolaris*-gnu* | \
3497+ storm-chaos* | os2-emx* | rtmk-nova*)
3498+ os=-$maybe_os
3499+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
3500+ ;;
3501+ android-linux)
3502+ os=-linux-android
3503+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
3504+ ;;
3505+ *)
3506+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
3507+ if [ $basic_machine != $1 ]
3508+ then os=`echo $1 | sed 's/.*-/-/'`
3509+ else os=; fi
3510+ ;;
3511+esac
3512+
3513+### Let's recognize common machines as not being operating systems so
3514+### that things like config.sub decstation-3100 work. We also
3515+### recognize some manufacturers as not being operating systems, so we
3516+### can provide default operating systems below.
3517+case $os in
3518+ -sun*os*)
3519+ # Prevent following clause from handling this invalid input.
3520+ ;;
3521+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
3522+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
3523+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
3524+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
3525+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
3526+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
3527+ -apple | -axis | -knuth | -cray | -microblaze*)
3528+ os=
3529+ basic_machine=$1
3530+ ;;
3531+ -bluegene*)
3532+ os=-cnk
3533+ ;;
3534+ -sim | -cisco | -oki | -wec | -winbond)
3535+ os=
3536+ basic_machine=$1
3537+ ;;
3538+ -scout)
3539+ ;;
3540+ -wrs)
3541+ os=-vxworks
3542+ basic_machine=$1
3543+ ;;
3544+ -chorusos*)
3545+ os=-chorusos
3546+ basic_machine=$1
3547+ ;;
3548+ -chorusrdb)
3549+ os=-chorusrdb
3550+ basic_machine=$1
3551+ ;;
3552+ -hiux*)
3553+ os=-hiuxwe2
3554+ ;;
3555+ -sco6)
3556+ os=-sco5v6
3557+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
3558+ ;;
3559+ -sco5)
3560+ os=-sco3.2v5
3561+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
3562+ ;;
3563+ -sco4)
3564+ os=-sco3.2v4
3565+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
3566+ ;;
3567+ -sco3.2.[4-9]*)
3568+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
3569+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
3570+ ;;
3571+ -sco3.2v[4-9]*)
3572+ # Don't forget version if it is 3.2v4 or newer.
3573+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
3574+ ;;
3575+ -sco5v6*)
3576+ # Don't forget version if it is 3.2v4 or newer.
3577+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
3578+ ;;
3579+ -sco*)
3580+ os=-sco3.2v2
3581+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
3582+ ;;
3583+ -udk*)
3584+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
3585+ ;;
3586+ -isc)
3587+ os=-isc2.2
3588+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
3589+ ;;
3590+ -clix*)
3591+ basic_machine=clipper-intergraph
3592+ ;;
3593+ -isc*)
3594+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
3595+ ;;
3596+ -lynx*178)
3597+ os=-lynxos178
3598+ ;;
3599+ -lynx*5)
3600+ os=-lynxos5
3601+ ;;
3602+ -lynx*)
3603+ os=-lynxos
3604+ ;;
3605+ -ptx*)
3606+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
3607+ ;;
3608+ -windowsnt*)
3609+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
3610+ ;;
3611+ -psos*)
3612+ os=-psos
3613+ ;;
3614+ -mint | -mint[0-9]*)
3615+ basic_machine=m68k-atari
3616+ os=-mint
3617+ ;;
3618+esac
3619+
3620+# Decode aliases for certain CPU-COMPANY combinations.
3621+case $basic_machine in
3622+ # Recognize the basic CPU types without company name.
3623+ # Some are omitted here because they have special meanings below.
3624+ 1750a | 580 \
3625+ | a29k \
3626+ | aarch64 | aarch64_be \
3627+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
3628+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
3629+ | am33_2.0 \
3630+ | arc | arceb \
3631+ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
3632+ | avr | avr32 \
3633+ | be32 | be64 \
3634+ | bfin \
3635+ | c4x | c8051 | clipper \
3636+ | d10v | d30v | dlx | dsp16xx \
3637+ | epiphany \
3638+ | fido | fr30 | frv \
3639+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
3640+ | hexagon \
3641+ | i370 | i860 | i960 | ia64 \
3642+ | ip2k | iq2000 \
3643+ | le32 | le64 \
3644+ | lm32 \
3645+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
3646+ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
3647+ | mips | mipsbe | mipseb | mipsel | mipsle \
3648+ | mips16 \
3649+ | mips64 | mips64el \
3650+ | mips64octeon | mips64octeonel \
3651+ | mips64orion | mips64orionel \
3652+ | mips64r5900 | mips64r5900el \
3653+ | mips64vr | mips64vrel \
3654+ | mips64vr4100 | mips64vr4100el \
3655+ | mips64vr4300 | mips64vr4300el \
3656+ | mips64vr5000 | mips64vr5000el \
3657+ | mips64vr5900 | mips64vr5900el \
3658+ | mipsisa32 | mipsisa32el \
3659+ | mipsisa32r2 | mipsisa32r2el \
3660+ | mipsisa64 | mipsisa64el \
3661+ | mipsisa64r2 | mipsisa64r2el \
3662+ | mipsisa64sb1 | mipsisa64sb1el \
3663+ | mipsisa64sr71k | mipsisa64sr71kel \
3664+ | mipsr5900 | mipsr5900el \
3665+ | mipstx39 | mipstx39el \
3666+ | mn10200 | mn10300 \
3667+ | moxie \
3668+ | mt \
3669+ | msp430 \
3670+ | nds32 | nds32le | nds32be \
3671+ | nios | nios2 | nios2eb | nios2el \
3672+ | ns16k | ns32k \
3673+ | open8 \
3674+ | or1k | or32 \
3675+ | pdp10 | pdp11 | pj | pjl \
3676+ | powerpc | powerpc64 | powerpc64le | powerpcle \
3677+ | pyramid \
3678+ | rl78 | rx \
3679+ | score \
3680+ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
3681+ | sh64 | sh64le \
3682+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
3683+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
3684+ | spu \
3685+ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
3686+ | ubicom32 \
3687+ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
3688+ | we32k \
3689+ | x86 | xc16x | xstormy16 | xtensa \
3690+ | z8k | z80)
3691+ basic_machine=$basic_machine-unknown
3692+ ;;
3693+ c54x)
3694+ basic_machine=tic54x-unknown
3695+ ;;
3696+ c55x)
3697+ basic_machine=tic55x-unknown
3698+ ;;
3699+ c6x)
3700+ basic_machine=tic6x-unknown
3701+ ;;
3702+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
3703+ basic_machine=$basic_machine-unknown
3704+ os=-none
3705+ ;;
3706+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
3707+ ;;
3708+ ms1)
3709+ basic_machine=mt-unknown
3710+ ;;
3711+
3712+ strongarm | thumb | xscale)
3713+ basic_machine=arm-unknown
3714+ ;;
3715+ xgate)
3716+ basic_machine=$basic_machine-unknown
3717+ os=-none
3718+ ;;
3719+ xscaleeb)
3720+ basic_machine=armeb-unknown
3721+ ;;
3722+
3723+ xscaleel)
3724+ basic_machine=armel-unknown
3725+ ;;
3726+
3727+ # We use `pc' rather than `unknown'
3728+ # because (1) that's what they normally are, and
3729+ # (2) the word "unknown" tends to confuse beginning users.
3730+ i*86 | x86_64)
3731+ basic_machine=$basic_machine-pc
3732+ ;;
3733+ # Object if more than one company name word.
3734+ *-*-*)
3735+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
3736+ exit 1
3737+ ;;
3738+ # Recognize the basic CPU types with company name.
3739+ 580-* \
3740+ | a29k-* \
3741+ | aarch64-* | aarch64_be-* \
3742+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
3743+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
3744+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
3745+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
3746+ | avr-* | avr32-* \
3747+ | be32-* | be64-* \
3748+ | bfin-* | bs2000-* \
3749+ | c[123]* | c30-* | [cjt]90-* | c4x-* \
3750+ | c8051-* | clipper-* | craynv-* | cydra-* \
3751+ | d10v-* | d30v-* | dlx-* \
3752+ | elxsi-* \
3753+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
3754+ | h8300-* | h8500-* \
3755+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
3756+ | hexagon-* \
3757+ | i*86-* | i860-* | i960-* | ia64-* \
3758+ | ip2k-* | iq2000-* \
3759+ | le32-* | le64-* \
3760+ | lm32-* \
3761+ | m32c-* | m32r-* | m32rle-* \
3762+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
3763+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
3764+ | microblaze-* | microblazeel-* \
3765+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
3766+ | mips16-* \
3767+ | mips64-* | mips64el-* \
3768+ | mips64octeon-* | mips64octeonel-* \
3769+ | mips64orion-* | mips64orionel-* \
3770+ | mips64r5900-* | mips64r5900el-* \
3771+ | mips64vr-* | mips64vrel-* \
3772+ | mips64vr4100-* | mips64vr4100el-* \
3773+ | mips64vr4300-* | mips64vr4300el-* \
3774+ | mips64vr5000-* | mips64vr5000el-* \
3775+ | mips64vr5900-* | mips64vr5900el-* \
3776+ | mipsisa32-* | mipsisa32el-* \
3777+ | mipsisa32r2-* | mipsisa32r2el-* \
3778+ | mipsisa64-* | mipsisa64el-* \
3779+ | mipsisa64r2-* | mipsisa64r2el-* \
3780+ | mipsisa64sb1-* | mipsisa64sb1el-* \
3781+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
3782+ | mipsr5900-* | mipsr5900el-* \
3783+ | mipstx39-* | mipstx39el-* \
3784+ | mmix-* \
3785+ | mt-* \
3786+ | msp430-* \
3787+ | nds32-* | nds32le-* | nds32be-* \
3788+ | nios-* | nios2-* | nios2eb-* | nios2el-* \
3789+ | none-* | np1-* | ns16k-* | ns32k-* \
3790+ | open8-* \
3791+ | orion-* \
3792+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
3793+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
3794+ | pyramid-* \
3795+ | rl78-* | romp-* | rs6000-* | rx-* \
3796+ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
3797+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
3798+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
3799+ | sparclite-* \
3800+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
3801+ | tahoe-* \
3802+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
3803+ | tile*-* \
3804+ | tron-* \
3805+ | ubicom32-* \
3806+ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
3807+ | vax-* \
3808+ | we32k-* \
3809+ | x86-* | x86_64-* | xc16x-* | xps100-* \
3810+ | xstormy16-* | xtensa*-* \
3811+ | ymp-* \
3812+ | z8k-* | z80-*)
3813+ ;;
3814+ # Recognize the basic CPU types without company name, with glob match.
3815+ xtensa*)
3816+ basic_machine=$basic_machine-unknown
3817+ ;;
3818+ # Recognize the various machine names and aliases which stand
3819+ # for a CPU type and a company and sometimes even an OS.
3820+ 386bsd)
3821+ basic_machine=i386-unknown
3822+ os=-bsd
3823+ ;;
3824+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
3825+ basic_machine=m68000-att
3826+ ;;
3827+ 3b*)
3828+ basic_machine=we32k-att
3829+ ;;
3830+ a29khif)
3831+ basic_machine=a29k-amd
3832+ os=-udi
3833+ ;;
3834+ abacus)
3835+ basic_machine=abacus-unknown
3836+ ;;
3837+ adobe68k)
3838+ basic_machine=m68010-adobe
3839+ os=-scout
3840+ ;;
3841+ alliant | fx80)
3842+ basic_machine=fx80-alliant
3843+ ;;
3844+ altos | altos3068)
3845+ basic_machine=m68k-altos
3846+ ;;
3847+ am29k)
3848+ basic_machine=a29k-none
3849+ os=-bsd
3850+ ;;
3851+ amd64)
3852+ basic_machine=x86_64-pc
3853+ ;;
3854+ amd64-*)
3855+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
3856+ ;;
3857+ amdahl)
3858+ basic_machine=580-amdahl
3859+ os=-sysv
3860+ ;;
3861+ amiga | amiga-*)
3862+ basic_machine=m68k-unknown
3863+ ;;
3864+ amigaos | amigados)
3865+ basic_machine=m68k-unknown
3866+ os=-amigaos
3867+ ;;
3868+ amigaunix | amix)
3869+ basic_machine=m68k-unknown
3870+ os=-sysv4
3871+ ;;
3872+ apollo68)
3873+ basic_machine=m68k-apollo
3874+ os=-sysv
3875+ ;;
3876+ apollo68bsd)
3877+ basic_machine=m68k-apollo
3878+ os=-bsd
3879+ ;;
3880+ aros)
3881+ basic_machine=i386-pc
3882+ os=-aros
3883+ ;;
3884+ aux)
3885+ basic_machine=m68k-apple
3886+ os=-aux
3887+ ;;
3888+ balance)
3889+ basic_machine=ns32k-sequent
3890+ os=-dynix
3891+ ;;
3892+ blackfin)
3893+ basic_machine=bfin-unknown
3894+ os=-linux
3895+ ;;
3896+ blackfin-*)
3897+ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
3898+ os=-linux
3899+ ;;
3900+ bluegene*)
3901+ basic_machine=powerpc-ibm
3902+ os=-cnk
3903+ ;;
3904+ c54x-*)
3905+ basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
3906+ ;;
3907+ c55x-*)
3908+ basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
3909+ ;;
3910+ c6x-*)
3911+ basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
3912+ ;;
3913+ c90)
3914+ basic_machine=c90-cray
3915+ os=-unicos
3916+ ;;
3917+ cegcc)
3918+ basic_machine=arm-unknown
3919+ os=-cegcc
3920+ ;;
3921+ convex-c1)
3922+ basic_machine=c1-convex
3923+ os=-bsd
3924+ ;;
3925+ convex-c2)
3926+ basic_machine=c2-convex
3927+ os=-bsd
3928+ ;;
3929+ convex-c32)
3930+ basic_machine=c32-convex
3931+ os=-bsd
3932+ ;;
3933+ convex-c34)
3934+ basic_machine=c34-convex
3935+ os=-bsd
3936+ ;;
3937+ convex-c38)
3938+ basic_machine=c38-convex
3939+ os=-bsd
3940+ ;;
3941+ cray | j90)
3942+ basic_machine=j90-cray
3943+ os=-unicos
3944+ ;;
3945+ craynv)
3946+ basic_machine=craynv-cray
3947+ os=-unicosmp
3948+ ;;
3949+ cr16 | cr16-*)
3950+ basic_machine=cr16-unknown
3951+ os=-elf
3952+ ;;
3953+ crds | unos)
3954+ basic_machine=m68k-crds
3955+ ;;
3956+ crisv32 | crisv32-* | etraxfs*)
3957+ basic_machine=crisv32-axis
3958+ ;;
3959+ cris | cris-* | etrax*)
3960+ basic_machine=cris-axis
3961+ ;;
3962+ crx)
3963+ basic_machine=crx-unknown
3964+ os=-elf
3965+ ;;
3966+ da30 | da30-*)
3967+ basic_machine=m68k-da30
3968+ ;;
3969+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
3970+ basic_machine=mips-dec
3971+ ;;
3972+ decsystem10* | dec10*)
3973+ basic_machine=pdp10-dec
3974+ os=-tops10
3975+ ;;
3976+ decsystem20* | dec20*)
3977+ basic_machine=pdp10-dec
3978+ os=-tops20
3979+ ;;
3980+ delta | 3300 | motorola-3300 | motorola-delta \
3981+ | 3300-motorola | delta-motorola)
3982+ basic_machine=m68k-motorola
3983+ ;;
3984+ delta88)
3985+ basic_machine=m88k-motorola
3986+ os=-sysv3
3987+ ;;
3988+ dicos)
3989+ basic_machine=i686-pc
3990+ os=-dicos
3991+ ;;
3992+ djgpp)
3993+ basic_machine=i586-pc
3994+ os=-msdosdjgpp
3995+ ;;
3996+ dpx20 | dpx20-*)
3997+ basic_machine=rs6000-bull
3998+ os=-bosx
3999+ ;;
4000+ dpx2* | dpx2*-bull)
4001+ basic_machine=m68k-bull
4002+ os=-sysv3
4003+ ;;
4004+ ebmon29k)
4005+ basic_machine=a29k-amd
4006+ os=-ebmon
4007+ ;;
4008+ elxsi)
4009+ basic_machine=elxsi-elxsi
4010+ os=-bsd
4011+ ;;
4012+ encore | umax | mmax)
4013+ basic_machine=ns32k-encore
4014+ ;;
4015+ es1800 | OSE68k | ose68k | ose | OSE)
4016+ basic_machine=m68k-ericsson
4017+ os=-ose
4018+ ;;
4019+ fx2800)
4020+ basic_machine=i860-alliant
4021+ ;;
4022+ genix)
4023+ basic_machine=ns32k-ns
4024+ ;;
4025+ gmicro)
4026+ basic_machine=tron-gmicro
4027+ os=-sysv
4028+ ;;
4029+ go32)
4030+ basic_machine=i386-pc
4031+ os=-go32
4032+ ;;
4033+ h3050r* | hiux*)
4034+ basic_machine=hppa1.1-hitachi
4035+ os=-hiuxwe2
4036+ ;;
4037+ h8300hms)
4038+ basic_machine=h8300-hitachi
4039+ os=-hms
4040+ ;;
4041+ h8300xray)
4042+ basic_machine=h8300-hitachi
4043+ os=-xray
4044+ ;;
4045+ h8500hms)
4046+ basic_machine=h8500-hitachi
4047+ os=-hms
4048+ ;;
4049+ harris)
4050+ basic_machine=m88k-harris
4051+ os=-sysv3
4052+ ;;
4053+ hp300-*)
4054+ basic_machine=m68k-hp
4055+ ;;
4056+ hp300bsd)
4057+ basic_machine=m68k-hp
4058+ os=-bsd
4059+ ;;
4060+ hp300hpux)
4061+ basic_machine=m68k-hp
4062+ os=-hpux
4063+ ;;
4064+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
4065+ basic_machine=hppa1.0-hp
4066+ ;;
4067+ hp9k2[0-9][0-9] | hp9k31[0-9])
4068+ basic_machine=m68000-hp
4069+ ;;
4070+ hp9k3[2-9][0-9])
4071+ basic_machine=m68k-hp
4072+ ;;
4073+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
4074+ basic_machine=hppa1.0-hp
4075+ ;;
4076+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
4077+ basic_machine=hppa1.1-hp
4078+ ;;
4079+ hp9k78[0-9] | hp78[0-9])
4080+ # FIXME: really hppa2.0-hp
4081+ basic_machine=hppa1.1-hp
4082+ ;;
4083+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
4084+ # FIXME: really hppa2.0-hp
4085+ basic_machine=hppa1.1-hp
4086+ ;;
4087+ hp9k8[0-9][13679] | hp8[0-9][13679])
4088+ basic_machine=hppa1.1-hp
4089+ ;;
4090+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
4091+ basic_machine=hppa1.0-hp
4092+ ;;
4093+ hppa-next)
4094+ os=-nextstep3
4095+ ;;
4096+ hppaosf)
4097+ basic_machine=hppa1.1-hp
4098+ os=-osf
4099+ ;;
4100+ hppro)
4101+ basic_machine=hppa1.1-hp
4102+ os=-proelf
4103+ ;;
4104+ i370-ibm* | ibm*)
4105+ basic_machine=i370-ibm
4106+ ;;
4107+ i*86v32)
4108+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
4109+ os=-sysv32
4110+ ;;
4111+ i*86v4*)
4112+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
4113+ os=-sysv4
4114+ ;;
4115+ i*86v)
4116+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
4117+ os=-sysv
4118+ ;;
4119+ i*86sol2)
4120+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
4121+ os=-solaris2
4122+ ;;
4123+ i386mach)
4124+ basic_machine=i386-mach
4125+ os=-mach
4126+ ;;
4127+ i386-vsta | vsta)
4128+ basic_machine=i386-unknown
4129+ os=-vsta
4130+ ;;
4131+ iris | iris4d)
4132+ basic_machine=mips-sgi
4133+ case $os in
4134+ -irix*)
4135+ ;;
4136+ *)
4137+ os=-irix4
4138+ ;;
4139+ esac
4140+ ;;
4141+ isi68 | isi)
4142+ basic_machine=m68k-isi
4143+ os=-sysv
4144+ ;;
4145+ m68knommu)
4146+ basic_machine=m68k-unknown
4147+ os=-linux
4148+ ;;
4149+ m68knommu-*)
4150+ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
4151+ os=-linux
4152+ ;;
4153+ m88k-omron*)
4154+ basic_machine=m88k-omron
4155+ ;;
4156+ magnum | m3230)
4157+ basic_machine=mips-mips
4158+ os=-sysv
4159+ ;;
4160+ merlin)
4161+ basic_machine=ns32k-utek
4162+ os=-sysv
4163+ ;;
4164+ microblaze*)
4165+ basic_machine=microblaze-xilinx
4166+ ;;
4167+ mingw64)
4168+ basic_machine=x86_64-pc
4169+ os=-mingw64
4170+ ;;
4171+ mingw32)
4172+ basic_machine=i686-pc
4173+ os=-mingw32
4174+ ;;
4175+ mingw32ce)
4176+ basic_machine=arm-unknown
4177+ os=-mingw32ce
4178+ ;;
4179+ miniframe)
4180+ basic_machine=m68000-convergent
4181+ ;;
4182+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
4183+ basic_machine=m68k-atari
4184+ os=-mint
4185+ ;;
4186+ mips3*-*)
4187+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
4188+ ;;
4189+ mips3*)
4190+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
4191+ ;;
4192+ monitor)
4193+ basic_machine=m68k-rom68k
4194+ os=-coff
4195+ ;;
4196+ morphos)
4197+ basic_machine=powerpc-unknown
4198+ os=-morphos
4199+ ;;
4200+ msdos)
4201+ basic_machine=i386-pc
4202+ os=-msdos
4203+ ;;
4204+ ms1-*)
4205+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
4206+ ;;
4207+ msys)
4208+ basic_machine=i686-pc
4209+ os=-msys
4210+ ;;
4211+ mvs)
4212+ basic_machine=i370-ibm
4213+ os=-mvs
4214+ ;;
4215+ nacl)
4216+ basic_machine=le32-unknown
4217+ os=-nacl
4218+ ;;
4219+ ncr3000)
4220+ basic_machine=i486-ncr
4221+ os=-sysv4
4222+ ;;
4223+ netbsd386)
4224+ basic_machine=i386-unknown
4225+ os=-netbsd
4226+ ;;
4227+ netwinder)
4228+ basic_machine=armv4l-rebel
4229+ os=-linux
4230+ ;;
4231+ news | news700 | news800 | news900)
4232+ basic_machine=m68k-sony
4233+ os=-newsos
4234+ ;;
4235+ news1000)
4236+ basic_machine=m68030-sony
4237+ os=-newsos
4238+ ;;
4239+ news-3600 | risc-news)
4240+ basic_machine=mips-sony
4241+ os=-newsos
4242+ ;;
4243+ necv70)
4244+ basic_machine=v70-nec
4245+ os=-sysv
4246+ ;;
4247+ next | m*-next )
4248+ basic_machine=m68k-next
4249+ case $os in
4250+ -nextstep* )
4251+ ;;
4252+ -ns2*)
4253+ os=-nextstep2
4254+ ;;
4255+ *)
4256+ os=-nextstep3
4257+ ;;
4258+ esac
4259+ ;;
4260+ nh3000)
4261+ basic_machine=m68k-harris
4262+ os=-cxux
4263+ ;;
4264+ nh[45]000)
4265+ basic_machine=m88k-harris
4266+ os=-cxux
4267+ ;;
4268+ nindy960)
4269+ basic_machine=i960-intel
4270+ os=-nindy
4271+ ;;
4272+ mon960)
4273+ basic_machine=i960-intel
4274+ os=-mon960
4275+ ;;
4276+ nonstopux)
4277+ basic_machine=mips-compaq
4278+ os=-nonstopux
4279+ ;;
4280+ np1)
4281+ basic_machine=np1-gould
4282+ ;;
4283+ neo-tandem)
4284+ basic_machine=neo-tandem
4285+ ;;
4286+ nse-tandem)
4287+ basic_machine=nse-tandem
4288+ ;;
4289+ nsr-tandem)
4290+ basic_machine=nsr-tandem
4291+ ;;
4292+ op50n-* | op60c-*)
4293+ basic_machine=hppa1.1-oki
4294+ os=-proelf
4295+ ;;
4296+ openrisc | openrisc-*)
4297+ basic_machine=or32-unknown
4298+ ;;
4299+ os400)
4300+ basic_machine=powerpc-ibm
4301+ os=-os400
4302+ ;;
4303+ OSE68000 | ose68000)
4304+ basic_machine=m68000-ericsson
4305+ os=-ose
4306+ ;;
4307+ os68k)
4308+ basic_machine=m68k-none
4309+ os=-os68k
4310+ ;;
4311+ pa-hitachi)
4312+ basic_machine=hppa1.1-hitachi
4313+ os=-hiuxwe2
4314+ ;;
4315+ paragon)
4316+ basic_machine=i860-intel
4317+ os=-osf
4318+ ;;
4319+ parisc)
4320+ basic_machine=hppa-unknown
4321+ os=-linux
4322+ ;;
4323+ parisc-*)
4324+ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
4325+ os=-linux
4326+ ;;
4327+ pbd)
4328+ basic_machine=sparc-tti
4329+ ;;
4330+ pbb)
4331+ basic_machine=m68k-tti
4332+ ;;
4333+ pc532 | pc532-*)
4334+ basic_machine=ns32k-pc532
4335+ ;;
4336+ pc98)
4337+ basic_machine=i386-pc
4338+ ;;
4339+ pc98-*)
4340+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
4341+ ;;
4342+ pentium | p5 | k5 | k6 | nexgen | viac3)
4343+ basic_machine=i586-pc
4344+ ;;
4345+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
4346+ basic_machine=i686-pc
4347+ ;;
4348+ pentiumii | pentium2 | pentiumiii | pentium3)
4349+ basic_machine=i686-pc
4350+ ;;
4351+ pentium4)
4352+ basic_machine=i786-pc
4353+ ;;
4354+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
4355+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
4356+ ;;
4357+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
4358+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
4359+ ;;
4360+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
4361+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
4362+ ;;
4363+ pentium4-*)
4364+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
4365+ ;;
4366+ pn)
4367+ basic_machine=pn-gould
4368+ ;;
4369+ power) basic_machine=power-ibm
4370+ ;;
4371+ ppc | ppcbe) basic_machine=powerpc-unknown
4372+ ;;
4373+ ppc-* | ppcbe-*)
4374+ basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
4375+ ;;
4376+ ppcle | powerpclittle | ppc-le | powerpc-little)
4377+ basic_machine=powerpcle-unknown
4378+ ;;
4379+ ppcle-* | powerpclittle-*)
4380+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
4381+ ;;
4382+ ppc64) basic_machine=powerpc64-unknown
4383+ ;;
4384+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
4385+ ;;
4386+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
4387+ basic_machine=powerpc64le-unknown
4388+ ;;
4389+ ppc64le-* | powerpc64little-*)
4390+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
4391+ ;;
4392+ ps2)
4393+ basic_machine=i386-ibm
4394+ ;;
4395+ pw32)
4396+ basic_machine=i586-unknown
4397+ os=-pw32
4398+ ;;
4399+ rdos | rdos64)
4400+ basic_machine=x86_64-pc
4401+ os=-rdos
4402+ ;;
4403+ rdos32)
4404+ basic_machine=i386-pc
4405+ os=-rdos
4406+ ;;
4407+ rom68k)
4408+ basic_machine=m68k-rom68k
4409+ os=-coff
4410+ ;;
4411+ rm[46]00)
4412+ basic_machine=mips-siemens
4413+ ;;
4414+ rtpc | rtpc-*)
4415+ basic_machine=romp-ibm
4416+ ;;
4417+ s390 | s390-*)
4418+ basic_machine=s390-ibm
4419+ ;;
4420+ s390x | s390x-*)
4421+ basic_machine=s390x-ibm
4422+ ;;
4423+ sa29200)
4424+ basic_machine=a29k-amd
4425+ os=-udi
4426+ ;;
4427+ sb1)
4428+ basic_machine=mipsisa64sb1-unknown
4429+ ;;
4430+ sb1el)
4431+ basic_machine=mipsisa64sb1el-unknown
4432+ ;;
4433+ sde)
4434+ basic_machine=mipsisa32-sde
4435+ os=-elf
4436+ ;;
4437+ sei)
4438+ basic_machine=mips-sei
4439+ os=-seiux
4440+ ;;
4441+ sequent)
4442+ basic_machine=i386-sequent
4443+ ;;
4444+ sh)
4445+ basic_machine=sh-hitachi
4446+ os=-hms
4447+ ;;
4448+ sh5el)
4449+ basic_machine=sh5le-unknown
4450+ ;;
4451+ sh64)
4452+ basic_machine=sh64-unknown
4453+ ;;
4454+ sparclite-wrs | simso-wrs)
4455+ basic_machine=sparclite-wrs
4456+ os=-vxworks
4457+ ;;
4458+ sps7)
4459+ basic_machine=m68k-bull
4460+ os=-sysv2
4461+ ;;
4462+ spur)
4463+ basic_machine=spur-unknown
4464+ ;;
4465+ st2000)
4466+ basic_machine=m68k-tandem
4467+ ;;
4468+ stratus)
4469+ basic_machine=i860-stratus
4470+ os=-sysv4
4471+ ;;
4472+ strongarm-* | thumb-*)
4473+ basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
4474+ ;;
4475+ sun2)
4476+ basic_machine=m68000-sun
4477+ ;;
4478+ sun2os3)
4479+ basic_machine=m68000-sun
4480+ os=-sunos3
4481+ ;;
4482+ sun2os4)
4483+ basic_machine=m68000-sun
4484+ os=-sunos4
4485+ ;;
4486+ sun3os3)
4487+ basic_machine=m68k-sun
4488+ os=-sunos3
4489+ ;;
4490+ sun3os4)
4491+ basic_machine=m68k-sun
4492+ os=-sunos4
4493+ ;;
4494+ sun4os3)
4495+ basic_machine=sparc-sun
4496+ os=-sunos3
4497+ ;;
4498+ sun4os4)
4499+ basic_machine=sparc-sun
4500+ os=-sunos4
4501+ ;;
4502+ sun4sol2)
4503+ basic_machine=sparc-sun
4504+ os=-solaris2
4505+ ;;
4506+ sun3 | sun3-*)
4507+ basic_machine=m68k-sun
4508+ ;;
4509+ sun4)
4510+ basic_machine=sparc-sun
4511+ ;;
4512+ sun386 | sun386i | roadrunner)
4513+ basic_machine=i386-sun
4514+ ;;
4515+ sv1)
4516+ basic_machine=sv1-cray
4517+ os=-unicos
4518+ ;;
4519+ symmetry)
4520+ basic_machine=i386-sequent
4521+ os=-dynix
4522+ ;;
4523+ t3e)
4524+ basic_machine=alphaev5-cray
4525+ os=-unicos
4526+ ;;
4527+ t90)
4528+ basic_machine=t90-cray
4529+ os=-unicos
4530+ ;;
4531+ tile*)
4532+ basic_machine=$basic_machine-unknown
4533+ os=-linux-gnu
4534+ ;;
4535+ tx39)
4536+ basic_machine=mipstx39-unknown
4537+ ;;
4538+ tx39el)
4539+ basic_machine=mipstx39el-unknown
4540+ ;;
4541+ toad1)
4542+ basic_machine=pdp10-xkl
4543+ os=-tops20
4544+ ;;
4545+ tower | tower-32)
4546+ basic_machine=m68k-ncr
4547+ ;;
4548+ tpf)
4549+ basic_machine=s390x-ibm
4550+ os=-tpf
4551+ ;;
4552+ udi29k)
4553+ basic_machine=a29k-amd
4554+ os=-udi
4555+ ;;
4556+ ultra3)
4557+ basic_machine=a29k-nyu
4558+ os=-sym1
4559+ ;;
4560+ v810 | necv810)
4561+ basic_machine=v810-nec
4562+ os=-none
4563+ ;;
4564+ vaxv)
4565+ basic_machine=vax-dec
4566+ os=-sysv
4567+ ;;
4568+ vms)
4569+ basic_machine=vax-dec
4570+ os=-vms
4571+ ;;
4572+ vpp*|vx|vx-*)
4573+ basic_machine=f301-fujitsu
4574+ ;;
4575+ vxworks960)
4576+ basic_machine=i960-wrs
4577+ os=-vxworks
4578+ ;;
4579+ vxworks68)
4580+ basic_machine=m68k-wrs
4581+ os=-vxworks
4582+ ;;
4583+ vxworks29k)
4584+ basic_machine=a29k-wrs
4585+ os=-vxworks
4586+ ;;
4587+ w65*)
4588+ basic_machine=w65-wdc
4589+ os=-none
4590+ ;;
4591+ w89k-*)
4592+ basic_machine=hppa1.1-winbond
4593+ os=-proelf
4594+ ;;
4595+ xbox)
4596+ basic_machine=i686-pc
4597+ os=-mingw32
4598+ ;;
4599+ xps | xps100)
4600+ basic_machine=xps100-honeywell
4601+ ;;
4602+ xscale-* | xscalee[bl]-*)
4603+ basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
4604+ ;;
4605+ ymp)
4606+ basic_machine=ymp-cray
4607+ os=-unicos
4608+ ;;
4609+ z8k-*-coff)
4610+ basic_machine=z8k-unknown
4611+ os=-sim
4612+ ;;
4613+ z80-*-coff)
4614+ basic_machine=z80-unknown
4615+ os=-sim
4616+ ;;
4617+ none)
4618+ basic_machine=none-none
4619+ os=-none
4620+ ;;
4621+
4622+# Here we handle the default manufacturer of certain CPU types. It is in
4623+# some cases the only manufacturer, in others, it is the most popular.
4624+ w89k)
4625+ basic_machine=hppa1.1-winbond
4626+ ;;
4627+ op50n)
4628+ basic_machine=hppa1.1-oki
4629+ ;;
4630+ op60c)
4631+ basic_machine=hppa1.1-oki
4632+ ;;
4633+ romp)
4634+ basic_machine=romp-ibm
4635+ ;;
4636+ mmix)
4637+ basic_machine=mmix-knuth
4638+ ;;
4639+ rs6000)
4640+ basic_machine=rs6000-ibm
4641+ ;;
4642+ vax)
4643+ basic_machine=vax-dec
4644+ ;;
4645+ pdp10)
4646+ # there are many clones, so DEC is not a safe bet
4647+ basic_machine=pdp10-unknown
4648+ ;;
4649+ pdp11)
4650+ basic_machine=pdp11-dec
4651+ ;;
4652+ we32k)
4653+ basic_machine=we32k-att
4654+ ;;
4655+ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
4656+ basic_machine=sh-unknown
4657+ ;;
4658+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
4659+ basic_machine=sparc-sun
4660+ ;;
4661+ cydra)
4662+ basic_machine=cydra-cydrome
4663+ ;;
4664+ orion)
4665+ basic_machine=orion-highlevel
4666+ ;;
4667+ orion105)
4668+ basic_machine=clipper-highlevel
4669+ ;;
4670+ mac | mpw | mac-mpw)
4671+ basic_machine=m68k-apple
4672+ ;;
4673+ pmac | pmac-mpw)
4674+ basic_machine=powerpc-apple
4675+ ;;
4676+ *-unknown)
4677+ # Make sure to match an already-canonicalized machine name.
4678+ ;;
4679+ *)
4680+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
4681+ exit 1
4682+ ;;
4683+esac
4684+
4685+# Here we canonicalize certain aliases for manufacturers.
4686+case $basic_machine in
4687+ *-digital*)
4688+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
4689+ ;;
4690+ *-commodore*)
4691+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
4692+ ;;
4693+ *)
4694+ ;;
4695+esac
4696+
4697+# Decode manufacturer-specific aliases for certain operating systems.
4698+
4699+if [ x"$os" != x"" ]
4700+then
4701+case $os in
4702+ # First match some system type aliases
4703+ # that might get confused with valid system types.
4704+ # -solaris* is a basic system type, with this one exception.
4705+ -auroraux)
4706+ os=-auroraux
4707+ ;;
4708+ -solaris1 | -solaris1.*)
4709+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
4710+ ;;
4711+ -solaris)
4712+ os=-solaris2
4713+ ;;
4714+ -svr4*)
4715+ os=-sysv4
4716+ ;;
4717+ -unixware*)
4718+ os=-sysv4.2uw
4719+ ;;
4720+ -gnu/linux*)
4721+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
4722+ ;;
4723+ # First accept the basic system types.
4724+ # The portable systems comes first.
4725+ # Each alternative MUST END IN A *, to match a version number.
4726+ # -sysv* is not here because it comes later, after sysvr4.
4727+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
4728+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
4729+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
4730+ | -sym* | -kopensolaris* | -plan9* \
4731+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
4732+ | -aos* | -aros* \
4733+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
4734+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
4735+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
4736+ | -bitrig* | -openbsd* | -solidbsd* \
4737+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
4738+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
4739+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
4740+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
4741+ | -chorusos* | -chorusrdb* | -cegcc* \
4742+ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
4743+ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
4744+ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
4745+ | -uxpv* | -beos* | -mpeix* | -udk* \
4746+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
4747+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
4748+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
4749+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
4750+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
4751+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
4752+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
4753+ # Remember, each alternative MUST END IN *, to match a version number.
4754+ ;;
4755+ -qnx*)
4756+ case $basic_machine in
4757+ x86-* | i*86-*)
4758+ ;;
4759+ *)
4760+ os=-nto$os
4761+ ;;
4762+ esac
4763+ ;;
4764+ -nto-qnx*)
4765+ ;;
4766+ -nto*)
4767+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
4768+ ;;
4769+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
4770+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
4771+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
4772+ ;;
4773+ -mac*)
4774+ os=`echo $os | sed -e 's|mac|macos|'`
4775+ ;;
4776+ -linux-dietlibc)
4777+ os=-linux-dietlibc
4778+ ;;
4779+ -linux*)
4780+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
4781+ ;;
4782+ -sunos5*)
4783+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
4784+ ;;
4785+ -sunos6*)
4786+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
4787+ ;;
4788+ -opened*)
4789+ os=-openedition
4790+ ;;
4791+ -os400*)
4792+ os=-os400
4793+ ;;
4794+ -wince*)
4795+ os=-wince
4796+ ;;
4797+ -osfrose*)
4798+ os=-osfrose
4799+ ;;
4800+ -osf*)
4801+ os=-osf
4802+ ;;
4803+ -utek*)
4804+ os=-bsd
4805+ ;;
4806+ -dynix*)
4807+ os=-bsd
4808+ ;;
4809+ -acis*)
4810+ os=-aos
4811+ ;;
4812+ -atheos*)
4813+ os=-atheos
4814+ ;;
4815+ -syllable*)
4816+ os=-syllable
4817+ ;;
4818+ -386bsd)
4819+ os=-bsd
4820+ ;;
4821+ -ctix* | -uts*)
4822+ os=-sysv
4823+ ;;
4824+ -nova*)
4825+ os=-rtmk-nova
4826+ ;;
4827+ -ns2 )
4828+ os=-nextstep2
4829+ ;;
4830+ -nsk*)
4831+ os=-nsk
4832+ ;;
4833+ # Preserve the version number of sinix5.
4834+ -sinix5.*)
4835+ os=`echo $os | sed -e 's|sinix|sysv|'`
4836+ ;;
4837+ -sinix*)
4838+ os=-sysv4
4839+ ;;
4840+ -tpf*)
4841+ os=-tpf
4842+ ;;
4843+ -triton*)
4844+ os=-sysv3
4845+ ;;
4846+ -oss*)
4847+ os=-sysv3
4848+ ;;
4849+ -svr4)
4850+ os=-sysv4
4851+ ;;
4852+ -svr3)
4853+ os=-sysv3
4854+ ;;
4855+ -sysvr4)
4856+ os=-sysv4
4857+ ;;
4858+ # This must come after -sysvr4.
4859+ -sysv*)
4860+ ;;
4861+ -ose*)
4862+ os=-ose
4863+ ;;
4864+ -es1800*)
4865+ os=-ose
4866+ ;;
4867+ -xenix)
4868+ os=-xenix
4869+ ;;
4870+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
4871+ os=-mint
4872+ ;;
4873+ -aros*)
4874+ os=-aros
4875+ ;;
4876+ -zvmoe)
4877+ os=-zvmoe
4878+ ;;
4879+ -dicos*)
4880+ os=-dicos
4881+ ;;
4882+ -nacl*)
4883+ ;;
4884+ -none)
4885+ ;;
4886+ *)
4887+ # Get rid of the `-' at the beginning of $os.
4888+ os=`echo $os | sed 's/[^-]*-//'`
4889+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
4890+ exit 1
4891+ ;;
4892+esac
4893+else
4894+
4895+# Here we handle the default operating systems that come with various machines.
4896+# The value should be what the vendor currently ships out the door with their
4897+# machine or put another way, the most popular os provided with the machine.
4898+
4899+# Note that if you're going to try to match "-MANUFACTURER" here (say,
4900+# "-sun"), then you have to tell the case statement up towards the top
4901+# that MANUFACTURER isn't an operating system. Otherwise, code above
4902+# will signal an error saying that MANUFACTURER isn't an operating
4903+# system, and we'll never get to this point.
4904+
4905+case $basic_machine in
4906+ score-*)
4907+ os=-elf
4908+ ;;
4909+ spu-*)
4910+ os=-elf
4911+ ;;
4912+ *-acorn)
4913+ os=-riscix1.2
4914+ ;;
4915+ arm*-rebel)
4916+ os=-linux
4917+ ;;
4918+ arm*-semi)
4919+ os=-aout
4920+ ;;
4921+ c4x-* | tic4x-*)
4922+ os=-coff
4923+ ;;
4924+ c8051-*)
4925+ os=-elf
4926+ ;;
4927+ hexagon-*)
4928+ os=-elf
4929+ ;;
4930+ tic54x-*)
4931+ os=-coff
4932+ ;;
4933+ tic55x-*)
4934+ os=-coff
4935+ ;;
4936+ tic6x-*)
4937+ os=-coff
4938+ ;;
4939+ # This must come before the *-dec entry.
4940+ pdp10-*)
4941+ os=-tops20
4942+ ;;
4943+ pdp11-*)
4944+ os=-none
4945+ ;;
4946+ *-dec | vax-*)
4947+ os=-ultrix4.2
4948+ ;;
4949+ m68*-apollo)
4950+ os=-domain
4951+ ;;
4952+ i386-sun)
4953+ os=-sunos4.0.2
4954+ ;;
4955+ m68000-sun)
4956+ os=-sunos3
4957+ ;;
4958+ m68*-cisco)
4959+ os=-aout
4960+ ;;
4961+ mep-*)
4962+ os=-elf
4963+ ;;
4964+ mips*-cisco)
4965+ os=-elf
4966+ ;;
4967+ mips*-*)
4968+ os=-elf
4969+ ;;
4970+ or1k-*)
4971+ os=-elf
4972+ ;;
4973+ or32-*)
4974+ os=-coff
4975+ ;;
4976+ *-tti) # must be before sparc entry or we get the wrong os.
4977+ os=-sysv3
4978+ ;;
4979+ sparc-* | *-sun)
4980+ os=-sunos4.1.1
4981+ ;;
4982+ *-be)
4983+ os=-beos
4984+ ;;
4985+ *-haiku)
4986+ os=-haiku
4987+ ;;
4988+ *-ibm)
4989+ os=-aix
4990+ ;;
4991+ *-knuth)
4992+ os=-mmixware
4993+ ;;
4994+ *-wec)
4995+ os=-proelf
4996+ ;;
4997+ *-winbond)
4998+ os=-proelf
4999+ ;;
5000+ *-oki)
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: