From a42a522f34f910961f92ca9145e58647aded8c83 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 10 Aug 2015 13:25:07 +0000 Subject: [PATCH 001/116] Branching for 1.8 releases git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1695064 13f79535-47bb-0310-9956-ffa450edef68 From 31a057f5d3db73b196e2bd70ca3ee58015c3e156 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 10 Aug 2015 14:16:54 +0000 Subject: [PATCH 002/116] Preparing to build 1.8.0 git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1695083 13f79535-47bb-0310-9956-ffa450edef68 --- lang/java/archetypes/avro-service-archetype/pom.xml | 2 +- lang/java/archetypes/pom.xml | 2 +- lang/java/avro/pom.xml | 2 +- lang/java/compiler/pom.xml | 2 +- lang/java/ipc/pom.xml | 2 +- lang/java/mapred/pom.xml | 2 +- lang/java/maven-plugin/pom.xml | 2 +- lang/java/pom.xml | 2 +- lang/java/protobuf/pom.xml | 2 +- lang/java/thrift/pom.xml | 2 +- lang/java/tools/pom.xml | 2 +- lang/java/trevni/avro/pom.xml | 2 +- lang/java/trevni/core/pom.xml | 2 +- lang/java/trevni/doc/pom.xml | 4 ++-- lang/java/trevni/pom.xml | 2 +- pom.xml | 2 +- share/VERSION.txt | 2 +- 17 files changed, 18 insertions(+), 18 deletions(-) diff --git a/lang/java/archetypes/avro-service-archetype/pom.xml b/lang/java/archetypes/avro-service-archetype/pom.xml index 4a959dd18d4..96fb809ffa0 100644 --- a/lang/java/archetypes/avro-service-archetype/pom.xml +++ b/lang/java/archetypes/avro-service-archetype/pom.xml @@ -23,7 +23,7 @@ avro-archetypes-parent org.apache.avro - 1.8.0-SNAPSHOT + 1.8.0 ../pom.xml diff --git a/lang/java/archetypes/pom.xml b/lang/java/archetypes/pom.xml index a7b8d4fefe9..194a1a62f43 100644 --- a/lang/java/archetypes/pom.xml +++ b/lang/java/archetypes/pom.xml @@ -22,7 +22,7 @@ org.apache.avro avro-parent - 1.8.0-SNAPSHOT + 1.8.0 ../pom.xml diff --git a/lang/java/avro/pom.xml b/lang/java/avro/pom.xml index a05fd4835dd..183d3d83535 100644 --- a/lang/java/avro/pom.xml +++ b/lang/java/avro/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.8.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/compiler/pom.xml b/lang/java/compiler/pom.xml index ef9cd5e2088..046c486b1da 100644 --- a/lang/java/compiler/pom.xml +++ b/lang/java/compiler/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.8.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/ipc/pom.xml b/lang/java/ipc/pom.xml index c752d27128b..98025596857 100644 --- a/lang/java/ipc/pom.xml +++ b/lang/java/ipc/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.8.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/mapred/pom.xml b/lang/java/mapred/pom.xml index 66ca4573e91..55f0239022a 100644 --- a/lang/java/mapred/pom.xml +++ b/lang/java/mapred/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.8.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/maven-plugin/pom.xml b/lang/java/maven-plugin/pom.xml index a0816d474f4..971e5efadab 100644 --- a/lang/java/maven-plugin/pom.xml +++ b/lang/java/maven-plugin/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.8.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/pom.xml b/lang/java/pom.xml index d2e74d92d83..003b1c00a89 100644 --- a/lang/java/pom.xml +++ b/lang/java/pom.xml @@ -22,7 +22,7 @@ org.apache.avro avro-toplevel - 1.8.0-SNAPSHOT + 1.8.0 ../../ diff --git a/lang/java/protobuf/pom.xml b/lang/java/protobuf/pom.xml index 77399f9f180..7ef5da849df 100644 --- a/lang/java/protobuf/pom.xml +++ b/lang/java/protobuf/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.8.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/thrift/pom.xml b/lang/java/thrift/pom.xml index 90d14465f1b..0df386cdc01 100644 --- a/lang/java/thrift/pom.xml +++ b/lang/java/thrift/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.8.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/tools/pom.xml b/lang/java/tools/pom.xml index 315e844ede9..787d53c5d0c 100644 --- a/lang/java/tools/pom.xml +++ b/lang/java/tools/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.8.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/trevni/avro/pom.xml b/lang/java/trevni/avro/pom.xml index a6408d1fea4..aa67ce55d88 100644 --- a/lang/java/trevni/avro/pom.xml +++ b/lang/java/trevni/avro/pom.xml @@ -22,7 +22,7 @@ trevni-java org.apache.avro - 1.8.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/trevni/core/pom.xml b/lang/java/trevni/core/pom.xml index 56a6e8110b0..c5004442c99 100644 --- a/lang/java/trevni/core/pom.xml +++ b/lang/java/trevni/core/pom.xml @@ -22,7 +22,7 @@ trevni-java org.apache.avro - 1.8.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/trevni/doc/pom.xml b/lang/java/trevni/doc/pom.xml index 810021beeaa..b0001ec98b4 100644 --- a/lang/java/trevni/doc/pom.xml +++ b/lang/java/trevni/doc/pom.xml @@ -22,13 +22,13 @@ trevni-java org.apache.avro - 1.8.0-SNAPSHOT + 1.8.0 .. org.apache.avro trevni-doc - 1.8.0-SNAPSHOT + 1.8.0 pom Trevni Specification diff --git a/lang/java/trevni/pom.xml b/lang/java/trevni/pom.xml index 69d0f1da938..2c7a1ef69ab 100644 --- a/lang/java/trevni/pom.xml +++ b/lang/java/trevni/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.8.0-SNAPSHOT + 1.8.0 ../ diff --git a/pom.xml b/pom.xml index 3bd0e2e7349..c3b6197b3fd 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ org.apache.avro avro-toplevel - 1.8.0-SNAPSHOT + 1.8.0 pom Apache Avro Toplevel diff --git a/share/VERSION.txt b/share/VERSION.txt index 53bc174cae0..afa2b3515e9 100644 --- a/share/VERSION.txt +++ b/share/VERSION.txt @@ -1 +1 @@ -1.8.0-SNAPSHOT \ No newline at end of file +1.8.0 \ No newline at end of file From 0c771b9a62b93055b93d8426c283be5ab87c212c Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 11 Aug 2015 09:58:35 +0000 Subject: [PATCH 003/116] Build fixes for 1.8.0. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1695236 13f79535-47bb-0310-9956-ffa450edef68 --- build.sh | 3 ++- lang/py/ivysettings.xml | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 7180fc6b12b..cce0cfb25b4 100755 --- a/build.sh +++ b/build.sh @@ -97,7 +97,8 @@ case "$target" in # build lang-specific artifacts (cd lang/java; mvn package -DskipTests -Dhadoop.version=1; - rm -rf mapred/target/classes/; rm -rf trevni/avro/target/classes/; + rm -rf mapred/target/{classes,test-classes}/; + rm -rf trevni/avro/target/{classes,test-classes}/; mvn -P dist package -DskipTests -Davro.version=$VERSION javadoc:aggregate) (cd lang/java/trevni/doc; mvn site) (mvn -N -P copy-artifacts antrun:run) diff --git a/lang/py/ivysettings.xml b/lang/py/ivysettings.xml index 7f1421891f0..31de16eddb2 100644 --- a/lang/py/ivysettings.xml +++ b/lang/py/ivysettings.xml @@ -16,10 +16,15 @@ --> + - + + + + + From fe9330e56d2d6d356344d5152ca8b4ff3b52b89c Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 25 Aug 2015 14:27:55 +0000 Subject: [PATCH 004/116] AVRO-1676. Java: Do not treat enum symbols as immutable when deep copying. Contributed by Mike Rodriguez. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1697684 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ .../java/org/apache/avro/generic/GenericData.java | 3 +-- .../org/apache/avro/specific/TestSpecificData.java | 12 ++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index afedefbb860..5e40fd81c1e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -181,6 +181,9 @@ Avro 1.8.0 (10 August 2014) AVRO-1491. Avro.ipc.dll not included in release zip/build file. (Dmitry Kovalev via tomwhite) + AVRO-1676. Java: Do not treat enum symbols as immutable when deep copying. + (Mike Rodriguez via tomwhite) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java index fe2128ae6c9..3bdfc7a1e7d 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java +++ b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java @@ -1049,8 +1049,7 @@ public T deepCopy(Schema schema, T value) { case DOUBLE: return value; // immutable case ENUM: - // Enums are immutable; shallow copy will suffice - return value; + return (T)createEnum(value.toString(), schema); case FIXED: return (T)createFixed(null, ((GenericFixed) value).bytes(), schema); case FLOAT: diff --git a/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificData.java b/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificData.java index d1a03777fd7..1a05a398335 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificData.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificData.java @@ -46,6 +46,8 @@ import org.apache.avro.test.Kind; import org.apache.avro.test.Reserved; +import org.apache.avro.generic.GenericRecord; + public class TestSpecificData { @Test @@ -101,6 +103,16 @@ public void testSpecificWithinGeneric() throws Exception { new SpecificDatumReader()); } + @Test public void testConvertGenericToSpecific() { + GenericRecord generic = new GenericData.Record(TestRecord.SCHEMA$); + generic.put("name", "foo"); + generic.put("kind", new GenericData.EnumSymbol(Kind.SCHEMA$, "BAR")); + generic.put("hash", new GenericData.Fixed + (MD5.SCHEMA$, new byte[]{0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5})); + TestRecord specific = + (TestRecord)SpecificData.get().deepCopy(TestRecord.SCHEMA$, generic); + } + @Test public void testGetClassSchema() throws Exception { Assert.assertEquals(TestRecord.getClassSchema(), TestRecord.SCHEMA$); Assert.assertEquals(MD5.getClassSchema(), MD5.SCHEMA$); From 782a9505e82028be7a087ac269e0a30c32ee3258 Mon Sep 17 00:00:00 2001 From: Sean Busbey Date: Sat, 12 Sep 2015 07:27:04 +0000 Subject: [PATCH 005/116] AVRO-1709. Ruby: Ignore generated files. Contributed by Daniel Schierbeck. The data.avr file is generated every times the tests are run; Gemfile.lock is generated every time `bundle install` is run. This closes #45 git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1702595 13f79535-47bb-0310-9956-ffa450edef68 --- lang/ruby/.gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lang/ruby/.gitignore b/lang/ruby/.gitignore index 1c2f433de18..3f9ddafa2ea 100644 --- a/lang/ruby/.gitignore +++ b/lang/ruby/.gitignore @@ -1 +1,3 @@ -tmp \ No newline at end of file +tmp +data.avr +Gemfile.lock From d94b460db57b5b7f0c981fbcc5794057c6680aaa Mon Sep 17 00:00:00 2001 From: Sean Busbey Date: Mon, 14 Sep 2015 00:07:07 +0000 Subject: [PATCH 006/116] AVRO-1694. Ruby: Schema normaliation and fingerprints. Contributed by Daniel Schierbeck. * Avro::SchemaNormalization.to_parsing_form converts a schema to Parsing Canonical Form * support for MD5 and SHA256 fingerprints This closes #40 git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1702840 13f79535-47bb-0310-9956-ffa450edef68 --- lang/ruby/lib/avro.rb | 1 + lang/ruby/lib/avro/schema.rb | 12 ++ lang/ruby/lib/avro/schema_normalization.rb | 83 ++++++++++ lang/ruby/test/case_finder.rb | 67 ++++++++ lang/ruby/test/test_fingerprints.rb | 37 +++++ lang/ruby/test/test_schema_normalization.rb | 171 ++++++++++++++++++++ 6 files changed, 371 insertions(+) create mode 100644 lang/ruby/lib/avro/schema_normalization.rb create mode 100644 lang/ruby/test/case_finder.rb create mode 100644 lang/ruby/test/test_fingerprints.rb create mode 100644 lang/ruby/test/test_schema_normalization.rb diff --git a/lang/ruby/lib/avro.rb b/lang/ruby/lib/avro.rb index 902dcd88033..c419ab1e6b3 100644 --- a/lang/ruby/lib/avro.rb +++ b/lang/ruby/lib/avro.rb @@ -39,3 +39,4 @@ def initialize(schm=nil, datum=nil, msg=nil) require 'avro/data_file' require 'avro/protocol' require 'avro/ipc' +require 'avro/schema_normalization' diff --git a/lang/ruby/lib/avro/schema.rb b/lang/ruby/lib/avro/schema.rb index 142157775ee..87f6fa4804e 100644 --- a/lang/ruby/lib/avro/schema.rb +++ b/lang/ruby/lib/avro/schema.rb @@ -137,6 +137,18 @@ def initialize(type) # Deprecated in favor of {#type_sym}. def type; @type_sym.to_s; end + # Returns the MD5 fingerprint of the schema as an Integer. + def md5_fingerprint + parsing_form = SchemaNormalization.to_parsing_form(self) + Digest::MD5.hexdigest(parsing_form).to_i(16) + end + + # Returns the SHA-256 fingerprint of the schema as an Integer. + def sha256_fingerprint + parsing_form = SchemaNormalization.to_parsing_form(self) + Digest::SHA256.hexdigest(parsing_form).to_i(16) + end + def ==(other, seen=nil) other.is_a?(Schema) && type_sym == other.type_sym end diff --git a/lang/ruby/lib/avro/schema_normalization.rb b/lang/ruby/lib/avro/schema_normalization.rb new file mode 100644 index 00000000000..0a5bee5d0cc --- /dev/null +++ b/lang/ruby/lib/avro/schema_normalization.rb @@ -0,0 +1,83 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +module Avro + class SchemaNormalization + def self.to_parsing_form(schema) + new.to_parsing_form(schema) + end + + def initialize + @processed_names = [] + end + + def to_parsing_form(schema) + JSON.dump(normalize_schema(schema)) + end + + private + + def normalize_schema(schema) + type = schema.type_sym.to_s + + if Schema::NAMED_TYPES.include?(type) + if @processed_names.include?(schema.name) + return schema.name + else + @processed_names << schema.name + end + end + + case type + when *Schema::PRIMITIVE_TYPES + type + when "record" + fields = schema.fields.map {|field| normalize_field(field) } + + normalize_named_type(schema, fields: fields) + when "enum" + normalize_named_type(schema, symbols: schema.symbols) + when "fixed" + normalize_named_type(schema, size: schema.size) + when "array" + { type: type, items: normalize_schema(schema.items) } + when "map" + { type: type, values: normalize_schema(schema.values) } + when "union" + if schema.schemas.nil? + [] + else + schema.schemas.map {|s| normalize_schema(s) } + end + else + raise "unknown type #{type}" + end + end + + def normalize_field(field) + { + name: field.name, + type: normalize_schema(field.type) + } + end + + def normalize_named_type(schema, attributes = {}) + name = Name.make_fullname(schema.name, schema.namespace) + + { name: name, type: schema.type_sym.to_s }.merge(attributes) + end + end +end diff --git a/lang/ruby/test/case_finder.rb b/lang/ruby/test/case_finder.rb new file mode 100644 index 00000000000..eb5424a09f4 --- /dev/null +++ b/lang/ruby/test/case_finder.rb @@ -0,0 +1,67 @@ +class CaseFinder + PATH = File.expand_path("../../../../share/test/data/schema-tests.txt", __FILE__) + + Case = Struct.new(:id, :input, :canonical, :fingerprint) + + def self.cases + new.cases + end + + def initialize + @scanner = StringScanner.new(File.read(PATH)) + @cases = [] + end + + def cases + until @scanner.eos? + test_case = scan_case + @cases << test_case if test_case + end + + @cases + end + + private + + def scan_case + if id = @scanner.scan(/\/\/ \d+\n/) + while @scanner.skip(/\/\/ .*\n/); end + + input = scan_input + canonical = scan_canonical + fingerprint = scan_fingerprint + + Case.new(id, input, canonical, fingerprint) + else + @scanner.skip(/.*\n/) + nil + end + end + + def scan_item(name) + if @scanner.scan(/<<#{name}\n/) + lines = [] + while line = @scanner.scan(/.+\n/) + break if line.chomp == name + lines << line + end + lines.join + elsif @scanner.scan(/<<#{name} /) + input = @scanner.scan(/.+$/) + @scanner.skip(/\n/) + input + end + end + + def scan_input + scan_item("INPUT") + end + + def scan_canonical + scan_item("canonical") + end + + def scan_fingerprint + scan_item("fingerprint") + end +end diff --git a/lang/ruby/test/test_fingerprints.rb b/lang/ruby/test/test_fingerprints.rb new file mode 100644 index 00000000000..d43aad86ed9 --- /dev/null +++ b/lang/ruby/test/test_fingerprints.rb @@ -0,0 +1,37 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'test_help' + +class TestFingerprints < Test::Unit::TestCase + def test_md5_fingerprint + schema = Avro::Schema.parse <<-SCHEMA + { "type": "int" } + SCHEMA + + assert_equal 318112854175969537208795771590915775282, + schema.md5_fingerprint + end + + def test_sha256_fingerprint + schema = Avro::Schema.parse <<-SCHEMA + { "type": "int" } + SCHEMA + + assert_equal 28572620203319713300323544804233350633246234624932075150020181448463213378117, + schema.sha256_fingerprint + end +end diff --git a/lang/ruby/test/test_schema_normalization.rb b/lang/ruby/test/test_schema_normalization.rb new file mode 100644 index 00000000000..f61dd2f0e93 --- /dev/null +++ b/lang/ruby/test/test_schema_normalization.rb @@ -0,0 +1,171 @@ +# -*- coding: utf-8 -*- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'test_help' +require 'case_finder' + +class TestSchemaNormalization < Test::Unit::TestCase + def test_primitives + %w[null boolean string bytes int long float double].each do |type| + schema = Avro::Schema.parse(<<-JSON) + { "type": "#{type}" } + JSON + + canonical_form = Avro::SchemaNormalization.to_parsing_form(schema) + + assert_equal %("#{type}"), canonical_form + end + end + + def test_records + schema = Avro::Schema.parse(<<-JSON) + { + "type": "record", + "name": "test", + "namespace": "random", + "doc": "some record", + "fields": [ + { "name": "height", "type": "int", "doc": "the height" } + ] + } + JSON + + expected_type = <<-JSON.strip + {"name":"random.test","type":"record","fields":[{"name":"height","type":"int"}]} + JSON + + canonical_form = Avro::SchemaNormalization.to_parsing_form(schema) + + assert_equal expected_type, canonical_form + end + + def test_recursive_records + schema = Avro::Schema.parse(<<-JSON) + { + "type": "record", + "name": "item", + "fields": [ + { "name": "next", "type": "item" } + ] + } + JSON + + expected_type = <<-JSON.strip + {"name":"item","type":"record","fields":[{"name":"next","type":"item"}]} + JSON + + canonical_form = Avro::SchemaNormalization.to_parsing_form(schema) + + assert_equal expected_type, canonical_form + end + + def test_enums + schema = Avro::Schema.parse(<<-JSON) + { + "type": "enum", + "name": "suit", + "namespace": "cards", + "doc": "the different suits of cards", + "symbols": ["club", "hearts", "diamond", "spades"] + } + JSON + + expected_type = <<-JSON.strip + {"name":"cards.suit","type":"enum","symbols":["club","hearts","diamond","spades"]} + JSON + + canonical_form = Avro::SchemaNormalization.to_parsing_form(schema) + + assert_equal expected_type, canonical_form + end + + def test_fixed + schema = Avro::Schema.parse(<<-JSON) + { + "type": "fixed", + "name": "id", + "namespace": "db", + "size": 64 + } + JSON + + expected_type = <<-JSON.strip + {"name":"db.id","type":"fixed","size":64} + JSON + + canonical_form = Avro::SchemaNormalization.to_parsing_form(schema) + + assert_equal expected_type, canonical_form + end + + def test_arrays + schema = Avro::Schema.parse(<<-JSON) + { + "type": "array", + "doc": "the items", + "items": "int" + } + JSON + + expected_type = <<-JSON.strip + {"type":"array","items":"int"} + JSON + + canonical_form = Avro::SchemaNormalization.to_parsing_form(schema) + + assert_equal expected_type, canonical_form + end + + def test_maps + schema = Avro::Schema.parse(<<-JSON) + { + "type": "map", + "doc": "the items", + "values": "int" + } + JSON + + expected_type = <<-JSON.strip + {"type":"map","values":"int"} + JSON + + canonical_form = Avro::SchemaNormalization.to_parsing_form(schema) + + assert_equal expected_type, canonical_form + end + + def test_unions + schema = Avro::Schema.parse(<<-JSON) + ["int", "string"] + JSON + + expected_type = <<-JSON.strip + ["int","string"] + JSON + + canonical_form = Avro::SchemaNormalization.to_parsing_form(schema) + + assert_equal expected_type, canonical_form + end + + def test_shared_dataset + CaseFinder.cases.each do |test_case| + schema = Avro::Schema.parse(test_case.input) + assert_equal test_case.canonical, Avro::SchemaNormalization.to_parsing_form(schema) + end + end +end From ed6a4e1f2aad7cea85bd956165fb7f66277533ea Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 25 Nov 2015 14:20:14 +0000 Subject: [PATCH 007/116] =?UTF-8?q?AVRO-1755.=20Java:=20avro-mapred=20shou?= =?UTF-8?q?ld=20not=20depend=20on=20avro-ipc:test.=20Contributed=20by=20Cl?= =?UTF-8?q?=C3=A9ment=20MAHTIEU.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1716425 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ lang/java/mapred/pom.xml | 1 + 2 files changed, 4 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 5e40fd81c1e..69b5a591847 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -184,6 +184,9 @@ Avro 1.8.0 (10 August 2014) AVRO-1676. Java: Do not treat enum symbols as immutable when deep copying. (Mike Rodriguez via tomwhite) + AVRO-1755. Java: avro-mapred should not depend on avro-ipc:test. + (Clément MAHTIEU via tomwhite) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/lang/java/mapred/pom.xml b/lang/java/mapred/pom.xml index 55f0239022a..eb4af58b974 100644 --- a/lang/java/mapred/pom.xml +++ b/lang/java/mapred/pom.xml @@ -123,6 +123,7 @@ avro-ipc tests ${project.version} + test ${project.groupId} From b1c5555a70e296c7ea2768c9b6a4adc135ced3bc Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Wed, 16 Dec 2015 00:18:59 +0000 Subject: [PATCH 008/116] Preparing to build 1.8.0. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1720283 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 -- lang/java/archetypes/avro-service-archetype/pom.xml | 2 +- lang/java/archetypes/pom.xml | 2 +- lang/java/avro/pom.xml | 2 +- lang/java/compiler/pom.xml | 2 +- lang/java/ipc/pom.xml | 2 +- lang/java/mapred/pom.xml | 2 +- lang/java/maven-plugin/pom.xml | 2 +- lang/java/pom.xml | 2 +- lang/java/protobuf/pom.xml | 2 +- lang/java/thrift/pom.xml | 2 +- lang/java/tools/pom.xml | 2 +- lang/java/trevni/avro/pom.xml | 2 +- lang/java/trevni/core/pom.xml | 2 +- lang/java/trevni/doc/pom.xml | 4 ++-- lang/java/trevni/pom.xml | 2 +- pom.xml | 2 +- share/VERSION.txt | 2 +- 18 files changed, 18 insertions(+), 20 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index f327a2db81a..a43559b697a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,7 +1,5 @@ Avro Change Log -Trunk (not yet released) - Avro 1.8.0 (15 December 2015) diff --git a/lang/java/archetypes/avro-service-archetype/pom.xml b/lang/java/archetypes/avro-service-archetype/pom.xml index b0f380c62d5..96fb809ffa0 100644 --- a/lang/java/archetypes/avro-service-archetype/pom.xml +++ b/lang/java/archetypes/avro-service-archetype/pom.xml @@ -23,7 +23,7 @@ avro-archetypes-parent org.apache.avro - 1.9.0-SNAPSHOT + 1.8.0 ../pom.xml diff --git a/lang/java/archetypes/pom.xml b/lang/java/archetypes/pom.xml index 7e72ed494d0..194a1a62f43 100644 --- a/lang/java/archetypes/pom.xml +++ b/lang/java/archetypes/pom.xml @@ -22,7 +22,7 @@ org.apache.avro avro-parent - 1.9.0-SNAPSHOT + 1.8.0 ../pom.xml diff --git a/lang/java/avro/pom.xml b/lang/java/avro/pom.xml index e0484db050c..183d3d83535 100644 --- a/lang/java/avro/pom.xml +++ b/lang/java/avro/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.9.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/compiler/pom.xml b/lang/java/compiler/pom.xml index 42e6d27c8ff..d49e4f15c1d 100644 --- a/lang/java/compiler/pom.xml +++ b/lang/java/compiler/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.9.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/ipc/pom.xml b/lang/java/ipc/pom.xml index 186967fc943..98025596857 100644 --- a/lang/java/ipc/pom.xml +++ b/lang/java/ipc/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.9.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/mapred/pom.xml b/lang/java/mapred/pom.xml index dc2161d8001..eb4af58b974 100644 --- a/lang/java/mapred/pom.xml +++ b/lang/java/mapred/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.9.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/maven-plugin/pom.xml b/lang/java/maven-plugin/pom.xml index 93811e5898f..971e5efadab 100644 --- a/lang/java/maven-plugin/pom.xml +++ b/lang/java/maven-plugin/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.9.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/pom.xml b/lang/java/pom.xml index 30d456281ba..ce21881dec7 100644 --- a/lang/java/pom.xml +++ b/lang/java/pom.xml @@ -22,7 +22,7 @@ org.apache.avro avro-toplevel - 1.9.0-SNAPSHOT + 1.8.0 ../../ diff --git a/lang/java/protobuf/pom.xml b/lang/java/protobuf/pom.xml index 0944b53d770..7ef5da849df 100644 --- a/lang/java/protobuf/pom.xml +++ b/lang/java/protobuf/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.9.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/thrift/pom.xml b/lang/java/thrift/pom.xml index 07fe52bd924..0df386cdc01 100644 --- a/lang/java/thrift/pom.xml +++ b/lang/java/thrift/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.9.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/tools/pom.xml b/lang/java/tools/pom.xml index c1e5f69291f..4190fabf9a1 100644 --- a/lang/java/tools/pom.xml +++ b/lang/java/tools/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.9.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/trevni/avro/pom.xml b/lang/java/trevni/avro/pom.xml index 84895a5c845..aa67ce55d88 100644 --- a/lang/java/trevni/avro/pom.xml +++ b/lang/java/trevni/avro/pom.xml @@ -22,7 +22,7 @@ trevni-java org.apache.avro - 1.9.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/trevni/core/pom.xml b/lang/java/trevni/core/pom.xml index 8e96aa95b13..c5004442c99 100644 --- a/lang/java/trevni/core/pom.xml +++ b/lang/java/trevni/core/pom.xml @@ -22,7 +22,7 @@ trevni-java org.apache.avro - 1.9.0-SNAPSHOT + 1.8.0 ../ diff --git a/lang/java/trevni/doc/pom.xml b/lang/java/trevni/doc/pom.xml index d3ce79c9a60..b0001ec98b4 100644 --- a/lang/java/trevni/doc/pom.xml +++ b/lang/java/trevni/doc/pom.xml @@ -22,13 +22,13 @@ trevni-java org.apache.avro - 1.9.0-SNAPSHOT + 1.8.0 .. org.apache.avro trevni-doc - 1.9.0-SNAPSHOT + 1.8.0 pom Trevni Specification diff --git a/lang/java/trevni/pom.xml b/lang/java/trevni/pom.xml index 13e64989971..2c7a1ef69ab 100644 --- a/lang/java/trevni/pom.xml +++ b/lang/java/trevni/pom.xml @@ -23,7 +23,7 @@ avro-parent org.apache.avro - 1.9.0-SNAPSHOT + 1.8.0 ../ diff --git a/pom.xml b/pom.xml index a9b83716267..f9a5322b8f1 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ org.apache.avro avro-toplevel - 1.9.0-SNAPSHOT + 1.8.0 pom Apache Avro Toplevel diff --git a/share/VERSION.txt b/share/VERSION.txt index 06898e3dc5c..27f9cd322bb 100644 --- a/share/VERSION.txt +++ b/share/VERSION.txt @@ -1 +1 @@ -1.9.0-SNAPSHOT \ No newline at end of file +1.8.0 From eff0765112207fb19c9d2efd0a14077822a7df0a Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 16 Dec 2015 13:39:23 +0000 Subject: [PATCH 009/116] Remove errant newline from VERSION.txt. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1720356 13f79535-47bb-0310-9956-ffa450edef68 --- lang/ruby/build.sh | 1 + share/VERSION.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lang/ruby/build.sh b/lang/ruby/build.sh index 8fea5656032..6dbd78ca04b 100755 --- a/lang/ruby/build.sh +++ b/lang/ruby/build.sh @@ -38,6 +38,7 @@ case "$1" in ;; clean) + bundle install bundle exec rake clean ;; diff --git a/share/VERSION.txt b/share/VERSION.txt index 27f9cd322bb..afa2b3515e9 100644 --- a/share/VERSION.txt +++ b/share/VERSION.txt @@ -1 +1 @@ -1.8.0 +1.8.0 \ No newline at end of file From 561671b051f565418d4989a1bbed357c8e9a3871 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 16 Dec 2015 14:21:56 +0000 Subject: [PATCH 010/116] Add sleep statement to Python tests to avoid race condition. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1720361 13f79535-47bb-0310-9956-ffa450edef68 --- lang/py/test/test_tether_task_runner.py | 3 +++ lang/py/test/test_tether_word_count.py | 1 + 2 files changed, 4 insertions(+) diff --git a/lang/py/test/test_tether_task_runner.py b/lang/py/test/test_tether_task_runner.py index a3f10fe5232..733e853bc35 100644 --- a/lang/py/test/test_tether_task_runner.py +++ b/lang/py/test/test_tether_task_runner.py @@ -59,6 +59,9 @@ def test1(self): runner.start(outputport=parent_port,join=False) + # Wait for the server to start + time.sleep(1) + # Test sending various messages to the server and ensuring they are # processed correctly requestor=HTTPRequestor("localhost",runner.server.server_address[1],inputProtocol) diff --git a/lang/py/test/test_tether_word_count.py b/lang/py/test/test_tether_word_count.py index 6e51d31894e..bff6468a025 100644 --- a/lang/py/test/test_tether_word_count.py +++ b/lang/py/test/test_tether_word_count.py @@ -189,6 +189,7 @@ def test1(self): proc.wait() + time.sleep(1) # wait a bit longer to clean up # read the output with file(os.path.join(outpath,"part-00000.avro")) as hf: From ab8a15ac2b6685264d88d2c7aaa48d16907ecd17 Mon Sep 17 00:00:00 2001 From: Martin Kleppmann Date: Wed, 30 Dec 2015 15:32:01 +0000 Subject: [PATCH 011/116] AVRO-1572: C: Fix EOF handling on data files that are multiples of 4096 bytes. (Ben Walsh via martinkl) git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1722355 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 + lang/c/src/datafile.c | 15 ++-- lang/c/tests/CMakeLists.txt | 1 + lang/c/tests/test_avro_1572.c | 164 ++++++++++++++++++++++++++++++++++ 4 files changed, 178 insertions(+), 5 deletions(-) create mode 100644 lang/c/tests/test_avro_1572.c diff --git a/CHANGES.txt b/CHANGES.txt index a43559b697a..5ce17adf7a3 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -227,6 +227,9 @@ Avro 1.8.0 (15 December 2015) AVRO-1728: Java: Add LICENSE and NOTICE files to jars. (blue) + AVRO-1572: C: Fix EOF handling on data files that are multiples of + 4096 bytes. (Ben Walsh via martinkl) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/lang/c/src/datafile.c b/lang/c/src/datafile.c index 0ee98790a60..f2da6037681 100644 --- a/lang/c/src/datafile.c +++ b/lang/c/src/datafile.c @@ -439,7 +439,15 @@ static int file_read_block_count(avro_file_reader_t r) int rval; int64_t len; const avro_encoding_t *enc = &avro_binary_encoding; - check_prefix(rval, enc->read_long(r->reader, &r->blocks_total), + + /* For a correctly formatted file, EOF will occur here */ + rval = enc->read_long(r->reader, &r->blocks_total); + + if (rval == EILSEQ && avro_reader_is_eof(r->reader)) { + return EOF; + } + + check_prefix(rval, rval, "Cannot read file block count: "); check_prefix(rval, enc->read_long(r->reader, &len), "Cannot read file block size: "); @@ -710,6 +718,7 @@ avro_file_reader_read_value(avro_file_reader_t r, avro_value_t *value) check_param(EINVAL, value, "value"); if (r->blocks_read == r->blocks_total) { + /* reads sync bytes and buffers further bytes */ check(rval, avro_read(r->reader, sync, sizeof(sync))); if (memcmp(r->sync, sync, sizeof(r->sync)) != 0) { /* wrong sync bytes */ @@ -717,10 +726,6 @@ avro_file_reader_read_value(avro_file_reader_t r, avro_value_t *value) return EILSEQ; } - /* Did we just hit the end of the file? */ - if (avro_reader_is_eof(r->reader)) - return EOF; - check(rval, file_read_block_count(r)); } diff --git a/lang/c/tests/CMakeLists.txt b/lang/c/tests/CMakeLists.txt index 0f2c99329d7..2e51005220d 100644 --- a/lang/c/tests/CMakeLists.txt +++ b/lang/c/tests/CMakeLists.txt @@ -58,6 +58,7 @@ add_avro_test(test_avro_1237) add_avro_test(test_avro_1238) add_avro_test(test_avro_1279) add_avro_test(test_avro_1405) +add_avro_test(test_avro_1572) add_avro_test(test_avro_data) add_avro_test(test_refcount) add_avro_test(test_cpp test_cpp.cpp) diff --git a/lang/c/tests/test_avro_1572.c b/lang/c/tests/test_avro_1572.c new file mode 100644 index 00000000000..0667b7c4426 --- /dev/null +++ b/lang/c/tests/test_avro_1572.c @@ -0,0 +1,164 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +#include +#include +#include "avro.h" + +#define BUFFER_LEN 4096 + +#define HEADER_LEN 116 +#define SYNC_LEN 16 +#define BLOCKINFO_LEN 4 +#define RECORD_LEN 1 + +static const int NUM_RECORDS1 = (BUFFER_LEN - HEADER_LEN - 2 * SYNC_LEN - BLOCKINFO_LEN) / RECORD_LEN; +static const int NUM_RECORDS2 = (BUFFER_LEN - SYNC_LEN - BLOCKINFO_LEN) / RECORD_LEN; + +static const char PERSON_SCHEMA[] = + "{" + " \"type\":\"record\"," + " \"name\":\"Person\"," + " \"fields\": [" + " {\"name\": \"ab\", \"type\": \"int\"}" + " ]" + "}"; + +static const char *filename = "avro_file.dat"; + +static int read_data() { + int rval; + int records_read = 0; + + avro_file_reader_t reader; + avro_value_iface_t *iface; + avro_value_t value; + + fprintf(stderr, "\nReading...\n"); + + avro_file_reader(filename, &reader); + avro_schema_t schema = avro_file_reader_get_writer_schema(reader); + + iface = avro_generic_class_from_schema(schema); + avro_generic_value_new(iface, &value); + + while ((rval = avro_file_reader_read_value(reader, &value)) == 0) { + records_read++; + avro_value_reset(&value); + } + + avro_value_decref(&value); + avro_value_iface_decref(iface); + avro_schema_decref(schema); + avro_file_reader_close(reader); + + fprintf(stderr, "wanted %d records, read %d records.\n", NUM_RECORDS1 + NUM_RECORDS2, records_read); + + if (rval != EOF || records_read != (NUM_RECORDS1 + NUM_RECORDS2)) { + fprintf(stderr, "Error: %s\n", avro_strerror()); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} + +static off_t fsize(const char *filename) { + struct stat st; + + if (stat(filename, &st) == 0) { + return st.st_size; + } + + return -1; +} + +static int write_data() { + int i; + avro_schema_t schema; + avro_schema_error_t error; + avro_file_writer_t writer; + avro_value_iface_t *iface; + avro_value_t value; + avro_value_t field; + + fprintf(stderr, "\nWriting...\n"); + + if (avro_schema_from_json(PERSON_SCHEMA, 0, &schema, &error)) { + fprintf(stderr, "Unable to parse schema\n"); + return EXIT_FAILURE; + } + + iface = avro_generic_class_from_schema(schema); + avro_generic_value_new(iface, &value); + + if (avro_file_writer_create(filename, schema, &writer)) { + fprintf(stderr, "There was an error creating file: %s\n", avro_strerror()); + return EXIT_FAILURE; + } + + avro_value_get_by_name(&value, "ab", &field, NULL); + avro_value_set_int(&field, 1); + + fprintf(stderr, "NUM_RECORDS1 = %d NUM_RECORDS2 = %d\n", NUM_RECORDS1, NUM_RECORDS2); + + for (i = 0; i < NUM_RECORDS1; i++) { + avro_file_writer_append_value(writer, &value); + } + + avro_file_writer_close(writer); + + /* Make sure the sync ends at a BUFFER_LEN boundary */ + if (fsize(filename) != BUFFER_LEN) { + fprintf(stderr, "internal error\n"); + return EXIT_FAILURE; + } + + avro_file_writer_open(filename, &writer); + + for (i = 0; i < NUM_RECORDS2; i++) { + avro_file_writer_append_value(writer, &value); + } + + avro_file_writer_close(writer); + + /* Make sure the whole file ends at a BUFFER_LEN boundary. */ + if (fsize(filename) != 2 * BUFFER_LEN) { + fprintf(stderr, "internal error\n"); + return EXIT_FAILURE; + } + + avro_value_iface_decref(iface); + avro_value_decref(&value); + avro_schema_decref(schema); + + return EXIT_SUCCESS; +} + + +int main() +{ + int read_data_result; + + if (write_data()) { + return EXIT_FAILURE; + } + + read_data_result = read_data(); + remove(filename); + + return read_data_result; +} From 37d9f0ca38ccdf1c51ecacf9d679a506d359e2be Mon Sep 17 00:00:00 2001 From: Martin Kleppmann Date: Wed, 30 Dec 2015 15:43:57 +0000 Subject: [PATCH 012/116] AVRO-1617: C: Fix equality checking of record schemas. Contributed by Skye Wanderman-Milne. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1722362 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ lang/c/src/schema_equal.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 5ce17adf7a3..fc5eaa18a57 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -230,6 +230,9 @@ Avro 1.8.0 (15 December 2015) AVRO-1572: C: Fix EOF handling on data files that are multiples of 4096 bytes. (Ben Walsh via martinkl) + AVRO-1617: C: Fix equality checking of record schemas. (Skye + Wanderman-Milne via martinkl) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/lang/c/src/schema_equal.c b/lang/c/src/schema_equal.c index 287d2183b6f..0be1e832203 100644 --- a/lang/c/src/schema_equal.c +++ b/lang/c/src/schema_equal.c @@ -33,6 +33,10 @@ schema_record_equal(struct avro_record_schema_t *a, if (nullstrcmp(a->space, b->space)) { return 0; } + if (a->fields->num_entries != b->fields->num_entries) { + /* They have different numbers of fields */ + return 0; + } for (i = 0; i < a->fields->num_entries; i++) { union { st_data_t data; From 9d5ae9919dfdd8d634704ae47c22c2b43662f7e6 Mon Sep 17 00:00:00 2001 From: Martin Kleppmann Date: Wed, 30 Dec 2015 15:52:33 +0000 Subject: [PATCH 013/116] AVRO-1560: C: Fix build for custom libsnappy location. Contributed by Ujjwal. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1722365 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ lang/c/CMakeLists.txt | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index fc5eaa18a57..69a2684c6e9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -233,6 +233,8 @@ Avro 1.8.0 (15 December 2015) AVRO-1617: C: Fix equality checking of record schemas. (Skye Wanderman-Milne via martinkl) + AVRO-1560: C: Fix build for custom libsnappy location. (Ujjwal via martinkl) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/lang/c/CMakeLists.txt b/lang/c/CMakeLists.txt index a223f341b49..973a650ca34 100644 --- a/lang/c/CMakeLists.txt +++ b/lang/c/CMakeLists.txt @@ -144,6 +144,7 @@ find_package(Snappy) if (SNAPPY_FOUND AND ZLIB_FOUND) # Snappy borrows crc32 from zlib set(SNAPPY_PKG libsnappy) add_definitions(-DSNAPPY_CODEC) + include_directories(${SNAPPY_INCLUDE_DIR}) message("Enabled snappy codec") else (SNAPPY_FOUND AND ZLIB_FOUND) set(SNAPPY_PKG "") From a8a39c2900559bf2c3f59282f62e7b13603408db Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 6 Jan 2016 11:51:32 +0000 Subject: [PATCH 014/116] AVRO-1770. Python 3 overwrites custom README.txt. Contributed by blue. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1723288 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ lang/py3/setup.py | 6 ------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 69a2684c6e9..cc079c547dd 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -235,6 +235,8 @@ Avro 1.8.0 (15 December 2015) AVRO-1560: C: Fix build for custom libsnappy location. (Ujjwal via martinkl) + AVRO-1770. Python 3 overwrites custom README.txt (blue via tomwhite) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/lang/py3/setup.py b/lang/py3/setup.py index 3673f11800e..38f711798d9 100644 --- a/lang/py3/setup.py +++ b/lang/py3/setup.py @@ -59,12 +59,6 @@ def SetupSources(): # Avro top-level source directory: root_dir = os.path.dirname(os.path.dirname(py3_dir)) - # Copy README.txt from Avro top-level directory: - shutil.copy( - src=os.path.join(root_dir, 'README.txt'), - dst=os.path.join(py3_dir, 'README.txt'), - ) - # Read and copy Avro version: version_file_path = os.path.join(root_dir, 'share', VERSION_FILE_NAME) with open(version_file_path, 'r') as f: From 059e6dff3b0f6ccec866f7061815766f43d7ce22 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 6 Jan 2016 12:06:41 +0000 Subject: [PATCH 015/116] AVRO-1771. Add LICENSE and NOTICE to avro-doc artifact. Contributed by blue. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1723293 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 + build.sh | 6 +- doc/LICENSE | 330 ++++++++++++++++++++++++++++++++++++++++++++++++++++ doc/NOTICE | 83 +++++++++++++ 4 files changed, 420 insertions(+), 1 deletion(-) create mode 100644 doc/LICENSE create mode 100644 doc/NOTICE diff --git a/CHANGES.txt b/CHANGES.txt index cc079c547dd..5a0037ee340 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -237,6 +237,8 @@ Avro 1.8.0 (15 December 2015) AVRO-1770. Python 3 overwrites custom README.txt (blue via tomwhite) + AVRO-1771. Add LICENSE and NOTICE to avro-doc artifact. (blue via tomwhite) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/build.sh b/build.sh index abfb7bee9ae..ab0cd584096 100755 --- a/build.sh +++ b/build.sh @@ -84,6 +84,7 @@ case "$target" in mkdir -p build SRC_DIR=avro-src-$VERSION + DOC_DIR=avro-doc-$VERSION rm -rf build/${SRC_DIR} svn export --force . build/${SRC_DIR} @@ -124,7 +125,10 @@ case "$target" in # build docs (cd doc; ant) - (cd build; tar czf ../dist/avro-doc-$VERSION.tar.gz avro-doc-$VERSION) + # add LICENSE and NOTICE for docs + cp doc/LICENSE $DOC_DIR + cp doc/NOTICE $DOC_DIR + (cd build; tar czf ../dist/avro-doc-$VERSION.tar.gz $DOC_DIR) cp DIST_README.txt dist/README.txt ;; diff --git a/doc/LICENSE b/doc/LICENSE new file mode 100644 index 00000000000..d8e72947a5b --- /dev/null +++ b/doc/LICENSE @@ -0,0 +1,330 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +---------------------------------------------------------------------- +License for the AVRO_BOOT_NO_TRAIT code in the C++ implementation: +File: lang/c++/api/Boost.hh + +| Boost Software License - Version 1.0 - August 17th, 2003 +| +| Permission is hereby granted, free of charge, to any person or organization +| obtaining a copy of the software and accompanying documentation covered by +| this license (the "Software") to use, reproduce, display, distribute, +| execute, and transmit the Software, and to prepare derivative works of the +| Software, and to permit third-parties to whom the Software is furnished to +| do so, all subject to the following: +| +| The copyright notices in the Software and this entire statement, including +| the above license grant, this restriction and the following disclaimer, +| must be included in all copies of the Software, in whole or in part, and +| all derivative works of the Software, unless such copies or derivative +| works are solely in the form of machine-executable object code generated by +| a source language processor. +| +| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +| FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +| SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +| FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +| ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +| DEALINGS IN THE SOFTWARE. + +---------------------------------------------------------------------- +License for jQuery v1.7.1 used in the C# documentation + +Copyright 2010-2011, John Resig +Dual licensed under the MIT or GPL Version 2 licenses. +http://jquery.org/license + +jQuery includes Sizzle.js +http://sizzlejs.com/ +Copyright 2010-2011, The Dojo Foundation +Released under the MIT, BSD, and GPL Licenses. + +Both are included under the terms of the MIT license: + +| Permission is hereby granted, free of charge, to any person obtaining a copy +| of this software and associated documentation files (the "Software"), to deal +| in the Software without restriction, including without limitation the rights +| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +| copies of the Software, and to permit persons to whom the Software is +| furnished to do so, subject to the following conditions: +| +| The above copyright notice and this permission notice shall be included in +| all copies or substantial portions of the Software. +| +| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +| THE SOFTWARE. + +---------------------------------------------------------------------- +License for portions of idl.jj in the Java compiler implementation: + +Portions of idl.jj were modeled after the example Java 1.5 +parser included with JavaCC. For those portions: + +Copyright (c) 2006, Sun Microsystems, Inc. +All rights reserved. + +| Redistribution and use in source and binary forms, with or without +| modification, are permitted provided that the following conditions are met: +| +| * Redistributions of source code must retain the above copyright notice, +| this list of conditions and the following disclaimer. +| * Redistributions in binary form must reproduce the above copyright +| notice, this list of conditions and the following disclaimer in the +| documentation and/or other materials provided with the distribution. +| * Neither the name of the Sun Microsystems, Inc. nor the names of its +| contributors may be used to endorse or promote products derived from +| this software without specific prior written permission. +| +| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +| ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +| LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +| CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +| SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +| INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +| CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +| THE POSSIBILITY OF SUCH DAMAGE. + +---------------------------------------------------------------------- +License for prototype.js included in the Avro documentation: + +Prototype JavaScript framework, version 1.4.0_pre4 +(c) 2005 Sam Stephenson + +| Prototype is freely distributable under the terms of an MIT-style license. +| +| For details, see the Prototype web site: http://prototype.conio.net/ + +For a copy of the MIT license text, see above. + +---------------------------------------------------------------------- +License for Apache Forrest (skin), included in the Avro documentation: + +Copyright: 2009-2015 The Apache Software Foundation +License: http://www.apache.org/licenses/LICENSE-2.0 (see above) + +---------------------------------------------------------------------- +License for Doxygen-generated documentation for the C++ and C# implementations: + +Copyright © 1997-2015 by Dimitri van Heesch. + +| Doxygen license +| +| Permission to use, copy, modify, and distribute this software and its +| documentation under the terms of the GNU General Public License is hereby +| granted. No representations are made about the suitability of this software for +| any purpose. It is provided "as is" without express or implied warranty. See +| the GNU General Public License for more details. +| +| Documents produced by doxygen are derivative works derived from the input +| used in their production; they are not affected by this license. + diff --git a/doc/NOTICE b/doc/NOTICE new file mode 100644 index 00000000000..8f118a0fede --- /dev/null +++ b/doc/NOTICE @@ -0,0 +1,83 @@ +Apache Avro +Copyright 2010-2015 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). + +Based upon the representations of upstream licensors, it is understood that +portions of the mapreduce API included in the Java implementation are licensed +from various contributors under one or more contributor license agreements to +Odiago, Inc. and were then contributed by Odiago to Apache Avro, which has now +made them available under the Apache 2.0 license. The original file header text +is: + +| Licensed to Odiago, Inc. under one or more contributor license +| agreements. See the NOTICE file distributed with this work for +| additional information regarding copyright ownership. Odiago, Inc. +| licenses this file to you under the Apache License, Version 2.0 +| (the "License"); you may not use this file except in compliance +| with the License. You may obtain a copy of the License at +| +| http://www.apache.org/licenses/LICENSE-2.0 +| +| Unless required by applicable law or agreed to in writing, software +| distributed under the License is distributed on an "AS IS" BASIS, +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +| implied. See the License for the specific language governing +| permissions and limitations under the License. + +The Odiago NOTICE at the time of the contribution: + +| This product includes software developed by Odiago, Inc. +| (http://www.wibidata.com). + +The documentation contains the default Apache Forrest skin. +Apache Forrest includes the following in its NOTICE file: + +| Apache Forrest +| Copyright 2002-2007 The Apache Software Foundation. +| +| This product includes software developed at +| The Apache Software Foundation (http://www.apache.org/). +| +| See also the file LICENSE.txt +| +| ------------------------------------------------------------------------ +| The purpose of this NOTICE.txt file is to contain notices that are +| required by the copyright owner and their license. Some of the +| accompanying products have an attribution requirement, so see below. +| Other accompanying products do not require attribution, so are not listed. +| +| ------------------------------------------------------------------------ +| This product includes software developed by the OpenSymphony Group +| http://www.opensymphony.com/ +| +| This product includes software developed for project Krysalis +| http://www.krysalis.org/ +| +| This product includes software developed by Andy Clark. +| http://people.apache.org/~andyc/neko/ +| +| This product includes software developed by the ExoLab Project +| http://www.exolab.org/ +| +| This product includes software developed by TouchGraph LLC +| http://www.touchgraph.com/ +| +| This product includes software developed by Marc De Scheemaecker +| http://nanoxml.cyberelf.be/ +| +| This product includes software developed by the ANTLR project +| http://www.antlr.org/ +| +| This product includes software developed by Chaperon +| http://chaperon.sourceforge.net/ +| +| This product includes software developed by Sal Mangano (included in the XSLT Cookbook published by O'Reilly) +| http://www.oreilly.com/catalog/xsltckbk/ +| +| This product includes software developed by The Werken Company. +| http://jaxen.werken.com/ +| +| This product includes software developed by the jfor project +| http://www.jfor.org/ From 7a282100438736e70e0361b94891b5b59157d62f Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 6 Jan 2016 12:12:10 +0000 Subject: [PATCH 016/116] AVRO-1772. Ruby: load error in rubygem when loading schema normalization. Contributed by blue and martinkl. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1723296 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ lang/ruby/Manifest | 5 +++++ lang/ruby/build.sh | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 5a0037ee340..7e509e465bb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -239,6 +239,9 @@ Avro 1.8.0 (15 December 2015) AVRO-1771. Add LICENSE and NOTICE to avro-doc artifact. (blue via tomwhite) + AVRO-1772. Ruby: load error in rubygem when loading schema normalization. + (blue and martinkl via tomwhite) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/lang/ruby/Manifest b/lang/ruby/Manifest index 8008c46b40e..23220bb9bf5 100644 --- a/lang/ruby/Manifest +++ b/lang/ruby/Manifest @@ -11,14 +11,19 @@ lib/avro/io.rb lib/avro/ipc.rb lib/avro/protocol.rb lib/avro/schema.rb +lib/avro/schema_normalization.rb +test/case_finder.rb test/random_data.rb test/sample_ipc_client.rb test/sample_ipc_http_client.rb test/sample_ipc_http_server.rb test/sample_ipc_server.rb test/test_datafile.rb +test/test_fingerprints.rb test/test_help.rb test/test_io.rb test/test_protocol.rb +test/test_schema.rb +test/test_schema_normalization.rb test/test_socket_transport.rb test/tool.rb diff --git a/lang/ruby/build.sh b/lang/ruby/build.sh index 6dbd78ca04b..0198400571f 100755 --- a/lang/ruby/build.sh +++ b/lang/ruby/build.sh @@ -26,10 +26,10 @@ export PATH="$PATH:.gem/bin" # bootstrap bundler gem install --no-rdoc --no-ri bundler +bundle install case "$1" in test) - bundle install bundle exec rake test ;; From faf5af028c53802f30f0d8995d03f8afa1d0ea5c Mon Sep 17 00:00:00 2001 From: Martin Kleppmann Date: Mon, 11 Jan 2016 21:00:24 +0000 Subject: [PATCH 017/116] AVRO-1725. Docs: clarify restrictions on enum symbols. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1724128 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ doc/src/content/xdocs/spec.xml | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 7e509e465bb..cbabf595fca 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -242,6 +242,8 @@ Avro 1.8.0 (15 December 2015) AVRO-1772. Ruby: load error in rubygem when loading schema normalization. (blue and martinkl via tomwhite) + AVRO-1725. Docs: clarify restrictions on enum symbols. (martinkl) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/doc/src/content/xdocs/spec.xml b/doc/src/content/xdocs/spec.xml index 83c042081ef..1e6f4e39739 100644 --- a/doc/src/content/xdocs/spec.xml +++ b/doc/src/content/xdocs/spec.xml @@ -171,7 +171,9 @@ user of this schema (optional).
  • symbols: a JSON array, listing symbols, as JSON strings (required). All symbols in an enum must - be unique; duplicates are prohibited.
  • + be unique; duplicates are prohibited. Every symbol must + match the regular expression [A-Za-z_][A-Za-z0-9_]* + (the same requirement as for names).

    For example, playing card suits might be defined with:

    @@ -246,7 +248,7 @@ -
    +
    Names

    Record, enums and fixed are named types. Each has a fullname that is composed of two parts; From bc7091cad925828bfb18c5c282394194e30e2901 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 12 Jan 2016 11:12:27 +0000 Subject: [PATCH 018/116] AVRO-1779. Avro docs convenience artifact missing LICENSE/NOTICE. Contributed by blue. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1724205 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ build.sh | 5 +++-- lang/c++/Doxyfile | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index cbabf595fca..0a9a920b930 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -244,6 +244,9 @@ Avro 1.8.0 (15 December 2015) AVRO-1725. Docs: clarify restrictions on enum symbols. (martinkl) + AVRO-1779. Avro docs convenience artifact missing LICENSE/NOTICE. + (blue via tomwhite) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/build.sh b/build.sh index ab0cd584096..1758b8440a7 100755 --- a/build.sh +++ b/build.sh @@ -126,8 +126,9 @@ case "$target" in # build docs (cd doc; ant) # add LICENSE and NOTICE for docs - cp doc/LICENSE $DOC_DIR - cp doc/NOTICE $DOC_DIR + mkdir -p build/$DOC_DIR + cp doc/LICENSE build/$DOC_DIR + cp doc/NOTICE build/$DOC_DIR (cd build; tar czf ../dist/avro-doc-$VERSION.tar.gz $DOC_DIR) cp DIST_README.txt dist/README.txt diff --git a/lang/c++/Doxyfile b/lang/c++/Doxyfile index b35ab075304..92499dd36b0 100644 --- a/lang/c++/Doxyfile +++ b/lang/c++/Doxyfile @@ -27,3 +27,4 @@ REFERENCES_RELATION = YES ALPHABETICAL_INDEX = NO GENERATE_LATEX = NO HAVE_DOT = NO +OUTPUT_DIRECTORY = doc From c42c40f728c338b4c144c5cbd431e0513dabf7fe Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 13 Jan 2016 11:01:04 +0000 Subject: [PATCH 019/116] AVRO-1780: Java: Fix NPE in tools. Contributed by Tom White. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1724395 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/avro/tool/Main.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/Main.java b/lang/java/tools/src/main/java/org/apache/avro/tool/Main.java index dad70bab615..93c827ccd7d 100644 --- a/lang/java/tools/src/main/java/org/apache/avro/tool/Main.java +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/Main.java @@ -17,6 +17,8 @@ */ package org.apache.avro.tool; +import java.io.BufferedReader; +import java.io.InputStreamReader; import java.util.Arrays; import java.util.Map; import java.util.TreeMap; @@ -89,7 +91,7 @@ private int run(String[] args) throws Exception { System.err.print("Version "); printStream(Main.class.getClassLoader().getResourceAsStream("VERSION.txt")); System.err.print(" of "); - printStream(Main.class.getClassLoader().getResourceAsStream("NOTICE.txt")); + printHead(Main.class.getClassLoader().getResourceAsStream("META-INF/NOTICE"), 5); System.err.println("----------------"); System.err.println("Available tools:"); @@ -106,4 +108,15 @@ private static void printStream(InputStream in) throws Exception { System.err.write(buffer, 0, i); } + private static void printHead(InputStream in, int lines) throws Exception { + BufferedReader r = new BufferedReader(new InputStreamReader(in)); + for (int i = 0; i < lines; i++) { + String line = r.readLine(); + if (line == null) { + break; + } + System.err.println(line); + } + } + } From a7a547cb8a3b7bb16531ef956b81c663c197fe75 Mon Sep 17 00:00:00 2001 From: Martin Kleppmann Date: Wed, 13 Jan 2016 20:32:45 +0000 Subject: [PATCH 020/116] AVRO-1782. Ruby: Fix unit test failures in new versions of Ruby. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1724507 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ lang/ruby/lib/avro/schema_normalization.rb | 2 +- lang/ruby/test/case_finder.rb | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 0a9a920b930..26b11da3a2a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -247,6 +247,8 @@ Avro 1.8.0 (15 December 2015) AVRO-1779. Avro docs convenience artifact missing LICENSE/NOTICE. (blue via tomwhite) + AVRO-1782. Ruby: Fix unit test failures in new versions of Ruby. (martinkl) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/lang/ruby/lib/avro/schema_normalization.rb b/lang/ruby/lib/avro/schema_normalization.rb index 0a5bee5d0cc..1506fcac810 100644 --- a/lang/ruby/lib/avro/schema_normalization.rb +++ b/lang/ruby/lib/avro/schema_normalization.rb @@ -25,7 +25,7 @@ def initialize end def to_parsing_form(schema) - JSON.dump(normalize_schema(schema)) + MultiJson.dump(normalize_schema(schema)) end private diff --git a/lang/ruby/test/case_finder.rb b/lang/ruby/test/case_finder.rb index de2d9c49034..a666f33854f 100644 --- a/lang/ruby/test/case_finder.rb +++ b/lang/ruby/test/case_finder.rb @@ -16,6 +16,8 @@ # specific language governing permissions and limitations # under the License. # +require 'strscan' + class CaseFinder PATH = File.expand_path("../../../../share/test/data/schema-tests.txt", __FILE__) From edd9f5557b344be58b03ed01c3588734c793ac46 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 14 Jan 2016 11:39:21 +0000 Subject: [PATCH 021/116] AVRO-1781: Use Guava for a thread-safe weak identity cache. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1724591 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 + lang/java/avro/pom.xml | 29 +++ .../java/org/apache/avro/LogicalTypes.java | 12 +- .../avro/src/main/resources/META-INF/LICENSE | 209 ++++++++++++++++++ lang/java/guava/pom.xml | 86 +++++++ .../java/org/apache/avro/GuavaClasses.java | 31 +++ .../guava/src/main/resources/META-INF/LICENSE | 209 ++++++++++++++++++ lang/java/mapred/pom.xml | 27 +++ lang/java/pom.xml | 3 + .../tools/src/main/resources/META-INF/LICENSE | 7 + 10 files changed, 611 insertions(+), 5 deletions(-) create mode 100644 lang/java/avro/src/main/resources/META-INF/LICENSE create mode 100644 lang/java/guava/pom.xml create mode 100644 lang/java/guava/src/main/java/org/apache/avro/GuavaClasses.java create mode 100644 lang/java/guava/src/main/resources/META-INF/LICENSE diff --git a/CHANGES.txt b/CHANGES.txt index 26b11da3a2a..091c6b19ac4 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -247,6 +247,9 @@ Avro 1.8.0 (15 December 2015) AVRO-1779. Avro docs convenience artifact missing LICENSE/NOTICE. (blue via tomwhite) + AVRO-1781. Java: Fix Schema.parse thread safety bug introduced by logical + types. (blue) + AVRO-1782. Ruby: Fix unit test failures in new versions of Ruby. (martinkl) Avro 1.7.7 (23 July 2014) diff --git a/lang/java/avro/pom.xml b/lang/java/avro/pom.xml index 183d3d83535..48a3d428cc1 100644 --- a/lang/java/avro/pom.xml +++ b/lang/java/avro/pom.xml @@ -84,6 +84,30 @@ + + org.apache.maven.plugins + maven-shade-plugin + + + + shade + + + + + org.apache.avro:avro-guava-dependencies + + + + + com.google.common + avro.shaded.com.google.common + + + + + + @@ -139,6 +163,11 @@ + + org.apache.avro + avro-guava-dependencies + ${project.version} + org.codehaus.jackson jackson-core-asl diff --git a/lang/java/avro/src/main/java/org/apache/avro/LogicalTypes.java b/lang/java/avro/src/main/java/org/apache/avro/LogicalTypes.java index 3f96340addd..727f86c65a2 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/LogicalTypes.java +++ b/lang/java/avro/src/main/java/org/apache/avro/LogicalTypes.java @@ -20,12 +20,14 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.apache.avro.util.WeakIdentityHashMap; +import com.google.common.base.Optional; +import com.google.common.collect.MapMaker; public class LogicalTypes { - private static final Map CACHE = - new WeakIdentityHashMap(); + private static final Map> CACHE = new MapMaker() + .weakKeys() + .makeMap(); public interface LogicalTypeFactory { LogicalType fromSchema(Schema schema); @@ -53,13 +55,13 @@ public static LogicalType fromSchema(Schema schema) { public static LogicalType fromSchemaIgnoreInvalid(Schema schema) { if (CACHE.containsKey(schema)) { - return CACHE.get(schema); + return CACHE.get(schema).orNull(); } LogicalType logicalType = fromSchemaImpl(schema, false); // add to the cache, even if it is null - CACHE.put(schema, logicalType); + CACHE.put(schema, Optional.fromNullable(logicalType)); return logicalType; } diff --git a/lang/java/avro/src/main/resources/META-INF/LICENSE b/lang/java/avro/src/main/resources/META-INF/LICENSE new file mode 100644 index 00000000000..3d6d84e6993 --- /dev/null +++ b/lang/java/avro/src/main/resources/META-INF/LICENSE @@ -0,0 +1,209 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +---------------------------------------------------------------------- +License for Guava classes included in this binary artifact: + +Copyright: 2006-2015 The Guava Authors +License: http://www.apache.org/licenses/LICENSE-2.0 (see above) + diff --git a/lang/java/guava/pom.xml b/lang/java/guava/pom.xml new file mode 100644 index 00000000000..33595636a9f --- /dev/null +++ b/lang/java/guava/pom.xml @@ -0,0 +1,86 @@ + + + + 4.0.0 + + + avro-parent + org.apache.avro + 1.8.0 + ../ + + + avro-guava-dependencies + + Apache Avro Guava Dependencies + http://avro.apache.org + Temporary artifact of guava dependencies + jar + + + + + org.apache.maven.plugins + maven-shade-plugin + 2.4.3 + + + package + + shade + + + + true + + + com.google.guava:guava + + + + + + + + + + + + com.google.guava + guava + ${guava.version} + + + com.google.code.findbugs + jsr305 + + + + + com.github.stephenc.findbugs + findbugs-annotations + ${findbugs-annotations.version} + + + + + diff --git a/lang/java/guava/src/main/java/org/apache/avro/GuavaClasses.java b/lang/java/guava/src/main/java/org/apache/avro/GuavaClasses.java new file mode 100644 index 00000000000..fd77f2d3c91 --- /dev/null +++ b/lang/java/guava/src/main/java/org/apache/avro/GuavaClasses.java @@ -0,0 +1,31 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.avro; + +import com.google.common.collect.MapMaker; + +class GuavaClasses { + /* + * Referencing Guava classes here includes them in the minimized Guava jar + * that is shaded in the avro jar. + */ + static { + MapMaker.class.getName(); + } +} diff --git a/lang/java/guava/src/main/resources/META-INF/LICENSE b/lang/java/guava/src/main/resources/META-INF/LICENSE new file mode 100644 index 00000000000..3d6d84e6993 --- /dev/null +++ b/lang/java/guava/src/main/resources/META-INF/LICENSE @@ -0,0 +1,209 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +---------------------------------------------------------------------- +License for Guava classes included in this binary artifact: + +Copyright: 2006-2015 The Guava Authors +License: http://www.apache.org/licenses/LICENSE-2.0 (see above) + diff --git a/lang/java/mapred/pom.xml b/lang/java/mapred/pom.xml index eb4af58b974..e4a2dd5e76e 100644 --- a/lang/java/mapred/pom.xml +++ b/lang/java/mapred/pom.xml @@ -109,6 +109,33 @@ + + org.apache.maven.plugins + maven-enforcer-plugin + 1.4.1 + + + enforce-banned-dependencies + + enforce + + + + + + + com.google.guava:guava + + + com.google.guava:guava:11.0.2 + + + + true + + + + diff --git a/lang/java/pom.xml b/lang/java/pom.xml index ce21881dec7..53d1f664bef 100644 --- a/lang/java/pom.xml +++ b/lang/java/pom.xml @@ -69,6 +69,8 @@ 1.3 3.1 2.7 + + 11.0.2 1.3.9-1 @@ -90,6 +92,7 @@ + guava avro compiler maven-plugin diff --git a/lang/java/tools/src/main/resources/META-INF/LICENSE b/lang/java/tools/src/main/resources/META-INF/LICENSE index b5fa86de9ca..550260d22c7 100644 --- a/lang/java/tools/src/main/resources/META-INF/LICENSE +++ b/lang/java/tools/src/main/resources/META-INF/LICENSE @@ -1118,3 +1118,10 @@ All rights reserved. | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +---------------------------------------------------------------------- +License for Guava classes included in this binary artifact: + +Copyright: 2006-2015 The Guava Authors +License: http://www.apache.org/licenses/LICENSE-2.0 (see above) + From c1be0a192c21792df5d167fbb87eaf2a3f8c0672 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Mon, 18 Jan 2016 10:53:38 +0000 Subject: [PATCH 022/116] AVRO-1760. Java: Thread scalability problem with the use of SynchronizedMap git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1725222 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ .../src/main/java/org/apache/avro/generic/GenericData.java | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 091c6b19ac4..50f777aeb77 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -65,6 +65,9 @@ Avro 1.8.0 (15 December 2015) OPTIMIZATIONS + AVRO-1760. Java: Thread scalability problem with the use of SynchronizedMap + (tomwhite) + IMPROVEMENTS AVRO-843. C#: Change Visual Studio project files to specify .NET 3.5. diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java index 70dbb239b81..7c70631df52 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java +++ b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java @@ -24,11 +24,9 @@ import java.util.AbstractList; import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.IdentityHashMap; import java.util.LinkedHashMap; -import java.util.WeakHashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -53,6 +51,8 @@ import org.codehaus.jackson.JsonNode; +import com.google.common.collect.MapMaker; + /** Utilities for generic Java data. See {@link GenericRecordBuilder} for a convenient * way to build {@link GenericRecord} instances. * @see GenericRecordBuilder @@ -969,7 +969,7 @@ protected int compare(Object o1, Object o2, Schema s, boolean equals) { } private final Map defaultValueCache - = Collections.synchronizedMap(new WeakHashMap()); + = new MapMaker().weakKeys().makeMap(); /** * Gets the default value of the given field, if any. From 9330bcbcf3d91cf72a32ba3c251c634a0f2b9a2b Mon Sep 17 00:00:00 2001 From: Martin Kleppmann Date: Thu, 21 Jan 2016 10:58:11 +0000 Subject: [PATCH 023/116] AVRO-1769. C: Use operating system's libjansson instead of bundling it with Avro. Contributed by Magnus Edenhill. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1725901 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 + LICENSE.txt | 152 - lang/c/CMakeLists.txt | 11 +- lang/c/INSTALL | 18 +- lang/c/LICENSE | 183 - lang/c/README.maintaining_win32.txt | 4 +- lang/c/docs/index.txt | 11 +- lang/c/jansson/.gitignore | 1 - lang/c/jansson/CHANGES | 330 - lang/c/jansson/LICENSE | 19 - lang/c/jansson/Makefile.am | 10 - lang/c/jansson/Makefile.in | 640 - lang/c/jansson/README.rst | 59 - lang/c/jansson/aclocal.m4 | 8895 ----------- lang/c/jansson/config.guess | 1500 -- lang/c/jansson/config.h.in | 75 - lang/c/jansson/config.sub | 1616 -- lang/c/jansson/configure | 13010 ---------------- lang/c/jansson/configure.ac | 49 - lang/c/jansson/depcomp | 584 - lang/c/jansson/doc/Makefile.am | 20 - lang/c/jansson/doc/Makefile.in | 352 - lang/c/jansson/doc/README | 5 - lang/c/jansson/doc/apiref.rst | 1221 -- lang/c/jansson/doc/changes.rst | 5 - lang/c/jansson/doc/conf.py | 217 - lang/c/jansson/doc/conformance.rst | 112 - lang/c/jansson/doc/ext/refcounting.py | 59 - lang/c/jansson/doc/gettingstarted.rst | 123 - lang/c/jansson/doc/github_commits.c | 171 - lang/c/jansson/doc/index.rst | 47 - lang/c/jansson/doc/tutorial.rst | 275 - lang/c/jansson/doc/upgrading.rst | 76 - lang/c/jansson/install-sh | 507 - lang/c/jansson/jansson.pc.in | 10 - lang/c/jansson/ltmain.sh | 8745 ----------- lang/c/jansson/missing | 367 - lang/c/jansson/src/Makefile.am | 27 - lang/c/jansson/src/Makefile.in | 477 - lang/c/jansson/src/dump.c | 465 - lang/c/jansson/src/error.c | 62 - lang/c/jansson/src/hashtable.c | 372 - lang/c/jansson/src/hashtable.h | 218 - lang/c/jansson/src/jansson.h | 257 - lang/c/jansson/src/jansson_config.h | 34 - lang/c/jansson/src/jansson_config.h.in | 34 - lang/c/jansson/src/jansson_private.h | 106 - lang/c/jansson/src/load.c | 964 -- lang/c/jansson/src/memory.c | 51 - lang/c/jansson/src/pack_unpack.c | 610 - lang/c/jansson/src/strbuffer.c | 104 - lang/c/jansson/src/strbuffer.h | 42 - lang/c/jansson/src/utf.c | 190 - lang/c/jansson/src/utf.h | 50 - lang/c/jansson/src/value.c | 983 -- lang/c/jansson/test/.gitignore | 13 - lang/c/jansson/test/Makefile.am | 10 - lang/c/jansson/test/Makefile.in | 569 - lang/c/jansson/test/bin/Makefile.am | 6 - lang/c/jansson/test/bin/Makefile.in | 439 - lang/c/jansson/test/bin/json_process.c | 124 - lang/c/jansson/test/run-suites | 49 - lang/c/jansson/test/scripts/run-tests.sh | 89 - lang/c/jansson/test/scripts/valgrind.sh | 35 - lang/c/jansson/test/suites/Makefile.am | 2 - lang/c/jansson/test/suites/Makefile.in | 487 - lang/c/jansson/test/suites/api/Makefile.am | 32 - lang/c/jansson/test/suites/api/Makefile.in | 553 - lang/c/jansson/test/suites/api/run | 36 - lang/c/jansson/test/suites/api/test_array.c | 400 - lang/c/jansson/test/suites/api/test_copy.c | 319 - lang/c/jansson/test/suites/api/test_dump.c | 142 - lang/c/jansson/test/suites/api/test_equal.c | 190 - lang/c/jansson/test/suites/api/test_load.c | 60 - lang/c/jansson/test/suites/api/test_loadb.c | 38 - .../test/suites/api/test_memory_funcs.c | 84 - lang/c/jansson/test/suites/api/test_number.c | 44 - lang/c/jansson/test/suites/api/test_object.c | 451 - lang/c/jansson/test/suites/api/test_pack.c | 232 - lang/c/jansson/test/suites/api/test_simple.c | 185 - lang/c/jansson/test/suites/api/test_unpack.c | 341 - lang/c/jansson/test/suites/api/util.h | 55 - .../encoded-surrogate-half/error | 2 - .../encoded-surrogate-half/input | 1 - .../invalid-utf-8-after-backslash/error | 2 - .../invalid-utf-8-after-backslash/input | 1 - .../invalid-utf-8-in-array/error | 2 - .../invalid-utf-8-in-array/input | 1 - .../invalid-utf-8-in-bigger-int/error | 2 - .../invalid-utf-8-in-bigger-int/input | 1 - .../invalid-utf-8-in-escape/error | 2 - .../invalid-utf-8-in-escape/input | 1 - .../invalid-utf-8-in-exponent/error | 2 - .../invalid-utf-8-in-exponent/input | 1 - .../invalid-utf-8-in-identifier/error | 2 - .../invalid-utf-8-in-identifier/input | 1 - .../invalid-utf-8-in-int/error | 2 - .../invalid-utf-8-in-int/input | 1 - .../invalid-utf-8-in-real-after-e/error | 2 - .../invalid-utf-8-in-real-after-e/input | 1 - .../invalid-utf-8-in-string/error | 2 - .../invalid-utf-8-in-string/input | 1 - .../invalid-unicode/lone-invalid-utf-8/error | 2 - .../invalid-unicode/lone-invalid-utf-8/input | 1 - .../lone-utf-8-continuation-byte/error | 2 - .../lone-utf-8-continuation-byte/input | 1 - .../not-in-unicode-range/error | 2 - .../not-in-unicode-range/input | 1 - .../overlong-3-byte-encoding/error | 2 - .../overlong-3-byte-encoding/input | 1 - .../overlong-4-byte-encoding/error | 2 - .../overlong-4-byte-encoding/input | 1 - .../overlong-ascii-encoding/error | 2 - .../overlong-ascii-encoding/input | 1 - .../invalid-unicode/restricted-utf-8/error | 2 - .../invalid-unicode/restricted-utf-8/input | 1 - .../c/jansson/test/suites/invalid-unicode/run | 27 - .../invalid-unicode/truncated-utf-8/error | 2 - .../invalid-unicode/truncated-utf-8/input | 1 - .../test/suites/invalid/apostrophe/error | 2 - .../test/suites/invalid/apostrophe/input | 1 - .../invalid/ascii-unicode-identifier/error | 2 - .../invalid/ascii-unicode-identifier/input | 1 - .../test/suites/invalid/brace-comma/error | 2 - .../test/suites/invalid/brace-comma/input | 1 - .../test/suites/invalid/bracket-comma/error | 2 - .../test/suites/invalid/bracket-comma/input | 1 - .../invalid/bracket-one-comma/error.normal | 2 - .../invalid/bracket-one-comma/error.strip | 2 - .../suites/invalid/bracket-one-comma/input | 1 - .../c/jansson/test/suites/invalid/empty/error | 2 - .../c/jansson/test/suites/invalid/empty/input | 0 .../invalid/escaped-null-byte-in-string/error | 2 - .../invalid/escaped-null-byte-in-string/input | 1 - .../suites/invalid/extra-comma-in-array/error | 2 - .../suites/invalid/extra-comma-in-array/input | 1 - .../extra-comma-in-multiline-array/error | 2 - .../extra-comma-in-multiline-array/input | 6 - .../invalid/garbage-after-newline/error | 2 - .../invalid/garbage-after-newline/input | 2 - .../suites/invalid/garbage-at-the-end/error | 2 - .../suites/invalid/garbage-at-the-end/input | 1 - .../invalid/integer-starting-with-zero/error | 2 - .../invalid/integer-starting-with-zero/input | 1 - .../test/suites/invalid/invalid-escape/error | 2 - .../test/suites/invalid/invalid-escape/input | 1 - .../suites/invalid/invalid-identifier/error | 2 - .../suites/invalid/invalid-identifier/input | 1 - .../invalid/invalid-negative-integer/error | 2 - .../invalid/invalid-negative-integer/input | 1 - .../invalid/invalid-negative-real/error | 2 - .../invalid/invalid-negative-real/input | 1 - .../invalid/invalid-second-surrogate/error | 2 - .../invalid/invalid-second-surrogate/input | 1 - .../invalid/lone-open-brace/error.normal | 2 - .../invalid/lone-open-brace/error.strip | 2 - .../test/suites/invalid/lone-open-brace/input | 1 - .../invalid/lone-open-bracket/error.normal | 2 - .../invalid/lone-open-bracket/error.strip | 2 - .../suites/invalid/lone-open-bracket/input | 1 - .../invalid/lone-second-surrogate/error | 2 - .../invalid/lone-second-surrogate/input | 1 - .../invalid/minus-sign-without-number/error | 2 - .../invalid/minus-sign-without-number/input | 1 - .../negative-integer-starting-with-zero/error | 2 - .../negative-integer-starting-with-zero/input | 1 - .../suites/invalid/null-byte-in-string/error | 2 - .../suites/invalid/null-byte-in-string/input | Bin 28 -> 0 bytes .../invalid/null-byte-in-string/nostrip | 2 - .../invalid/null-byte-outside-string/error | 2 - .../invalid/null-byte-outside-string/input | Bin 3 -> 0 bytes .../invalid/null-byte-outside-string/nostrip | 2 - lang/c/jansson/test/suites/invalid/null/error | 2 - lang/c/jansson/test/suites/invalid/null/input | 1 - .../suites/invalid/object-apostrophes/error | 2 - .../suites/invalid/object-apostrophes/input | 1 - .../invalid/object-garbage-at-end/error | 2 - .../invalid/object-garbage-at-end/input | 1 - .../object-in-unterminated-array/error.normal | 2 - .../object-in-unterminated-array/error.strip | 2 - .../object-in-unterminated-array/input | 1 - .../invalid/object-no-colon/error.normal | 2 - .../invalid/object-no-colon/error.strip | 2 - .../test/suites/invalid/object-no-colon/input | 1 - .../invalid/object-no-value/error.normal | 2 - .../invalid/object-no-value/error.strip | 2 - .../test/suites/invalid/object-no-value/input | 1 - .../object-unterminated-value/error.normal | 2 - .../object-unterminated-value/error.strip | 2 - .../invalid/object-unterminated-value/input | 1 - .../suites/invalid/real-garbage-after-e/error | 2 - .../suites/invalid/real-garbage-after-e/input | 1 - .../invalid/real-negative-overflow/error | 2 - .../invalid/real-negative-overflow/input | 1 - .../invalid/real-positive-overflow/error | 2 - .../invalid/real-positive-overflow/input | 1 - .../suites/invalid/real-truncated-at-e/error | 2 - .../suites/invalid/real-truncated-at-e/input | 1 - .../invalid/real-truncated-at-point/error | 2 - .../invalid/real-truncated-at-point/input | 1 - lang/c/jansson/test/suites/invalid/run | 57 - .../invalid/tab-character-in-string/error | 2 - .../invalid/tab-character-in-string/input | 1 - .../invalid/too-big-negative-integer/error | 2 - .../invalid/too-big-negative-integer/input | 1 - .../invalid/too-big-positive-integer/error | 2 - .../invalid/too-big-positive-integer/input | 1 - .../invalid/truncated-unicode-surrogate/error | 2 - .../invalid/truncated-unicode-surrogate/input | 1 - .../suites/invalid/unicode-identifier/error | 2 - .../suites/invalid/unicode-identifier/input | 1 - .../error.normal | 2 - .../unterminated-array-and-object/error.strip | 2 - .../unterminated-array-and-object/input | 1 - .../invalid/unterminated-array/error.normal | 2 - .../invalid/unterminated-array/error.strip | 2 - .../suites/invalid/unterminated-array/input | 1 - .../unterminated-empty-key/error.normal | 2 - .../unterminated-empty-key/error.strip | 2 - .../invalid/unterminated-empty-key/input | 1 - .../invalid/unterminated-key/error.normal | 2 - .../invalid/unterminated-key/error.strip | 2 - .../suites/invalid/unterminated-key/input | 1 - .../unterminated-object-and-array/error | 2 - .../unterminated-object-and-array/input | 1 - .../invalid/unterminated-string/error.normal | 2 - .../invalid/unterminated-string/error.strip | 2 - .../suites/invalid/unterminated-string/input | 1 - .../test/suites/valid/complex-array/input | 5 - .../test/suites/valid/complex-array/output | 1 - .../test/suites/valid/empty-array/input | 1 - .../test/suites/valid/empty-array/output | 1 - .../suites/valid/empty-object-in-array/input | 1 - .../suites/valid/empty-object-in-array/output | 1 - .../test/suites/valid/empty-object/input | 1 - .../test/suites/valid/empty-object/output | 1 - .../test/suites/valid/empty-string/input | 1 - .../test/suites/valid/empty-string/output | 1 - .../valid/escaped-utf-control-char/input | 1 - .../valid/escaped-utf-control-char/output | 1 - lang/c/jansson/test/suites/valid/false/input | 1 - lang/c/jansson/test/suites/valid/false/output | 1 - .../test/suites/valid/negative-int/input | 1 - .../test/suites/valid/negative-int/output | 1 - .../test/suites/valid/negative-one/input | 1 - .../test/suites/valid/negative-one/output | 1 - .../test/suites/valid/negative-zero/input | 1 - .../test/suites/valid/negative-zero/output | 1 - lang/c/jansson/test/suites/valid/null/input | 1 - lang/c/jansson/test/suites/valid/null/output | 1 - .../test/suites/valid/one-byte-utf-8/input | 1 - .../test/suites/valid/one-byte-utf-8/output | 1 - .../real-capital-e-negative-exponent/input | 1 - .../real-capital-e-negative-exponent/output | 1 - .../real-capital-e-positive-exponent/input | 1 - .../real-capital-e-positive-exponent/output | 1 - .../test/suites/valid/real-capital-e/input | 1 - .../test/suites/valid/real-capital-e/output | 1 - .../test/suites/valid/real-exponent/input | 1 - .../test/suites/valid/real-exponent/output | 1 - .../suites/valid/real-fraction-exponent/input | 1 - .../valid/real-fraction-exponent/output | 1 - .../suites/valid/real-negative-exponent/input | 1 - .../valid/real-negative-exponent/output | 1 - .../suites/valid/real-positive-exponent/input | 1 - .../valid/real-positive-exponent/output | 1 - .../test/suites/valid/real-underflow/input | 1 - .../test/suites/valid/real-underflow/output | 1 - lang/c/jansson/test/suites/valid/run | 55 - .../test/suites/valid/short-string/input | 1 - .../test/suites/valid/short-string/output | 1 - .../suites/valid/simple-ascii-string/input | 1 - .../suites/valid/simple-ascii-string/output | 1 - .../test/suites/valid/simple-int-0/input | 1 - .../test/suites/valid/simple-int-0/output | 1 - .../test/suites/valid/simple-int-1/input | 1 - .../test/suites/valid/simple-int-1/output | 1 - .../test/suites/valid/simple-int-123/input | 1 - .../test/suites/valid/simple-int-123/output | 1 - .../test/suites/valid/simple-object/input | 1 - .../test/suites/valid/simple-object/output | 1 - .../test/suites/valid/simple-real/input | 1 - .../test/suites/valid/simple-real/output | 1 - .../test/suites/valid/string-escapes/input | 1 - .../test/suites/valid/string-escapes/output | 1 - .../test/suites/valid/three-byte-utf-8/input | 1 - .../test/suites/valid/three-byte-utf-8/output | 1 - lang/c/jansson/test/suites/valid/true/input | 1 - lang/c/jansson/test/suites/valid/true/output | 1 - .../test/suites/valid/two-byte-utf-8/input | 1 - .../test/suites/valid/two-byte-utf-8/output | 1 - .../test/suites/valid/utf-8-string/input | 1 - .../test/suites/valid/utf-8-string/output | 1 - .../utf-surrogate-four-byte-encoding/input | 1 - .../utf-surrogate-four-byte-encoding/output | 1 - lang/c/src/CMakeLists.txt | 25 +- lang/c/tests/test_avro_data.c | 2 +- share/docker/Dockerfile | 2 +- 298 files changed, 41 insertions(+), 49936 deletions(-) delete mode 100644 lang/c/jansson/.gitignore delete mode 100644 lang/c/jansson/CHANGES delete mode 100644 lang/c/jansson/LICENSE delete mode 100644 lang/c/jansson/Makefile.am delete mode 100644 lang/c/jansson/Makefile.in delete mode 100644 lang/c/jansson/README.rst delete mode 100644 lang/c/jansson/aclocal.m4 delete mode 100755 lang/c/jansson/config.guess delete mode 100644 lang/c/jansson/config.h.in delete mode 100755 lang/c/jansson/config.sub delete mode 100755 lang/c/jansson/configure delete mode 100644 lang/c/jansson/configure.ac delete mode 100755 lang/c/jansson/depcomp delete mode 100644 lang/c/jansson/doc/Makefile.am delete mode 100644 lang/c/jansson/doc/Makefile.in delete mode 100644 lang/c/jansson/doc/README delete mode 100644 lang/c/jansson/doc/apiref.rst delete mode 100644 lang/c/jansson/doc/changes.rst delete mode 100644 lang/c/jansson/doc/conf.py delete mode 100644 lang/c/jansson/doc/conformance.rst delete mode 100644 lang/c/jansson/doc/ext/refcounting.py delete mode 100644 lang/c/jansson/doc/gettingstarted.rst delete mode 100644 lang/c/jansson/doc/github_commits.c delete mode 100644 lang/c/jansson/doc/index.rst delete mode 100644 lang/c/jansson/doc/tutorial.rst delete mode 100644 lang/c/jansson/doc/upgrading.rst delete mode 100755 lang/c/jansson/install-sh delete mode 100644 lang/c/jansson/jansson.pc.in delete mode 100755 lang/c/jansson/ltmain.sh delete mode 100755 lang/c/jansson/missing delete mode 100644 lang/c/jansson/src/Makefile.am delete mode 100644 lang/c/jansson/src/Makefile.in delete mode 100644 lang/c/jansson/src/dump.c delete mode 100644 lang/c/jansson/src/error.c delete mode 100644 lang/c/jansson/src/hashtable.c delete mode 100644 lang/c/jansson/src/hashtable.h delete mode 100644 lang/c/jansson/src/jansson.h delete mode 100644 lang/c/jansson/src/jansson_config.h delete mode 100644 lang/c/jansson/src/jansson_config.h.in delete mode 100644 lang/c/jansson/src/jansson_private.h delete mode 100644 lang/c/jansson/src/load.c delete mode 100644 lang/c/jansson/src/memory.c delete mode 100644 lang/c/jansson/src/pack_unpack.c delete mode 100644 lang/c/jansson/src/strbuffer.c delete mode 100644 lang/c/jansson/src/strbuffer.h delete mode 100644 lang/c/jansson/src/utf.c delete mode 100644 lang/c/jansson/src/utf.h delete mode 100644 lang/c/jansson/src/value.c delete mode 100644 lang/c/jansson/test/.gitignore delete mode 100644 lang/c/jansson/test/Makefile.am delete mode 100644 lang/c/jansson/test/Makefile.in delete mode 100644 lang/c/jansson/test/bin/Makefile.am delete mode 100644 lang/c/jansson/test/bin/Makefile.in delete mode 100644 lang/c/jansson/test/bin/json_process.c delete mode 100755 lang/c/jansson/test/run-suites delete mode 100644 lang/c/jansson/test/scripts/run-tests.sh delete mode 100644 lang/c/jansson/test/scripts/valgrind.sh delete mode 100644 lang/c/jansson/test/suites/Makefile.am delete mode 100644 lang/c/jansson/test/suites/Makefile.in delete mode 100644 lang/c/jansson/test/suites/api/Makefile.am delete mode 100644 lang/c/jansson/test/suites/api/Makefile.in delete mode 100755 lang/c/jansson/test/suites/api/run delete mode 100644 lang/c/jansson/test/suites/api/test_array.c delete mode 100644 lang/c/jansson/test/suites/api/test_copy.c delete mode 100644 lang/c/jansson/test/suites/api/test_dump.c delete mode 100644 lang/c/jansson/test/suites/api/test_equal.c delete mode 100644 lang/c/jansson/test/suites/api/test_load.c delete mode 100644 lang/c/jansson/test/suites/api/test_loadb.c delete mode 100644 lang/c/jansson/test/suites/api/test_memory_funcs.c delete mode 100644 lang/c/jansson/test/suites/api/test_number.c delete mode 100644 lang/c/jansson/test/suites/api/test_object.c delete mode 100644 lang/c/jansson/test/suites/api/test_pack.c delete mode 100644 lang/c/jansson/test/suites/api/test_simple.c delete mode 100644 lang/c/jansson/test/suites/api/test_unpack.c delete mode 100644 lang/c/jansson/test/suites/api/util.h delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/encoded-surrogate-half/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/encoded-surrogate-half/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-after-backslash/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-after-backslash/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-array/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-array/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-escape/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-escape/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-exponent/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-exponent/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-identifier/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-identifier/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-int/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-int/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-string/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-string/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/lone-invalid-utf-8/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/lone-invalid-utf-8/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/lone-utf-8-continuation-byte/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/lone-utf-8-continuation-byte/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/not-in-unicode-range/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/not-in-unicode-range/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/overlong-3-byte-encoding/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/overlong-3-byte-encoding/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/overlong-4-byte-encoding/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/overlong-4-byte-encoding/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/overlong-ascii-encoding/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/overlong-ascii-encoding/input delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/restricted-utf-8/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/restricted-utf-8/input delete mode 100755 lang/c/jansson/test/suites/invalid-unicode/run delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/truncated-utf-8/error delete mode 100644 lang/c/jansson/test/suites/invalid-unicode/truncated-utf-8/input delete mode 100644 lang/c/jansson/test/suites/invalid/apostrophe/error delete mode 100644 lang/c/jansson/test/suites/invalid/apostrophe/input delete mode 100644 lang/c/jansson/test/suites/invalid/ascii-unicode-identifier/error delete mode 100644 lang/c/jansson/test/suites/invalid/ascii-unicode-identifier/input delete mode 100644 lang/c/jansson/test/suites/invalid/brace-comma/error delete mode 100644 lang/c/jansson/test/suites/invalid/brace-comma/input delete mode 100644 lang/c/jansson/test/suites/invalid/bracket-comma/error delete mode 100644 lang/c/jansson/test/suites/invalid/bracket-comma/input delete mode 100644 lang/c/jansson/test/suites/invalid/bracket-one-comma/error.normal delete mode 100644 lang/c/jansson/test/suites/invalid/bracket-one-comma/error.strip delete mode 100644 lang/c/jansson/test/suites/invalid/bracket-one-comma/input delete mode 100644 lang/c/jansson/test/suites/invalid/empty/error delete mode 100644 lang/c/jansson/test/suites/invalid/empty/input delete mode 100644 lang/c/jansson/test/suites/invalid/escaped-null-byte-in-string/error delete mode 100644 lang/c/jansson/test/suites/invalid/escaped-null-byte-in-string/input delete mode 100644 lang/c/jansson/test/suites/invalid/extra-comma-in-array/error delete mode 100644 lang/c/jansson/test/suites/invalid/extra-comma-in-array/input delete mode 100644 lang/c/jansson/test/suites/invalid/extra-comma-in-multiline-array/error delete mode 100644 lang/c/jansson/test/suites/invalid/extra-comma-in-multiline-array/input delete mode 100644 lang/c/jansson/test/suites/invalid/garbage-after-newline/error delete mode 100644 lang/c/jansson/test/suites/invalid/garbage-after-newline/input delete mode 100644 lang/c/jansson/test/suites/invalid/garbage-at-the-end/error delete mode 100644 lang/c/jansson/test/suites/invalid/garbage-at-the-end/input delete mode 100644 lang/c/jansson/test/suites/invalid/integer-starting-with-zero/error delete mode 100644 lang/c/jansson/test/suites/invalid/integer-starting-with-zero/input delete mode 100644 lang/c/jansson/test/suites/invalid/invalid-escape/error delete mode 100644 lang/c/jansson/test/suites/invalid/invalid-escape/input delete mode 100644 lang/c/jansson/test/suites/invalid/invalid-identifier/error delete mode 100644 lang/c/jansson/test/suites/invalid/invalid-identifier/input delete mode 100644 lang/c/jansson/test/suites/invalid/invalid-negative-integer/error delete mode 100644 lang/c/jansson/test/suites/invalid/invalid-negative-integer/input delete mode 100644 lang/c/jansson/test/suites/invalid/invalid-negative-real/error delete mode 100644 lang/c/jansson/test/suites/invalid/invalid-negative-real/input delete mode 100644 lang/c/jansson/test/suites/invalid/invalid-second-surrogate/error delete mode 100644 lang/c/jansson/test/suites/invalid/invalid-second-surrogate/input delete mode 100644 lang/c/jansson/test/suites/invalid/lone-open-brace/error.normal delete mode 100644 lang/c/jansson/test/suites/invalid/lone-open-brace/error.strip delete mode 100644 lang/c/jansson/test/suites/invalid/lone-open-brace/input delete mode 100644 lang/c/jansson/test/suites/invalid/lone-open-bracket/error.normal delete mode 100644 lang/c/jansson/test/suites/invalid/lone-open-bracket/error.strip delete mode 100644 lang/c/jansson/test/suites/invalid/lone-open-bracket/input delete mode 100644 lang/c/jansson/test/suites/invalid/lone-second-surrogate/error delete mode 100644 lang/c/jansson/test/suites/invalid/lone-second-surrogate/input delete mode 100644 lang/c/jansson/test/suites/invalid/minus-sign-without-number/error delete mode 100644 lang/c/jansson/test/suites/invalid/minus-sign-without-number/input delete mode 100644 lang/c/jansson/test/suites/invalid/negative-integer-starting-with-zero/error delete mode 100644 lang/c/jansson/test/suites/invalid/negative-integer-starting-with-zero/input delete mode 100644 lang/c/jansson/test/suites/invalid/null-byte-in-string/error delete mode 100644 lang/c/jansson/test/suites/invalid/null-byte-in-string/input delete mode 100644 lang/c/jansson/test/suites/invalid/null-byte-in-string/nostrip delete mode 100644 lang/c/jansson/test/suites/invalid/null-byte-outside-string/error delete mode 100644 lang/c/jansson/test/suites/invalid/null-byte-outside-string/input delete mode 100644 lang/c/jansson/test/suites/invalid/null-byte-outside-string/nostrip delete mode 100644 lang/c/jansson/test/suites/invalid/null/error delete mode 100644 lang/c/jansson/test/suites/invalid/null/input delete mode 100644 lang/c/jansson/test/suites/invalid/object-apostrophes/error delete mode 100644 lang/c/jansson/test/suites/invalid/object-apostrophes/input delete mode 100644 lang/c/jansson/test/suites/invalid/object-garbage-at-end/error delete mode 100644 lang/c/jansson/test/suites/invalid/object-garbage-at-end/input delete mode 100644 lang/c/jansson/test/suites/invalid/object-in-unterminated-array/error.normal delete mode 100644 lang/c/jansson/test/suites/invalid/object-in-unterminated-array/error.strip delete mode 100644 lang/c/jansson/test/suites/invalid/object-in-unterminated-array/input delete mode 100644 lang/c/jansson/test/suites/invalid/object-no-colon/error.normal delete mode 100644 lang/c/jansson/test/suites/invalid/object-no-colon/error.strip delete mode 100644 lang/c/jansson/test/suites/invalid/object-no-colon/input delete mode 100644 lang/c/jansson/test/suites/invalid/object-no-value/error.normal delete mode 100644 lang/c/jansson/test/suites/invalid/object-no-value/error.strip delete mode 100644 lang/c/jansson/test/suites/invalid/object-no-value/input delete mode 100644 lang/c/jansson/test/suites/invalid/object-unterminated-value/error.normal delete mode 100644 lang/c/jansson/test/suites/invalid/object-unterminated-value/error.strip delete mode 100644 lang/c/jansson/test/suites/invalid/object-unterminated-value/input delete mode 100644 lang/c/jansson/test/suites/invalid/real-garbage-after-e/error delete mode 100644 lang/c/jansson/test/suites/invalid/real-garbage-after-e/input delete mode 100644 lang/c/jansson/test/suites/invalid/real-negative-overflow/error delete mode 100644 lang/c/jansson/test/suites/invalid/real-negative-overflow/input delete mode 100644 lang/c/jansson/test/suites/invalid/real-positive-overflow/error delete mode 100644 lang/c/jansson/test/suites/invalid/real-positive-overflow/input delete mode 100644 lang/c/jansson/test/suites/invalid/real-truncated-at-e/error delete mode 100644 lang/c/jansson/test/suites/invalid/real-truncated-at-e/input delete mode 100644 lang/c/jansson/test/suites/invalid/real-truncated-at-point/error delete mode 100644 lang/c/jansson/test/suites/invalid/real-truncated-at-point/input delete mode 100755 lang/c/jansson/test/suites/invalid/run delete mode 100644 lang/c/jansson/test/suites/invalid/tab-character-in-string/error delete mode 100644 lang/c/jansson/test/suites/invalid/tab-character-in-string/input delete mode 100644 lang/c/jansson/test/suites/invalid/too-big-negative-integer/error delete mode 100644 lang/c/jansson/test/suites/invalid/too-big-negative-integer/input delete mode 100644 lang/c/jansson/test/suites/invalid/too-big-positive-integer/error delete mode 100644 lang/c/jansson/test/suites/invalid/too-big-positive-integer/input delete mode 100644 lang/c/jansson/test/suites/invalid/truncated-unicode-surrogate/error delete mode 100644 lang/c/jansson/test/suites/invalid/truncated-unicode-surrogate/input delete mode 100644 lang/c/jansson/test/suites/invalid/unicode-identifier/error delete mode 100644 lang/c/jansson/test/suites/invalid/unicode-identifier/input delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-array-and-object/error.normal delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-array-and-object/error.strip delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-array-and-object/input delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-array/error.normal delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-array/error.strip delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-array/input delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-empty-key/error.normal delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-empty-key/error.strip delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-empty-key/input delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-key/error.normal delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-key/error.strip delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-key/input delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-object-and-array/error delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-object-and-array/input delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-string/error.normal delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-string/error.strip delete mode 100644 lang/c/jansson/test/suites/invalid/unterminated-string/input delete mode 100644 lang/c/jansson/test/suites/valid/complex-array/input delete mode 100644 lang/c/jansson/test/suites/valid/complex-array/output delete mode 100644 lang/c/jansson/test/suites/valid/empty-array/input delete mode 100644 lang/c/jansson/test/suites/valid/empty-array/output delete mode 100644 lang/c/jansson/test/suites/valid/empty-object-in-array/input delete mode 100644 lang/c/jansson/test/suites/valid/empty-object-in-array/output delete mode 100644 lang/c/jansson/test/suites/valid/empty-object/input delete mode 100644 lang/c/jansson/test/suites/valid/empty-object/output delete mode 100644 lang/c/jansson/test/suites/valid/empty-string/input delete mode 100644 lang/c/jansson/test/suites/valid/empty-string/output delete mode 100644 lang/c/jansson/test/suites/valid/escaped-utf-control-char/input delete mode 100644 lang/c/jansson/test/suites/valid/escaped-utf-control-char/output delete mode 100644 lang/c/jansson/test/suites/valid/false/input delete mode 100644 lang/c/jansson/test/suites/valid/false/output delete mode 100644 lang/c/jansson/test/suites/valid/negative-int/input delete mode 100644 lang/c/jansson/test/suites/valid/negative-int/output delete mode 100644 lang/c/jansson/test/suites/valid/negative-one/input delete mode 100644 lang/c/jansson/test/suites/valid/negative-one/output delete mode 100644 lang/c/jansson/test/suites/valid/negative-zero/input delete mode 100644 lang/c/jansson/test/suites/valid/negative-zero/output delete mode 100644 lang/c/jansson/test/suites/valid/null/input delete mode 100644 lang/c/jansson/test/suites/valid/null/output delete mode 100644 lang/c/jansson/test/suites/valid/one-byte-utf-8/input delete mode 100644 lang/c/jansson/test/suites/valid/one-byte-utf-8/output delete mode 100644 lang/c/jansson/test/suites/valid/real-capital-e-negative-exponent/input delete mode 100644 lang/c/jansson/test/suites/valid/real-capital-e-negative-exponent/output delete mode 100644 lang/c/jansson/test/suites/valid/real-capital-e-positive-exponent/input delete mode 100644 lang/c/jansson/test/suites/valid/real-capital-e-positive-exponent/output delete mode 100644 lang/c/jansson/test/suites/valid/real-capital-e/input delete mode 100644 lang/c/jansson/test/suites/valid/real-capital-e/output delete mode 100644 lang/c/jansson/test/suites/valid/real-exponent/input delete mode 100644 lang/c/jansson/test/suites/valid/real-exponent/output delete mode 100644 lang/c/jansson/test/suites/valid/real-fraction-exponent/input delete mode 100644 lang/c/jansson/test/suites/valid/real-fraction-exponent/output delete mode 100644 lang/c/jansson/test/suites/valid/real-negative-exponent/input delete mode 100644 lang/c/jansson/test/suites/valid/real-negative-exponent/output delete mode 100644 lang/c/jansson/test/suites/valid/real-positive-exponent/input delete mode 100644 lang/c/jansson/test/suites/valid/real-positive-exponent/output delete mode 100644 lang/c/jansson/test/suites/valid/real-underflow/input delete mode 100644 lang/c/jansson/test/suites/valid/real-underflow/output delete mode 100755 lang/c/jansson/test/suites/valid/run delete mode 100644 lang/c/jansson/test/suites/valid/short-string/input delete mode 100644 lang/c/jansson/test/suites/valid/short-string/output delete mode 100644 lang/c/jansson/test/suites/valid/simple-ascii-string/input delete mode 100644 lang/c/jansson/test/suites/valid/simple-ascii-string/output delete mode 100644 lang/c/jansson/test/suites/valid/simple-int-0/input delete mode 100644 lang/c/jansson/test/suites/valid/simple-int-0/output delete mode 100644 lang/c/jansson/test/suites/valid/simple-int-1/input delete mode 100644 lang/c/jansson/test/suites/valid/simple-int-1/output delete mode 100644 lang/c/jansson/test/suites/valid/simple-int-123/input delete mode 100644 lang/c/jansson/test/suites/valid/simple-int-123/output delete mode 100644 lang/c/jansson/test/suites/valid/simple-object/input delete mode 100644 lang/c/jansson/test/suites/valid/simple-object/output delete mode 100644 lang/c/jansson/test/suites/valid/simple-real/input delete mode 100644 lang/c/jansson/test/suites/valid/simple-real/output delete mode 100644 lang/c/jansson/test/suites/valid/string-escapes/input delete mode 100644 lang/c/jansson/test/suites/valid/string-escapes/output delete mode 100644 lang/c/jansson/test/suites/valid/three-byte-utf-8/input delete mode 100644 lang/c/jansson/test/suites/valid/three-byte-utf-8/output delete mode 100644 lang/c/jansson/test/suites/valid/true/input delete mode 100644 lang/c/jansson/test/suites/valid/true/output delete mode 100644 lang/c/jansson/test/suites/valid/two-byte-utf-8/input delete mode 100644 lang/c/jansson/test/suites/valid/two-byte-utf-8/output delete mode 100644 lang/c/jansson/test/suites/valid/utf-8-string/input delete mode 100644 lang/c/jansson/test/suites/valid/utf-8-string/output delete mode 100644 lang/c/jansson/test/suites/valid/utf-surrogate-four-byte-encoding/input delete mode 100644 lang/c/jansson/test/suites/valid/utf-surrogate-four-byte-encoding/output diff --git a/CHANGES.txt b/CHANGES.txt index 50f777aeb77..433d434fd00 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -255,6 +255,9 @@ Avro 1.8.0 (15 December 2015) AVRO-1782. Ruby: Fix unit test failures in new versions of Ruby. (martinkl) + AVRO-1769. C: Use operating system's libjansson instead of bundling + it with Avro. (Magnus Edenhill via martinkl) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/LICENSE.txt b/LICENSE.txt index d4444cd2b24..acd07f23c55 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -232,158 +232,6 @@ Some files include an additional copyright notice: | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | THE SOFTWARE. ----------------------------------------------------------------------- -License for the libtool scripts used in the Jansson C JSON parser: - -libtool (GNU libtool) 2.2.10 -Written by Gordon Matzigkeit , 1996 - -Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, -2007, 2008, 2009, 2010 Free Software Foundation, Inc. - -Included under the terms of the Apache License version 2.0. - -| GNU Libtool is free software; you can redistribute it and/or modify -| it under the terms of the GNU General Public License as published by -| the Free Software Foundation; either version 2 of the License, or -| (at your option) any later version. -| -| As a special exception to the GNU General Public License, -| if you distribute this file as part of a program or library that -| is built using GNU Libtool, you may include this file under the -| same distribution terms that you use for the rest of that program. -| -| GNU Libtool is distributed in the hope that it will be useful, but -| WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -| General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with GNU Libtool; see the file COPYING. If not, a copy -| can be downloaded from http://www.gnu.org/licenses/gpl.html, -| or obtained by writing to the Free Software Foundation, Inc., -| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - ----------------------------------------------------------------------- -License for the configure script used in the Jansson C JSON parser: - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -Foundation, Inc. - -| This configure script is free software; the Free Software Foundation -| gives unlimited permission to copy, distribute and modify it. - -Portions of the configure script are from libtool (see above) and are -included under the terms of the Apache License version 2.0. - ----------------------------------------------------------------------- -License for the install-sh script used in the Jansson C JSON parser: - -Copyright (C) 1994 X Consortium - -| This originates from X11R5 (mit/util/scripts/install.sh), which was -| later released in X11R6 (xc/config/util/install.sh) with the -| following copyright and license. -| -| Permission is hereby granted, free of charge, to any person obtaining a copy -| of this software and associated documentation files (the "Software"), to -| deal in the Software without restriction, including without limitation the -| rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -| sell copies of the Software, and to permit persons to whom the Software is -| furnished to do so, subject to the following conditions: -| -| The above copyright notice and this permission notice shall be included in -| all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -| X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -| AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -| TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -| Except as contained in this notice, the name of the X Consortium shall not -| be used in advertising or otherwise to promote the sale, use or other deal- -| ings in this Software without prior written authorization from the X Consor- -| tium. -| -| FSF changes to this file are in the public domain. - ----------------------------------------------------------------------- -License for the aclocal.m4 script used in the Jansson C JSON parser: - -Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - -| This file is free software; the Free Software Foundation -| gives unlimited permission to copy and/or distribute it, -| with or without modifications, as long as this notice is preserved. -| -| This program is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY, to the extent permitted by law; without -| even the implied warranty of MERCHANTABILITY or FITNESS FOR A -| PARTICULAR PURPOSE. - -Portions of the aclocal.m4 file are from libtool (see above) and are -included under the terms of the Apache License version 2.0. - ----------------------------------------------------------------------- -License for build scripts used in the Jansson C JSON parser: - -* config.guess - Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -* missing - Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - Originally by Fran,cois Pinard , 1996. -* config.sub - Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, - Inc. -* depcomp - Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software - Foundation, Inc. - Originally written by Alexandre Oliva . - -Included under the terms of the Apache License version 2.0. - -| This file is free software; you can redistribute it and/or modify it -| under the terms of the GNU General Public License as published by -| the Free Software Foundation; either version 2 of the License, or -| (at your option) any later version. -| -| This program is distributed in the hope that it will be useful, but -| WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -| General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with this program; if not, write to the Free Software -| Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -| 02110-1301, USA. -| -| As a special exception to the GNU General Public License, if you -| distribute this file as part of a program that contains a -| configuration script generated by Autoconf, you may include it under -| the same distribution terms that you use for the rest of that program. - ----------------------------------------------------------------------- -License for Makefile.in files used in the Jansson C JSON parser: - -Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -2003, 2004, 2005, 2006 Free Software Foundation, Inc. - -| This Makefile.in is free software; the Free Software Foundation -| gives unlimited permission to copy and/or distribute it, -| with or without modifications, as long as this notice is preserved. -| -| This program is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY, to the extent permitted by law; without -| even the implied warranty of MERCHANTABILITY or FITNESS FOR A -| PARTICULAR PURPOSE. - ---------------------------------------------------------------------- License for msinttypes.h and msstdint.h used in the C implementation: Source from: diff --git a/lang/c/CMakeLists.txt b/lang/c/CMakeLists.txt index 973a650ca34..fda4382a23e 100644 --- a/lang/c/CMakeLists.txt +++ b/lang/c/CMakeLists.txt @@ -123,7 +123,6 @@ if(UNIX AND THREADSAFE AND CMAKE_COMPILER_IS_GNUCC) endif(UNIX AND THREADSAFE AND CMAKE_COMPILER_IS_GNUCC) include_directories(${AvroC_SOURCE_DIR}/src) -include_directories(${AvroC_SOURCE_DIR}/jansson/src) # Enable codecs @@ -169,6 +168,16 @@ endif (LZMA_FOUND) set(CODEC_LIBRARIES ${ZLIB_LIBRARIES} ${LZMA_LIBRARIES} ${SNAPPY_LIBRARIES}) set(CODEC_PKG "@ZLIB_PKG@ @LZMA_PKG@ @SNAPPY_PKG@") +# Jansson JSON library +pkg_check_modules(JANSSON jansson>=2.3) +if (JANSSON_FOUND) + set(JANSSON_PKG libjansson) + include_directories(${JANSSON_INCLUDE_DIR}) + link_directories(${JANSSON_LIBRARY_DIRS}) +else (JANSSON_FOUND) + message(FATAL_ERROR "libjansson >=2.3 not found") +endif (JANSSON_FOUND) + add_subdirectory(src) add_subdirectory(examples) diff --git a/lang/c/INSTALL b/lang/c/INSTALL index b6dc0b25f6d..2157d1030c0 100644 --- a/lang/c/INSTALL +++ b/lang/c/INSTALL @@ -13,14 +13,20 @@ Prerequisites Avro uses CMake [1] as its build manager. You must have this installed, along with a C compiler (such as gcc) to build the library. -Avro doesn't depend on any other libraries, but you need asciidoc [2] -and source-highlight [3] installed to build Avro's documentation. The -build scripts will automatically detect whether these tools are -installed, and will skip the documentation if they're not. +Avro depends on the Jansson JSON parser [2], version 2.3 or higher. On +many operating systems this library is available through your package +manager (for example, `apt-get install libjansson-dev` on Ubuntu/Debian, +and `brew install jansson` on Mac OS). If not, please download and +install it from source [2]. + +To build the documentation you need asciidoc [3] and source-highlight [4] +installed. The build scripts will automatically detect whether these +tools are installed, and will skip the documentation if they're not. [1] http://www.cmake.org/ -[2] http://www.methods.co.nz/asciidoc -[3] http://www.gnu.org/software/src-highlite/ +[2] http://www.digip.org/jansson/ +[3] http://www.methods.co.nz/asciidoc +[4] http://www.gnu.org/software/src-highlite/ Building from source diff --git a/lang/c/LICENSE b/lang/c/LICENSE index e3839816087..5a84df4d42f 100644 --- a/lang/c/LICENSE +++ b/lang/c/LICENSE @@ -201,189 +201,6 @@ See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------------------------- -License for the Jansson C JSON parser used in the C implementation: - -Copyright (c) 2009-2011 Petri Lehtinen - -Some files include an additional copyright notice: -* lang/c/jansson/src/pack_unpack.c - Copyright (c) 2011 Graeme Smecher -* lang/c/jansson/test/suites/api/test_unpack.c - Copyright (c) 2011 Graeme Smecher -* lang/c/jansson/src/memory.c - Copyright (c) 2011 Basile Starynkevitch - -| Permission is hereby granted, free of charge, to any person obtaining a copy -| of this software and associated documentation files (the "Software"), to deal -| in the Software without restriction, including without limitation the rights -| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -| copies of the Software, and to permit persons to whom the Software is -| furnished to do so, subject to the following conditions: -| -| The above copyright notice and this permission notice shall be included in -| all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -| THE SOFTWARE. - ----------------------------------------------------------------------- -License for the libtool scripts used in the Jansson C JSON parser: - -libtool (GNU libtool) 2.2.10 -Written by Gordon Matzigkeit , 1996 - -Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, -2007, 2008, 2009, 2010 Free Software Foundation, Inc. - -Included under the terms of the Apache License version 2.0. - -| GNU Libtool is free software; you can redistribute it and/or modify -| it under the terms of the GNU General Public License as published by -| the Free Software Foundation; either version 2 of the License, or -| (at your option) any later version. -| -| As a special exception to the GNU General Public License, -| if you distribute this file as part of a program or library that -| is built using GNU Libtool, you may include this file under the -| same distribution terms that you use for the rest of that program. -| -| GNU Libtool is distributed in the hope that it will be useful, but -| WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -| General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with GNU Libtool; see the file COPYING. If not, a copy -| can be downloaded from http://www.gnu.org/licenses/gpl.html, -| or obtained by writing to the Free Software Foundation, Inc., -| 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - ----------------------------------------------------------------------- -License for the configure script used in the Jansson C JSON parser: - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -Foundation, Inc. - -| This configure script is free software; the Free Software Foundation -| gives unlimited permission to copy, distribute and modify it. - -Portions of the configure script are from libtool (see above) and are -included under the terms of the Apache License version 2.0. - ----------------------------------------------------------------------- -License for the install-sh script used in the Jansson C JSON parser: - -Copyright (C) 1994 X Consortium - -| This originates from X11R5 (mit/util/scripts/install.sh), which was -| later released in X11R6 (xc/config/util/install.sh) with the -| following copyright and license. -| -| Permission is hereby granted, free of charge, to any person obtaining a copy -| of this software and associated documentation files (the "Software"), to -| deal in the Software without restriction, including without limitation the -| rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -| sell copies of the Software, and to permit persons to whom the Software is -| furnished to do so, subject to the following conditions: -| -| The above copyright notice and this permission notice shall be included in -| all copies or substantial portions of the Software. -| -| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -| X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -| AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -| TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -| -| Except as contained in this notice, the name of the X Consortium shall not -| be used in advertising or otherwise to promote the sale, use or other deal- -| ings in this Software without prior written authorization from the X Consor- -| tium. -| -| FSF changes to this file are in the public domain. - ----------------------------------------------------------------------- -License for the aclocal.m4 script used in the Jansson C JSON parser: - -Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. - -| This file is free software; the Free Software Foundation -| gives unlimited permission to copy and/or distribute it, -| with or without modifications, as long as this notice is preserved. -| -| This program is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY, to the extent permitted by law; without -| even the implied warranty of MERCHANTABILITY or FITNESS FOR A -| PARTICULAR PURPOSE. - -Portions of the aclocal.m4 file are from libtool (see above) and are -included under the terms of the Apache License version 2.0. - ----------------------------------------------------------------------- -License for build scripts used in the Jansson C JSON parser: - -* config.guess - Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -* missing - Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. - Originally by Fran,cois Pinard , 1996. -* config.sub - Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, - Inc. -* depcomp - Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software - Foundation, Inc. - Originally written by Alexandre Oliva . - -Included under the terms of the Apache License version 2.0. - -| This file is free software; you can redistribute it and/or modify it -| under the terms of the GNU General Public License as published by -| the Free Software Foundation; either version 2 of the License, or -| (at your option) any later version. -| -| This program is distributed in the hope that it will be useful, but -| WITHOUT ANY WARRANTY; without even the implied warranty of -| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -| General Public License for more details. -| -| You should have received a copy of the GNU General Public License -| along with this program; if not, write to the Free Software -| Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -| 02110-1301, USA. -| -| As a special exception to the GNU General Public License, if you -| distribute this file as part of a program that contains a -| configuration script generated by Autoconf, you may include it under -| the same distribution terms that you use for the rest of that program. - ----------------------------------------------------------------------- -License for Makefile.in files used in the Jansson C JSON parser: - -Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -2003, 2004, 2005, 2006 Free Software Foundation, Inc. - -| This Makefile.in is free software; the Free Software Foundation -| gives unlimited permission to copy and/or distribute it, -| with or without modifications, as long as this notice is preserved. -| -| This program is distributed in the hope that it will be useful, -| but WITHOUT ANY WARRANTY, to the extent permitted by law; without -| even the implied warranty of MERCHANTABILITY or FITNESS FOR A -| PARTICULAR PURPOSE. - ---------------------------------------------------------------------- License for msinttypes.h and msstdint.h used in the C implementation: Source from: diff --git a/lang/c/README.maintaining_win32.txt b/lang/c/README.maintaining_win32.txt index 62754dbc6f4..f630c03a91f 100644 --- a/lang/c/README.maintaining_win32.txt +++ b/lang/c/README.maintaining_win32.txt @@ -143,10 +143,10 @@ Instructions for Maintenance include msdirent.h. See example in test_avro_schema.c. 16. If _WIN32 is defined, define snprintf() to_snprintf(), which MS - Visual C++ recognizes. See jansson_private.h for an example. + Visual C++ recognizes. 17. MSVC++ does not recognize strtoll(). Define it to _strtoi64() - instead. See jansson/src/load.c for an example. + instead. 18. Old-style C function declarations are not allowed in C++. See the changes in st.c and st.h -- which were converted to new-style diff --git a/lang/c/docs/index.txt b/lang/c/docs/index.txt index b82550bc704..c3b83874c64 100644 --- a/lang/c/docs/index.txt +++ b/lang/c/docs/index.txt @@ -36,9 +36,14 @@ ____ The C implementation has been tested on +MacOSX+ and +Linux+ but, over time, the number of support OSes should grow. Please let us know if -you're using +Avro C+ on other systems. There are no dependencies on -external libraries. We embedded http://www.digip.org/jansson/[Jansson] into -+Avro C+ for parsing JSON into schema structures. +you're using +Avro C+ on other systems. + +Avro depends on the http://www.digip.org/jansson/[Jansson JSON parser], +version 2.3 or higher. On many operating systems this library is +available through your package manager (for example, ++apt-get install libjansson-dev+ on Ubuntu/Debian, and ++brew install jansson+ on Mac OS). If not, please download and install +it from source. The C implementation supports: diff --git a/lang/c/jansson/.gitignore b/lang/c/jansson/.gitignore deleted file mode 100644 index 2ab2196ee20..00000000000 --- a/lang/c/jansson/.gitignore +++ /dev/null @@ -1 +0,0 @@ -jansson.pc diff --git a/lang/c/jansson/CHANGES b/lang/c/jansson/CHANGES deleted file mode 100644 index 5e002d54d97..00000000000 --- a/lang/c/jansson/CHANGES +++ /dev/null @@ -1,330 +0,0 @@ -Version 2.1 (in development) -============================ - -* New features: - - - `json_loadb()`: Decode a string with a given size, useful if the - string is not null terminated. - - - Add ``JSON_ENCODE_ANY`` encoding flag to allow encoding any JSON - value. By default, only arrays and objects can be encoded. (#19) - - - Add ``JSON_REJECT_DUPLICATES`` decoding flag to issue a decoding - error if any JSON object in the input contins duplicate keys. (#3) - - - Add ``JSON_DISABLE_EOF_CHECK`` decoding flag to stop decoding after a - valid JSON input. This allows other data after the JSON data. - -* Bug fixes: - - - Fix an additional memory leak when memory allocation fails in - `json_object_set()` and friends. - - - Clear errno before calling `strtod()` for better portability. (#27) - -* Building: - - - Avoid set-but-not-used warning/error in a test. (#20) - -* Other: - - - Minor clarifications to documentation. - - -Version 2.0.1 -============= - -Released 2011-03-31 - -* Bug fixes: - - - Replace a few `malloc()` and `free()` calls with their - counterparts that support custom memory management. - - - Fix object key hashing in json_unpack() strict checking mode. - - - Fix the parentheses in ``JANSSON_VERSION_HEX`` macro. - - - Fix `json_object_size()` return value. - - - Fix a few compilation issues. - -* Portability: - - - Enhance portability of `va_copy()`. - - - Test framework portability enhancements. - -* Documentation: - - - Distribute ``doc/upgrading.rst`` with the source tarball. - - - Build documentation in strict mode in ``make distcheck``. - - -Version 2.0 -=========== - -Released 2011-02-28 - -This release is backwards incompatible with the 1.x release series. -See the chapter "Upgrading from older versions" in documentation for -details. - -* Backwards incompatible changes: - - - Unify unsigned integer usage in the API: All occurences of - unsigned int and unsigned long have been replaced with size_t. - - - Change JSON integer's underlying type to the widest signed integer - type available, i.e. long long if it's supported, otherwise long. - Add a typedef json_int_t that defines the type. - - - Change the maximum indentation depth to 31 spaces in encoder. This - frees up bits from the flags parameter of encoding functions - `json_dumpf()`, `json_dumps()` and `json_dump_file()`. - - - For future needs, add a flags parameter to all decoding functions - `json_loadf()`, `json_loads()` and `json_load_file()`. - -* New features - - - `json_pack()`, `json_pack_ex()`, `json_vpack_ex()`: Create JSON - values based on a format string. - - - `json_unpack()`, `json_unpack_ex()`, `json_vunpack_ex()`: Simple - value extraction and validation functionality based on a format - string. - - - Add column, position and source fields to the ``json_error_t`` - struct. - - - Enhance error reporting in the decoder. - - - ``JANSSON_VERSION`` et al.: Preprocessor constants that define the - library version. - - - `json_set_alloc_funcs()`: Set custom memory allocation functions. - -* Fix many portability issues, especially on Windows. - -* Configuration - - - Add file ``jansson_config.h`` that contains site specific - configuration. It's created automatically by the configure script, - or can be created by hand if the configure script cannot be used. - The file ``jansson_config.h.win32`` can be used without - modifications on Windows systems. - - - Add a section to documentation describing how to build Jansson on - Windows. - - - Documentation now requires Sphinx 1.0 or newer. - - -Version 1.3 -=========== - -Released 2010-06-13 - -* New functions: - - - `json_object_iter_set()`, `json_object_iter_set_new()`: Change - object contents while iterating over it. - - - `json_object_iter_at()`: Return an iterator that points to a - specific object item. - -* New encoding flags: - - - ``JSON_PRESERVE_ORDER``: Preserve the insertion order of object - keys. - -* Bug fixes: - - - Fix an error that occured when an array or object was first - encoded as empty, then populated with some data, and then - re-encoded - - - Fix the situation like above, but when the first encoding resulted - in an error - -* Documentation: - - - Clarify the documentation on reference stealing, providing an - example usage pattern - - -Version 1.2.1 -============= - -Released 2010-04-03 - -* Bug fixes: - - - Fix reference counting on ``true``, ``false`` and ``null`` - - Estimate real number underflows in decoder with 0.0 instead of - issuing an error - -* Portability: - - - Make ``int32_t`` available on all systems - - Support compilers that don't have the ``inline`` keyword - - Require Autoconf 2.60 (for ``int32_t``) - -* Tests: - - - Print test names correctly when ``VERBOSE=1`` - - ``test/suites/api``: Fail when a test fails - - Enhance tests for iterators - - Enhance tests for decoding texts that contain null bytes - -* Documentation: - - - Don't remove ``changes.rst`` in ``make clean`` - - Add a chapter on RFC conformance - - -Version 1.2 -=========== - -Released 2010-01-21 - -* New functions: - - - `json_equal()`: Test whether two JSON values are equal - - `json_copy()` and `json_deep_copy()`: Make shallow and deep copies - of JSON values - - Add a version of all functions taking a string argument that - doesn't check for valid UTF-8: `json_string_nocheck()`, - `json_string_set_nocheck()`, `json_object_set_nocheck()`, - `json_object_set_new_nocheck()` - -* New encoding flags: - - - ``JSON_SORT_KEYS``: Sort objects by key - - ``JSON_ENSURE_ASCII``: Escape all non-ASCII Unicode characters - - ``JSON_COMPACT``: Use a compact representation with all unneeded - whitespace stripped - -* Bug fixes: - - - Revise and unify whitespace usage in encoder: Add spaces between - array and object items, never append newline to output. - - Remove const qualifier from the ``json_t`` parameter in - `json_string_set()`, `json_integer_set()` and `json_real_set`. - - Use ``int32_t`` internally for representing Unicode code points - (int is not enough on all platforms) - -* Other changes: - - - Convert ``CHANGES`` (this file) to reStructured text and add it to - HTML documentation - - The test system has been refactored. Python is no longer required - to run the tests. - - Documentation can now be built by invoking ``make html`` - - Support for pkg-config - - -Version 1.1.3 -============= - -Released 2009-12-18 - -* Encode reals correctly, so that first encoding and then decoding a - real always produces the same value -* Don't export private symbols in ``libjansson.so`` - - -Version 1.1.2 -============= - -Released 2009-11-08 - -* Fix a bug where an error message was not produced if the input file - could not be opened in `json_load_file()` -* Fix an assertion failure in decoder caused by a minus sign without a - digit after it -* Remove an unneeded include of ``stdint.h`` in ``jansson.h`` - - -Version 1.1.1 -============= - -Released 2009-10-26 - -* All documentation files were not distributed with v1.1; build - documentation in make distcheck to prevent this in the future -* Fix v1.1 release date in ``CHANGES`` - - -Version 1.1 -=========== - -Released 2009-10-20 - -* API additions and improvements: - - - Extend array and object APIs - - Add functions to modify integer, real and string values - - Improve argument validation - - Use unsigned int instead of ``uint32_t`` for encoding flags - -* Enhance documentation - - - Add getting started guide and tutorial - - Fix some typos - - General clarifications and cleanup - -* Check for integer and real overflows and underflows in decoder -* Make singleton values thread-safe (``true``, ``false`` and ``null``) -* Enhance circular reference handling -* Don't define ``-std=c99`` in ``AM_CFLAGS`` -* Add C++ guards to ``jansson.h`` -* Minor performance and portability improvements -* Expand test coverage - - -Version 1.0.4 -============= - -Released 2009-10-11 - -* Relax Autoconf version requirement to 2.59 -* Make Jansson compile on platforms where plain ``char`` is unsigned -* Fix API tests for object - - -Version 1.0.3 -============= - -Released 2009-09-14 - -* Check for integer and real overflows and underflows in decoder -* Use the Python json module for tests, or simplejson if the json - module is not found -* Distribute changelog (this file) - - -Version 1.0.2 -============= - -Released 2009-09-08 - -* Handle EOF correctly in decoder - - -Version 1.0.1 -============= - -Released 2009-09-04 - -* Fixed broken `json_is_boolean()` - - -Version 1.0 -=========== - -Released 2009-08-25 - -* Initial release diff --git a/lang/c/jansson/LICENSE b/lang/c/jansson/LICENSE deleted file mode 100644 index 6d70a1b350d..00000000000 --- a/lang/c/jansson/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2009-2011 Petri Lehtinen - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/lang/c/jansson/Makefile.am b/lang/c/jansson/Makefile.am deleted file mode 100644 index e101fa25894..00000000000 --- a/lang/c/jansson/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -EXTRA_DIST = CHANGES LICENSE README.rst -SUBDIRS = doc src test - -# "make distcheck" builds the dvi target, so use it to check that the -# documentation is built correctly. -dvi: - $(MAKE) SPHINXOPTS_EXTRA=-W html - -#pkgconfigdir = $(libdir)/pkgconfig -#pkgconfig_DATA = jansson.pc diff --git a/lang/c/jansson/Makefile.in b/lang/c/jansson/Makefile.in deleted file mode 100644 index 9dcf437d192..00000000000 --- a/lang/c/jansson/Makefile.in +++ /dev/null @@ -1,640 +0,0 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = . -DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(srcdir)/jansson.pc.in $(top_srcdir)/configure config.guess \ - config.sub depcomp install-sh ltmain.sh missing -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno config.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = jansson.pc -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -json_have_long_long = @json_have_long_long@ -json_inline = @json_inline@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -EXTRA_DIST = CHANGES LICENSE README.rst -SUBDIRS = doc src test -all: config.h - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -.SUFFIXES: -am--refresh: - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ - cd $(srcdir) && $(AUTOMAKE) --foreign \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) - -config.h: stamp-h1 - @if test ! -f $@; then \ - rm -f stamp-h1; \ - $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ - else :; fi - -stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status - @rm -f stamp-h1 - cd $(top_builddir) && $(SHELL) ./config.status config.h -$(srcdir)/config.h.in: $(am__configure_deps) - cd $(top_srcdir) && $(AUTOHEADER) - rm -f stamp-h1 - touch $@ - -distclean-hdr: - -rm -f config.h stamp-h1 -jansson.pc: $(top_builddir)/config.status $(srcdir)/jansson.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(am__remove_distdir) - test -d $(distdir) || mkdir $(distdir) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - distdir) \ - || exit 1; \ - fi; \ - done - -find $(distdir) -type d ! -perm -755 -exec chmod u+rwx,go+rx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-recursive -all-am: Makefile config.h -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-hdr \ - distclean-libtool distclean-tags - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-exec-am: - -install-html: install-html-recursive - -install-info: install-info-recursive - -install-man: - -install-pdf: install-pdf-recursive - -install-ps: install-ps-recursive - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ - install-strip - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am am--refresh check check-am clean clean-generic \ - clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ - dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ - distclean-generic distclean-hdr distclean-libtool \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am - - -# "make distcheck" builds the dvi target, so use it to check that the -# documentation is built correctly. -dvi: - $(MAKE) SPHINXOPTS_EXTRA=-W html - -#pkgconfigdir = $(libdir)/pkgconfig -#pkgconfig_DATA = jansson.pc -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lang/c/jansson/README.rst b/lang/c/jansson/README.rst deleted file mode 100644 index cbb171f56c7..00000000000 --- a/lang/c/jansson/README.rst +++ /dev/null @@ -1,59 +0,0 @@ -Jansson README -============== - -Jansson_ is a C library for encoding, decoding and manipulating JSON -data. Its main features and design principles are: - -- Simple and intuitive API and data model - -- Comprehensive documentation - -- No dependencies on other libraries - -- Full Unicode support (UTF-8) - -- Extensive test suite - -Jansson is licensed under the `MIT license`_; see LICENSE in the -source distribution for details. - - -Compilation and Installation ----------------------------- - -If you obtained a source tarball, just use the standard autotools -commands:: - - $ ./configure - $ make - $ make install - -To run the test suite, invoke:: - - $ make check - -If the source has been checked out from a Git repository, the -./configure script has to be generated fist. The easiest way is to use -autoreconf:: - - $ autoreconf -i - - -Documentation -------------- - -Prebuilt HTML documentation is available at -http://www.digip.org/jansson/doc/. - -The documentation source is in the ``doc/`` subdirectory. To generate -HTML documentation, invoke:: - - $ make html - -Then, point your browser to ``doc/_build/html/index.html``. Sphinx_ -1.0 or newer is required to generate the documentation. - - -.. _Jansson: http://www.digip.org/jansson/ -.. _`MIT license`: http://www.opensource.org/licenses/mit-license.php -.. _Sphinx: http://sphinx.pocoo.org/ diff --git a/lang/c/jansson/aclocal.m4 b/lang/c/jansson/aclocal.m4 deleted file mode 100644 index 8bfbdca3555..00000000000 --- a/lang/c/jansson/aclocal.m4 +++ /dev/null @@ -1,8895 +0,0 @@ -# generated automatically by aclocal 1.10 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -m4_if(m4_PACKAGE_VERSION, [2.68],, -[m4_fatal([this file was generated for autoconf 2.68. -You have another version of autoconf. If you want to use that, -you should regenerate the build system entirely.], [63])]) - -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -# Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -m4_define([_LT_COPYING], [dnl -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -# Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -]) - -# serial 57 LT_INIT - - -# LT_PREREQ(VERSION) -# ------------------ -# Complain and exit if this libtool version is less that VERSION. -m4_defun([LT_PREREQ], -[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, - [m4_default([$3], - [m4_fatal([Libtool version $1 or higher is required], - 63)])], - [$2])]) - - -# _LT_CHECK_BUILDDIR -# ------------------ -# Complain if the absolute build directory name contains unusual characters -m4_defun([_LT_CHECK_BUILDDIR], -[case `pwd` in - *\ * | *\ *) - AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; -esac -]) - - -# LT_INIT([OPTIONS]) -# ------------------ -AC_DEFUN([LT_INIT], -[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT -AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -AC_BEFORE([$0], [LT_LANG])dnl -AC_BEFORE([$0], [LT_OUTPUT])dnl -AC_BEFORE([$0], [LTDL_INIT])dnl -m4_require([_LT_CHECK_BUILDDIR])dnl - -dnl Autoconf doesn't catch unexpanded LT_ macros by default: -m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl -m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl -dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 -dnl unless we require an AC_DEFUNed macro: -AC_REQUIRE([LTOPTIONS_VERSION])dnl -AC_REQUIRE([LTSUGAR_VERSION])dnl -AC_REQUIRE([LTVERSION_VERSION])dnl -AC_REQUIRE([LTOBSOLETE_VERSION])dnl -m4_require([_LT_PROG_LTMAIN])dnl - -_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) - -dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -_LT_SETUP - -# Only expand once: -m4_define([LT_INIT]) -])# LT_INIT - -# Old names: -AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) -AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PROG_LIBTOOL], []) -dnl AC_DEFUN([AM_PROG_LIBTOOL], []) - - -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -m4_defun([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -]) - - -# _LT_FILEUTILS_DEFAULTS -# ---------------------- -# It is okay to use these file commands and assume they have been set -# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. -m4_defun([_LT_FILEUTILS_DEFAULTS], -[: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} -])# _LT_FILEUTILS_DEFAULTS - - -# _LT_SETUP -# --------- -m4_defun([_LT_SETUP], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl - -_LT_DECL([], [host_alias], [0], [The host system])dnl -_LT_DECL([], [host], [0])dnl -_LT_DECL([], [host_os], [0])dnl -dnl -_LT_DECL([], [build_alias], [0], [The build system])dnl -_LT_DECL([], [build], [0])dnl -_LT_DECL([], [build_os], [0])dnl -dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -test -z "$LN_S" && LN_S="ln -s" -_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl -dnl -AC_REQUIRE([LT_CMD_MAX_LEN])dnl -_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl -_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl -dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -m4_require([_LT_CMD_RELOAD])dnl -m4_require([_LT_CHECK_MAGIC_METHOD])dnl -m4_require([_LT_CMD_OLD_ARCHIVE])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl - -_LT_CONFIG_LIBTOOL_INIT([ -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi -]) -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -_LT_CHECK_OBJDIR - -m4_require([_LT_TAG_COMPILER])dnl - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -_LT_CC_BASENAME([$compiler]) - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - _LT_PATH_MAGIC - fi - ;; -esac - -# Use C for the default configuration in the libtool script -LT_SUPPORTED_TAG([CC]) -_LT_LANG_C_CONFIG -_LT_LANG_DEFAULT_CONFIG -_LT_CONFIG_COMMANDS -])# _LT_SETUP - - -# _LT_PREPARE_SED_QUOTE_VARS -# -------------------------- -# Define a few sed substitution that help us do robust quoting. -m4_defun([_LT_PREPARE_SED_QUOTE_VARS], -[# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([["`\\]]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' -]) - -# _LT_PROG_LTMAIN -# --------------- -# Note that this code is called both from `configure', and `config.status' -# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, -# `config.status' has no value for ac_aux_dir unless we are using Automake, -# so we pass a copy along to make sure it has a sensible value anyway. -m4_defun([_LT_PROG_LTMAIN], -[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl -_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) -ltmain="$ac_aux_dir/ltmain.sh" -])# _LT_PROG_LTMAIN - - - -# So that we can recreate a full libtool script including additional -# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS -# in macros and then make a single call at the end using the `libtool' -# label. - - -# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) -# ---------------------------------------- -# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL_INIT], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_INIT], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_INIT]) - - -# _LT_CONFIG_LIBTOOL([COMMANDS]) -# ------------------------------ -# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) - - -# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) -# ----------------------------------------------------- -m4_defun([_LT_CONFIG_SAVE_COMMANDS], -[_LT_CONFIG_LIBTOOL([$1]) -_LT_CONFIG_LIBTOOL_INIT([$2]) -]) - - -# _LT_FORMAT_COMMENT([COMMENT]) -# ----------------------------- -# Add leading comment marks to the start of each line, and a trailing -# full-stop to the whole comment if one is not present already. -m4_define([_LT_FORMAT_COMMENT], -[m4_ifval([$1], [ -m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], - [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) -)]) - - - - - -# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) -# ------------------------------------------------------------------- -# CONFIGNAME is the name given to the value in the libtool script. -# VARNAME is the (base) name used in the configure script. -# VALUE may be 0, 1 or 2 for a computed quote escaped value based on -# VARNAME. Any other value will be used directly. -m4_define([_LT_DECL], -[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], - [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], - [m4_ifval([$1], [$1], [$2])]) - lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) - m4_ifval([$4], - [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) - lt_dict_add_subkey([lt_decl_dict], [$2], - [tagged?], [m4_ifval([$5], [yes], [no])])]) -]) - - -# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) -# -------------------------------------------------------- -m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) - - -# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_tag_varnames], -[_lt_decl_filter([tagged?], [yes], $@)]) - - -# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) -# --------------------------------------------------------- -m4_define([_lt_decl_filter], -[m4_case([$#], - [0], [m4_fatal([$0: too few arguments: $#])], - [1], [m4_fatal([$0: too few arguments: $#: $1])], - [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], - [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], - [lt_dict_filter([lt_decl_dict], $@)])[]dnl -]) - - -# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) -# -------------------------------------------------- -m4_define([lt_decl_quote_varnames], -[_lt_decl_filter([value], [1], $@)]) - - -# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_dquote_varnames], -[_lt_decl_filter([value], [2], $@)]) - - -# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_varnames_tagged], -[m4_assert([$# <= 2])dnl -_$0(m4_quote(m4_default([$1], [[, ]])), - m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), - m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) -m4_define([_lt_decl_varnames_tagged], -[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) - - -# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_all_varnames], -[_$0(m4_quote(m4_default([$1], [[, ]])), - m4_if([$2], [], - m4_quote(lt_decl_varnames), - m4_quote(m4_shift($@))))[]dnl -]) -m4_define([_lt_decl_all_varnames], -[lt_join($@, lt_decl_varnames_tagged([$1], - lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl -]) - - -# _LT_CONFIG_STATUS_DECLARE([VARNAME]) -# ------------------------------------ -# Quote a variable value, and forward it to `config.status' so that its -# declaration there will have the same value as in `configure'. VARNAME -# must have a single quote delimited value for this to work. -m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) - - -# _LT_CONFIG_STATUS_DECLARATIONS -# ------------------------------ -# We delimit libtool config variables with single quotes, so when -# we write them to config.status, we have to be sure to quote all -# embedded single quotes properly. In configure, this macro expands -# each variable declared with _LT_DECL (and _LT_TAGDECL) into: -# -# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' -m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], -[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), - [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAGS -# ---------------- -# Output comment and list of tags supported by the script -m4_defun([_LT_LIBTOOL_TAGS], -[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl -available_tags="_LT_TAGS"dnl -]) - - -# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) -# ----------------------------------- -# Extract the dictionary values for VARNAME (optionally with TAG) and -# expand to a commented shell variable setting: -# -# # Some comment about what VAR is for. -# visible_name=$lt_internal_name -m4_define([_LT_LIBTOOL_DECLARE], -[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], - [description])))[]dnl -m4_pushdef([_libtool_name], - m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl -m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), - [0], [_libtool_name=[$]$1], - [1], [_libtool_name=$lt_[]$1], - [2], [_libtool_name=$lt_[]$1], - [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl -m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl -]) - - -# _LT_LIBTOOL_CONFIG_VARS -# ----------------------- -# Produce commented declarations of non-tagged libtool config variables -# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' -# script. Tagged libtool config variables (even for the LIBTOOL CONFIG -# section) are produced by _LT_LIBTOOL_TAG_VARS. -m4_defun([_LT_LIBTOOL_CONFIG_VARS], -[m4_foreach([_lt_var], - m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAG_VARS(TAG) -# ------------------------- -m4_define([_LT_LIBTOOL_TAG_VARS], -[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) - - -# _LT_TAGVAR(VARNAME, [TAGNAME]) -# ------------------------------ -m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) - - -# _LT_CONFIG_COMMANDS -# ------------------- -# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of -# variables for single and double quote escaping we saved from calls -# to _LT_DECL, we can put quote escaped variables declarations -# into `config.status', and then the shell code to quote escape them in -# for loops in `config.status'. Finally, any additional code accumulated -# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. -m4_defun([_LT_CONFIG_COMMANDS], -[AC_PROVIDE_IFELSE([LT_OUTPUT], - dnl If the libtool generation code has been placed in $CONFIG_LT, - dnl instead of duplicating it all over again into config.status, - dnl then we will have config.status run $CONFIG_LT later, so it - dnl needs to know what name is stored there: - [AC_CONFIG_COMMANDS([libtool], - [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], - dnl If the libtool generation code is destined for config.status, - dnl expand the accumulated commands and init code now: - [AC_CONFIG_COMMANDS([libtool], - [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) -])#_LT_CONFIG_COMMANDS - - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], -[ - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -_LT_CONFIG_STATUS_DECLARATIONS -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$[]1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -_LT_OUTPUT_LIBTOOL_INIT -]) - -# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) -# ------------------------------------ -# Generate a child script FILE with all initialization necessary to -# reuse the environment learned by the parent script, and make the -# file executable. If COMMENT is supplied, it is inserted after the -# `#!' sequence but before initialization text begins. After this -# macro, additional text can be appended to FILE to form the body of -# the child script. The macro ends with non-zero status if the -# file could not be fully written (such as if the disk is full). -m4_ifdef([AS_INIT_GENERATED], -[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], -[m4_defun([_LT_GENERATED_FILE_INIT], -[m4_require([AS_PREPARE])]dnl -[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl -[lt_write_fail=0 -cat >$1 <<_ASEOF || lt_write_fail=1 -#! $SHELL -# Generated by $as_me. -$2 -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$1 <<\_ASEOF || lt_write_fail=1 -AS_SHELL_SANITIZE -_AS_PREPARE -exec AS_MESSAGE_FD>&1 -_ASEOF -test $lt_write_fail = 0 && chmod +x $1[]dnl -m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT - -# LT_OUTPUT -# --------- -# This macro allows early generation of the libtool script (before -# AC_OUTPUT is called), incase it is used in configure for compilation -# tests. -AC_DEFUN([LT_OUTPUT], -[: ${CONFIG_LT=./config.lt} -AC_MSG_NOTICE([creating $CONFIG_LT]) -_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], -[# Run this file to recreate a libtool stub with the current configuration.]) - -cat >>"$CONFIG_LT" <<\_LTEOF -lt_cl_silent=false -exec AS_MESSAGE_LOG_FD>>config.log -{ - echo - AS_BOX([Running $as_me.]) -} >&AS_MESSAGE_LOG_FD - -lt_cl_help="\ -\`$as_me' creates a local libtool stub from the current configuration, -for use in further configure time tests before the real libtool is -generated. - -Usage: $[0] [[OPTIONS]] - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - -Report bugs to ." - -lt_cl_version="\ -m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl -m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) -configured by $[0], generated by m4_PACKAGE_STRING. - -Copyright (C) 2010 Free Software Foundation, Inc. -This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." - -while test $[#] != 0 -do - case $[1] in - --version | --v* | -V ) - echo "$lt_cl_version"; exit 0 ;; - --help | --h* | -h ) - echo "$lt_cl_help"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --quiet | --q* | --silent | --s* | -q ) - lt_cl_silent=: ;; - - -*) AC_MSG_ERROR([unrecognized option: $[1] -Try \`$[0] --help' for more information.]) ;; - - *) AC_MSG_ERROR([unrecognized argument: $[1] -Try \`$[0] --help' for more information.]) ;; - esac - shift -done - -if $lt_cl_silent; then - exec AS_MESSAGE_FD>/dev/null -fi -_LTEOF - -cat >>"$CONFIG_LT" <<_LTEOF -_LT_OUTPUT_LIBTOOL_COMMANDS_INIT -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AC_MSG_NOTICE([creating $ofile]) -_LT_OUTPUT_LIBTOOL_COMMANDS -AS_EXIT(0) -_LTEOF -chmod +x "$CONFIG_LT" - -# configure is writing to config.log, but config.lt does its own redirection, -# appending to config.log, which fails on DOS, as config.log is still kept -# open by configure. Here we exec the FD to /dev/null, effectively closing -# config.log, so it can be properly (re)opened and appended to by config.lt. -lt_cl_success=: -test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" -exec AS_MESSAGE_LOG_FD>/dev/null -$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false -exec AS_MESSAGE_LOG_FD>>config.log -$lt_cl_success || AS_EXIT(1) -])# LT_OUTPUT - - -# _LT_CONFIG(TAG) -# --------------- -# If TAG is the built-in tag, create an initial libtool script with a -# default configuration from the untagged config vars. Otherwise add code -# to config.status for appending the configuration named by TAG from the -# matching tagged config vars. -m4_defun([_LT_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_CONFIG_SAVE_COMMANDS([ - m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl - m4_if(_LT_TAG, [C], [ - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM -f \"$cfgfile\"; exit 1" 1 2 15 - $RM -f "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -_LT_COPYING -_LT_LIBTOOL_TAGS - -# ### BEGIN LIBTOOL CONFIG -_LT_LIBTOOL_CONFIG_VARS -_LT_LIBTOOL_TAG_VARS -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - _LT_PROG_LTMAIN - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - _LT_PROG_XSI_SHELLFNS - - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -], -[cat <<_LT_EOF >> "$ofile" - -dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded -dnl in a comment (ie after a #). -# ### BEGIN LIBTOOL TAG CONFIG: $1 -_LT_LIBTOOL_TAG_VARS(_LT_TAG) -# ### END LIBTOOL TAG CONFIG: $1 -_LT_EOF -])dnl /m4_if -], -[m4_if([$1], [], [ - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile'], []) -])dnl /_LT_CONFIG_SAVE_COMMANDS -])# _LT_CONFIG - - -# LT_SUPPORTED_TAG(TAG) -# --------------------- -# Trace this macro to discover what tags are supported by the libtool -# --tag option, using: -# autoconf --trace 'LT_SUPPORTED_TAG:$1' -AC_DEFUN([LT_SUPPORTED_TAG], []) - - -# C support is built-in for now -m4_define([_LT_LANG_C_enabled], []) -m4_define([_LT_TAGS], []) - - -# LT_LANG(LANG) -# ------------- -# Enable libtool support for the given language if not already enabled. -AC_DEFUN([LT_LANG], -[AC_BEFORE([$0], [LT_OUTPUT])dnl -m4_case([$1], - [C], [_LT_LANG(C)], - [C++], [_LT_LANG(CXX)], - [Java], [_LT_LANG(GCJ)], - [Fortran 77], [_LT_LANG(F77)], - [Fortran], [_LT_LANG(FC)], - [Windows Resource], [_LT_LANG(RC)], - [m4_ifdef([_LT_LANG_]$1[_CONFIG], - [_LT_LANG($1)], - [m4_fatal([$0: unsupported language: "$1"])])])dnl -])# LT_LANG - - -# _LT_LANG(LANGNAME) -# ------------------ -m4_defun([_LT_LANG], -[m4_ifdef([_LT_LANG_]$1[_enabled], [], - [LT_SUPPORTED_TAG([$1])dnl - m4_append([_LT_TAGS], [$1 ])dnl - m4_define([_LT_LANG_]$1[_enabled], [])dnl - _LT_LANG_$1_CONFIG($1)])dnl -])# _LT_LANG - - -# _LT_LANG_DEFAULT_CONFIG -# ----------------------- -m4_defun([_LT_LANG_DEFAULT_CONFIG], -[AC_PROVIDE_IFELSE([AC_PROG_CXX], - [LT_LANG(CXX)], - [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) - -AC_PROVIDE_IFELSE([AC_PROG_F77], - [LT_LANG(F77)], - [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) - -AC_PROVIDE_IFELSE([AC_PROG_FC], - [LT_LANG(FC)], - [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) - -dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal -dnl pulling things in needlessly. -AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([LT_PROG_GCJ], - [LT_LANG(GCJ)], - [m4_ifdef([AC_PROG_GCJ], - [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([A][M_PROG_GCJ], - [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([LT_PROG_GCJ], - [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) - -AC_PROVIDE_IFELSE([LT_PROG_RC], - [LT_LANG(RC)], - [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) -])# _LT_LANG_DEFAULT_CONFIG - -# Obsolete macros: -AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) -AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) -AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) -AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) -AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_CXX], []) -dnl AC_DEFUN([AC_LIBTOOL_F77], []) -dnl AC_DEFUN([AC_LIBTOOL_FC], []) -dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) -dnl AC_DEFUN([AC_LIBTOOL_RC], []) - - -# _LT_TAG_COMPILER -# ---------------- -m4_defun([_LT_TAG_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl -_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl -_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_TAG_COMPILER - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -m4_defun([_LT_COMPILER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM -r conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -m4_defun([_LT_LINKER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* -])# _LT_LINKER_BOILERPLATE - -# _LT_REQUIRED_DARWIN_CHECKS -# ------------------------- -m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ - case $host_os in - rhapsody* | darwin*) - AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) - AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) - AC_CHECK_TOOL([LIPO], [lipo], [:]) - AC_CHECK_TOOL([OTOOL], [otool], [:]) - AC_CHECK_TOOL([OTOOL64], [otool64], [:]) - _LT_DECL([], [DSYMUTIL], [1], - [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) - _LT_DECL([], [NMEDIT], [1], - [Tool to change global to local symbols on Mac OS X]) - _LT_DECL([], [LIPO], [1], - [Tool to manipulate fat objects and archives on Mac OS X]) - _LT_DECL([], [OTOOL], [1], - [ldd/readelf like tool for Mach-O binaries on Mac OS X]) - _LT_DECL([], [OTOOL64], [1], - [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) - - AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], - [lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi]) - AC_CACHE_CHECK([for -exported_symbols_list linker flag], - [lt_cv_ld_exported_symbols_list], - [lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [lt_cv_ld_exported_symbols_list=yes], - [lt_cv_ld_exported_symbols_list=no]) - LDFLAGS="$save_LDFLAGS" - ]) - AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], - [lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD - echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD - $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - ]) - case $host_os in - rhapsody* | darwin1.[[012]]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[[012]]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac -]) - - -# _LT_DARWIN_LINKER_FEATURES -# -------------------------- -# Checks for linker and compiler features on darwin -m4_defun([_LT_DARWIN_LINKER_FEATURES], -[ - m4_require([_LT_REQUIRED_DARWIN_CHECKS]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_automatic, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='' - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - m4_if([$1], [CXX], -[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then - _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" - fi -],[]) - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi -]) - -# _LT_SYS_MODULE_PATH_AIX -# ----------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -m4_defun([_LT_SYS_MODULE_PATH_AIX], -[m4_require([_LT_DECL_SED])dnl -AC_LINK_IFELSE(AC_LANG_PROGRAM,[ -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi],[]) -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi -])# _LT_SYS_MODULE_PATH_AIX - - -# _LT_SHELL_INIT(ARG) -# ------------------- -m4_define([_LT_SHELL_INIT], -[m4_divert_text([M4SH-INIT], [$1 -])])# _LT_SHELL_INIT - - - -# _LT_PROG_ECHO_BACKSLASH -# ----------------------- -# Find how we can fake an echo command that does not interpret backslash. -# In particular, with Autoconf 2.60 or later we add some code to the start -# of the generated configure script which will find a shell with a builtin -# printf (which we can use as an echo command). -m4_defun([_LT_PROG_ECHO_BACKSLASH], -[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -AC_MSG_CHECKING([how to print strings]) -# Test print first, because it will be a builtin if present. -if test "X`print -r -- -n 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$[]1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -case "$ECHO" in - printf*) AC_MSG_RESULT([printf]) ;; - print*) AC_MSG_RESULT([print -r]) ;; - *) AC_MSG_RESULT([cat]) ;; -esac - -m4_ifdef([_AS_DETECT_SUGGESTED], -[_AS_DETECT_SUGGESTED([ - test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test "X`printf %s $ECHO`" = "X$ECHO" \ - || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) - -_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) -])# _LT_PROG_ECHO_BACKSLASH - - -# _LT_ENABLE_LOCK -# --------------- -m4_defun([_LT_ENABLE_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AS_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" -])# _LT_ENABLE_LOCK - - -# _LT_CMD_OLD_ARCHIVE -# ------------------- -m4_defun([_LT_CMD_OLD_ARCHIVE], -[AC_CHECK_TOOL(AR, ar, false) -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1]) - -AC_CHECK_TOOL(STRIP, strip, :) -test -z "$STRIP" && STRIP=: -_LT_DECL([], [STRIP], [1], [A symbol stripping program]) - -AC_CHECK_TOOL(RANLIB, ranlib, :) -test -z "$RANLIB" && RANLIB=: -_LT_DECL([], [RANLIB], [1], - [Commands used to install an old-style archive]) - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac -_LT_DECL([], [old_postinstall_cmds], [2]) -_LT_DECL([], [old_postuninstall_cmds], [2]) -_LT_TAGDECL([], [old_archive_cmds], [2], - [Commands used to build an old-style archive]) -_LT_DECL([], [lock_old_archive_extraction], [0], - [Whether to use a lock for old archive extraction]) -])# _LT_CMD_OLD_ARCHIVE - - -# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([_LT_COMPILER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - fi - $RM -r conftest* -]) - -if test x"[$]$2" = xyes; then - m4_if([$5], , :, [$5]) -else - m4_if([$6], , :, [$6]) -fi -])# _LT_COMPILER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) - - -# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------- -# Check whether the given linker option works -AC_DEFUN([_LT_LINKER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - else - $2=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - m4_if([$4], , :, [$4]) -else - m4_if([$5], , :, [$5]) -fi -])# _LT_LINKER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) - - -# LT_CMD_MAX_LEN -#--------------- -AC_DEFUN([LT_CMD_MAX_LEN], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -max_cmd_len=$lt_cv_sys_max_cmd_len -_LT_DECL([], [max_cmd_len], [0], - [What is the maximum length of a command?]) -])# LT_CMD_MAX_LEN - -# Old name: -AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) - - -# _LT_HEADER_DLFCN -# ---------------- -m4_defun([_LT_HEADER_DLFCN], -[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl -])# _LT_HEADER_DLFCN - - -# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ---------------------------------------------------------------- -m4_defun([_LT_TRY_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -[#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -void fnord () __attribute__((visibility("default"))); -#endif - -void fnord () { int i=42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -}] -_LT_EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_dlunknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_TRY_DLOPEN_SELF - - -# LT_SYS_DLOPEN_SELF -# ------------------ -AC_DEFUN([LT_SYS_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -_LT_DECL([dlopen_support], [enable_dlopen], [0], - [Whether dlopen is supported]) -_LT_DECL([dlopen_self], [enable_dlopen_self], [0], - [Whether dlopen of programs is supported]) -_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], - [Whether dlopen of statically linked programs is supported]) -])# LT_SYS_DLOPEN_SELF - -# Old name: -AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) - - -# _LT_COMPILER_C_O([TAGNAME]) -# --------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler. -# This macro does not hard code the compiler like AC_PROG_CC_C_O. -m4_defun([_LT_COMPILER_C_O], -[m4_require([_LT_DECL_SED])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . 2>&AS_MESSAGE_LOG_FD - $RM -r conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM -r conftest* -]) -_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], - [Does compiler simultaneously support -c and -o options?]) -])# _LT_COMPILER_C_O - - -# _LT_COMPILER_FILE_LOCKS([TAGNAME]) -# ---------------------------------- -# Check to see if we can do hard links to lock some files if needed -m4_defun([_LT_COMPILER_FILE_LOCKS], -[m4_require([_LT_ENABLE_LOCK])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_COMPILER_C_O([$1]) - -hard_links="nottested" -if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $RM -r conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) -])# _LT_COMPILER_FILE_LOCKS - - -# _LT_CHECK_OBJDIR -# ---------------- -m4_defun([_LT_CHECK_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -_LT_DECL([], [objdir], [0], - [The name of the directory that contains temporary libtool files])dnl -m4_pattern_allow([LT_OBJDIR])dnl -AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", - [Define to the sub-directory in which libtool stores uninstalled libraries.]) -])# _LT_CHECK_OBJDIR - - -# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) -# -------------------------------------- -# Check hardcoding attributes. -m4_defun([_LT_LINKER_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || - test -n "$_LT_TAGVAR(runpath_var, $1)" || - test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || - test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -_LT_TAGDECL([], [hardcode_action], [0], - [How to hardcode a shared library path into an executable]) -])# _LT_LINKER_HARDCODE_LIBPATH - - -# _LT_CMD_STRIPLIB -# ---------------- -m4_defun([_LT_CMD_STRIPLIB], -[m4_require([_LT_DECL_EGREP]) -striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) -_LT_DECL([], [striplib], [1]) -])# _LT_CMD_STRIPLIB - - -# _LT_SYS_DYNAMIC_LINKER([TAG]) -# ----------------------------- -# PORTME Fill in your ld.so characteristics -m4_defun([_LT_SYS_DYNAMIC_LINKER], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_OBJDUMP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -AC_MSG_CHECKING([dynamic linker characteristics]) -m4_if([$1], - [], [ -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[[lt_foo]]++; } - if (lt_freq[[lt_foo]] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[[4-9]]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[[45]]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext ${libname}${release}${versuffix}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[[123]]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[[01]]* | freebsdelf3.[[01]]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ - freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -haiku*) - version_type=linux - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[[3-9]]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], - [lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [lt_cv_shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - ]) - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - -_LT_DECL([], [variables_saved_for_relink], [1], - [Variables whose values should be saved in libtool wrapper scripts and - restored at link time]) -_LT_DECL([], [need_lib_prefix], [0], - [Do we need the "lib" prefix for modules?]) -_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) -_LT_DECL([], [version_type], [0], [Library versioning type]) -_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) -_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) -_LT_DECL([], [shlibpath_overrides_runpath], [0], - [Is shlibpath searched before the hard-coded library search path?]) -_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) -_LT_DECL([], [library_names_spec], [1], - [[List of archive names. First name is the real one, the rest are links. - The last name is the one that the linker finds with -lNAME]]) -_LT_DECL([], [soname_spec], [1], - [[The coded name of the library, if different from the real name]]) -_LT_DECL([], [install_override_mode], [1], - [Permission mode override for installation of shared libraries]) -_LT_DECL([], [postinstall_cmds], [2], - [Command to use after installation of a shared archive]) -_LT_DECL([], [postuninstall_cmds], [2], - [Command to use after uninstallation of a shared archive]) -_LT_DECL([], [finish_cmds], [2], - [Commands used to finish a libtool library installation in a directory]) -_LT_DECL([], [finish_eval], [1], - [[As "finish_cmds", except a single script fragment to be evaled but - not shown]]) -_LT_DECL([], [hardcode_into_libs], [0], - [Whether we should hardcode library paths into libraries]) -_LT_DECL([], [sys_lib_search_path_spec], [2], - [Compile-time system search path for libraries]) -_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], - [Run-time system search path for libraries]) -])# _LT_SYS_DYNAMIC_LINKER - - -# _LT_PATH_TOOL_PREFIX(TOOL) -# -------------------------- -# find a file program which can recognize shared library -AC_DEFUN([_LT_PATH_TOOL_PREFIX], -[m4_require([_LT_DECL_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="m4_if([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -_LT_DECL([], [MAGIC_CMD], [0], - [Used to examine libraries when file_magic_cmd begins with "file"])dnl -])# _LT_PATH_TOOL_PREFIX - -# Old name: -AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) - - -# _LT_PATH_MAGIC -# -------------- -# find a file program which can recognize a shared library -m4_defun([_LT_PATH_MAGIC], -[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# _LT_PATH_MAGIC - - -# LT_PATH_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([LT_PATH_LD], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PROG_ECHO_BACKSLASH])dnl - -AC_ARG_WITH([gnu-ld], - [AS_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no])dnl - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[[3-9]]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -_LT_DECL([], [deplibs_check_method], [1], - [Method to check whether dependent libraries are shared objects]) -_LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method == "file_magic"]) -])# _LT_CHECK_MAGIC_METHOD - - -# LT_PATH_NM -# ---------- -# find the pathname to a BSD- or MS-compatible name lister -AC_DEFUN([LT_PATH_NM], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi]) -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - AC_SUBST([DUMPBIN]) - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm -AC_SUBST([NM]) -_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl - -AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], - [lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) - cat conftest.out >&AS_MESSAGE_LOG_FD - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -r -f conftest*]) -])# LT_PATH_NM - -# Old names: -AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) -AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_PROG_NM], []) -dnl AC_DEFUN([AC_PROG_NM], []) - - -# LT_LIB_M -# -------- -# check for math library -AC_DEFUN([LT_LIB_M], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -AC_SUBST([LIBM]) -])# LT_LIB_M - -# Old name: -AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_CHECK_LIBM], []) - - -# _LT_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------- -m4_defun([_LT_COMPILER_NO_RTTI], -[m4_require([_LT_TAG_COMPILER])dnl - -_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; - *) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; - esac - - _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], - [Compiler flag to turn off builtin functions]) -])# _LT_COMPILER_NO_RTTI - - -# _LT_CMD_GLOBAL_SYMBOLS -# ---------------------- -m4_defun([_LT_CMD_GLOBAL_SYMBOLS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([LT_PATH_NM])dnl -AC_REQUIRE([LT_PATH_LD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_TAG_COMPILER])dnl - -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris*) - symcode='[[BDRT]]' - ;; -sco3.2v5*) - symcode='[[DT]]' - ;; -sysv4.2uw2*) - symcode='[[DT]]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[[ABDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK ['"\ -" {last_section=section; section=\$ 3};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx]" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -r -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[[]] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi - -_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], - [Take the output of nm and produce a listing of raw symbols and C names]) -_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], - [Transform the output of nm in a proper C declaration]) -_LT_DECL([global_symbol_to_c_name_address], - [lt_cv_sys_global_symbol_to_c_name_address], [1], - [Transform the output of nm in a C name address pair]) -_LT_DECL([global_symbol_to_c_name_address_lib_prefix], - [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], - [Transform the output of nm in a C name address pair when lib prefix is needed]) -]) # _LT_CMD_GLOBAL_SYMBOLS - - -# _LT_COMPILER_PIC([TAGNAME]) -# --------------------------- -m4_defun([_LT_COMPILER_PIC], -[m4_require([_LT_TAG_COMPILER])dnl -_LT_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_TAGVAR(lt_prog_compiler_static, $1)= - -AC_MSG_CHECKING([for $compiler option to produce PIC]) -m4_if([$1], [CXX], [ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix[[4-9]]*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - dgux*) - case $cc_basename in - ec++*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - KCC*) - # KAI C++ Compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - ecpc* ) - # old Intel C++ for x86_64 which still supported -KPIC. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - icpc* ) - # Intel C++, used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) - # IBM XL 8.0, 9.0 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx*) - # Digital/Compaq C++ - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc*) - # Lucid - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - hpux9* | hpux10* | hpux11*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' - _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - ccc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ F* | *Sun*Fortran*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' - ;; - *Sun\ C*) - # Sun C 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - esac - ;; - - newsos6) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - rdos*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - solaris*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac - ;; - - sunos4*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - unicos*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" - ;; -esac -AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], - [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], - [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], - [Additional compiler flags for building library objects]) - -# -# Check to make sure the static flag actually works. -# -wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" -_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], - _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), - $lt_tmp_static_flag, - [], - [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) -_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], - [Compiler flag to prevent dynamic linking]) -])# _LT_COMPILER_PIC - - -# _LT_LINKER_SHLIBS([TAGNAME]) -# ---------------------------- -# See if the linker supports building shared libraries. -m4_defun([_LT_LINKER_SHLIBS], -[AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -m4_if([$1], [CXX], [ - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - case $host_os in - aix[[4-9]]*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global defined - # symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw* | cegcc*) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] -], [ - runpath_var= - _LT_TAGVAR(allow_undefined_flag, $1)= - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(archive_cmds, $1)= - _LT_TAGVAR(archive_expsym_cmds, $1)= - _LT_TAGVAR(compiler_needs_object, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(hardcode_automatic, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_TAGVAR(hardcode_libdir_separator, $1)= - _LT_TAGVAR(hardcode_minus_L, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(inherit_rpath, $1)=no - _LT_TAGVAR(link_all_deplibs, $1)=unknown - _LT_TAGVAR(module_cmds, $1)= - _LT_TAGVAR(module_expsym_cmds, $1)= - _LT_TAGVAR(old_archive_from_new_cmds, $1)= - _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_TAGVAR(thread_safe_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. -dnl Note also adjust exclude_expsyms for C++ above. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_TAGVAR(ld_shlibs, $1)=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; - *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[[3-9]]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag= - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - _LT_TAGVAR(whole_archive_flag_spec, $1)= - tmp_sharedflag='--shared' ;; - xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - sunos4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - bsdi[[45]]*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - m4_if($1, [], [ - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - _LT_LINKER_OPTION([if $CC understands -b], - _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], - [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) - ;; - esac - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE(int foo(void) {}, - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - ) - LDFLAGS="$save_LDFLAGS" - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - solaris*) - _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - fi - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' - ;; - esac - fi - fi -]) -AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) -test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld - -_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl -_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl -_LT_DECL([], [extract_expsyms_cmds], [2], - [The commands to extract the exported symbol list from a shared archive]) - -# -# Do we need to explicitly link libc? -# -case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_CACHE_CHECK([whether -lc should be explicitly linked in], - [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), - [$RM -r conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM -r conftest* - ]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) - ;; - esac - fi - ;; -esac - -_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], - [Whether or not to add -lc for building shared libraries]) -_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], - [enable_shared_with_static_runtimes], [0], - [Whether or not to disallow shared libs when runtime libs are static]) -_LT_TAGDECL([], [export_dynamic_flag_spec], [1], - [Compiler flag to allow reflexive dlopens]) -_LT_TAGDECL([], [whole_archive_flag_spec], [1], - [Compiler flag to generate shared objects directly from archives]) -_LT_TAGDECL([], [compiler_needs_object], [1], - [Whether the compiler copes with passing no objects directly]) -_LT_TAGDECL([], [old_archive_from_new_cmds], [2], - [Create an old-style archive from a shared archive]) -_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], - [Create a temporary old-style archive to link instead of a shared archive]) -_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) -_LT_TAGDECL([], [archive_expsym_cmds], [2]) -_LT_TAGDECL([], [module_cmds], [2], - [Commands used to build a loadable module if different from building - a shared archive.]) -_LT_TAGDECL([], [module_expsym_cmds], [2]) -_LT_TAGDECL([], [with_gnu_ld], [1], - [Whether we are building with GNU ld or not]) -_LT_TAGDECL([], [allow_undefined_flag], [1], - [Flag that allows shared libraries with undefined symbols to be built]) -_LT_TAGDECL([], [no_undefined_flag], [1], - [Flag that enforces no undefined symbols]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], - [Flag to hardcode $libdir into a binary during linking. - This must work even if $libdir does not exist]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], - [[If ld is used when linking, flag to hardcode $libdir into a binary - during linking. This must work even if $libdir does not exist]]) -_LT_TAGDECL([], [hardcode_libdir_separator], [1], - [Whether we need a single "-rpath" flag with a separated argument]) -_LT_TAGDECL([], [hardcode_direct], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary]) -_LT_TAGDECL([], [hardcode_direct_absolute], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary and the resulting library dependency is - "absolute", i.e impossible to change by setting ${shlibpath_var} if the - library is relocated]) -_LT_TAGDECL([], [hardcode_minus_L], [0], - [Set to "yes" if using the -LDIR flag during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_shlibpath_var], [0], - [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_automatic], [0], - [Set to "yes" if building a shared library automatically hardcodes DIR - into the library and all subsequent libraries and executables linked - against it]) -_LT_TAGDECL([], [inherit_rpath], [0], - [Set to yes if linker adds runtime paths of dependent libraries - to runtime path list]) -_LT_TAGDECL([], [link_all_deplibs], [0], - [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [fix_srcfile_path], [1], - [Fix the shell variable $srcfile for the compiler]) -_LT_TAGDECL([], [always_export_symbols], [0], - [Set to "yes" if exported symbols are required]) -_LT_TAGDECL([], [export_symbols_cmds], [2], - [The commands to list exported symbols]) -_LT_TAGDECL([], [exclude_expsyms], [1], - [Symbols that should not be listed in the preloaded symbols]) -_LT_TAGDECL([], [include_expsyms], [1], - [Symbols that must always be exported]) -_LT_TAGDECL([], [prelink_cmds], [2], - [Commands necessary for linking programs (against libraries) with templates]) -_LT_TAGDECL([], [file_list_spec], [1], - [Specify filename containing input files]) -dnl FIXME: Not yet implemented -dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], -dnl [Compiler flag to generate thread safe objects]) -])# _LT_LINKER_SHLIBS - - -# _LT_LANG_C_CONFIG([TAG]) -# ------------------------ -# Ensure that the configuration variables for a C compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_C_CONFIG], -[m4_require([_LT_DECL_EGREP])dnl -lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - -_LT_TAG_COMPILER -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - LT_SYS_DLOPEN_SELF - _LT_CMD_STRIPLIB - - # Report which library types will actually be built - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_CONFIG($1) -fi -AC_LANG_POP -CC="$lt_save_CC" -])# _LT_LANG_C_CONFIG - - -# _LT_LANG_CXX_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a C++ compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_CXX_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -else - _lt_caught_CXX_error=yes -fi - -AC_LANG_PUSH(C++) -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(compiler_needs_object, $1)=no -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_caught_CXX_error" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - else - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - fi - - if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - LT_PATH_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - GXX=no - with_gnu_ld=no - wlarc= - fi - - # PORTME: fill in a description of your system's C++ link characteristics - AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) - _LT_TAGVAR(ld_shlibs, $1)=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GXX" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - freebsd[[12]]*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - freebsd-elf*) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - gnu*) - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - hpux9*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' - fi - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) - _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' - _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ - $RANLIB $oldlib' - _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - *) # Version 6 and above use weak symbols - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' - ;; - xl* | mpixl* | bgxl*) - # IBM XL 8.0 on PPC, with GNU ld - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - - *nto* | *qnx*) - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - openbsd2*) - # C++ shared libraries are fairly broken - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd=func_echo_all - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - case $host in - osf3*) - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - ;; - *) - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ - $RM $lib.exp' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - case $host in - osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(archive_cmds_need_lc,$1)=yes - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - fi - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ - '"$_LT_TAGVAR(old_archive_cmds, $1)" - _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ - '"$_LT_TAGVAR(reload_cmds, $1)" - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) - test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - - _LT_TAGVAR(GCC, $1)="$GXX" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - CC=$lt_save_CC - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test "$_lt_caught_CXX_error" != yes - -AC_LANG_POP -])# _LT_LANG_CXX_CONFIG - - -# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) -# --------------------------------- -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -m4_defun([_LT_SYS_HIDDEN_LIBDEPS], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -# Dependencies to place before and after the object being linked: -_LT_TAGVAR(predep_objects, $1)= -_LT_TAGVAR(postdep_objects, $1)= -_LT_TAGVAR(predeps, $1)= -_LT_TAGVAR(postdeps, $1)= -_LT_TAGVAR(compiler_lib_search_path, $1)= - -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF -int a; -void foo (void) { a = 0; } -_LT_EOF -], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF -], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer*4 a - a=0 - return - end -_LT_EOF -], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer a - a=0 - return - end -_LT_EOF -], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF -public class foo { - private int a; - public void bar (void) { - a = 0; - } -}; -_LT_EOF -]) -dnl Parse the compiler output and extract the necessary -dnl objects, libraries and library flags. -if AC_TRY_EVAL(ac_compile); then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case $p in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" || - test $p = "-R"; then - prev=$p - continue - else - prev= - fi - - if test "$pre_test_object_deps_done" = no; then - case $p in - -L* | -R*) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" - else - _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$_LT_TAGVAR(postdeps, $1)"; then - _LT_TAGVAR(postdeps, $1)="${prev}${p}" - else - _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" - fi - fi - ;; - - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$_LT_TAGVAR(predep_objects, $1)"; then - _LT_TAGVAR(predep_objects, $1)="$p" - else - _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" - fi - else - if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then - _LT_TAGVAR(postdep_objects, $1)="$p" - else - _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling $1 test program" -fi - -$RM -f confest.$objext - -# PORTME: override above test on systems where it is broken -m4_if([$1], [CXX], -[case $host_os in -interix[[3-9]]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - _LT_TAGVAR(predep_objects,$1)= - _LT_TAGVAR(postdep_objects,$1)= - _LT_TAGVAR(postdeps,$1)= - ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC* | sunCC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac -]) - -case " $_LT_TAGVAR(postdeps, $1) " in -*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; -esac - _LT_TAGVAR(compiler_lib_search_dirs, $1)= -if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then - _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` -fi -_LT_TAGDECL([], [compiler_lib_search_dirs], [1], - [The directories searched by this compiler when creating a shared library]) -_LT_TAGDECL([], [predep_objects], [1], - [Dependencies to place before and after the objects being linked to - create a shared library]) -_LT_TAGDECL([], [postdep_objects], [1]) -_LT_TAGDECL([], [predeps], [1]) -_LT_TAGDECL([], [postdeps], [1]) -_LT_TAGDECL([], [compiler_lib_search_path], [1], - [The library search path used internally by the compiler when linking - a shared library]) -])# _LT_SYS_HIDDEN_LIBDEPS - - -# _LT_LANG_F77_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a Fortran 77 compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_F77_CONFIG], -[AC_LANG_PUSH(Fortran 77) -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the F77 compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_F77" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - CC=${F77-"f77"} - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - GCC=$G77 - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$G77" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" -fi # test "$_lt_disable_F77" != yes - -AC_LANG_POP -])# _LT_LANG_F77_CONFIG - - -# _LT_LANG_FC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for a Fortran compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_FC_CONFIG], -[AC_LANG_PUSH(Fortran) - -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for fc test sources. -ac_ext=${ac_fc_srcext-f} - -# Object file extension for compiled fc test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the FC compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_FC" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - CC=${FC-"f95"} - compiler=$CC - GCC=$ac_cv_fc_compiler_gnu - - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" -fi # test "$_lt_disable_FC" != yes - -AC_LANG_POP -])# _LT_LANG_FC_CONFIG - - -# _LT_LANG_GCJ_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Java Compiler compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_GCJ_CONFIG], -[AC_REQUIRE([LT_PROG_GCJ])dnl -AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_GCC=$GCC -GCC=yes -CC=${GCJ-"gcj"} -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" -_LT_CC_BASENAME([$compiler]) - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds - -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC="$lt_save_CC" -])# _LT_LANG_GCJ_CONFIG - - -# _LT_LANG_RC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for the Windows resource compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_RC_CONFIG], -[AC_REQUIRE([LT_PROG_RC])dnl -AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_GCC=$GCC -GCC= -CC=${RC-"windres"} -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) -_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -if test -n "$compiler"; then - : - _LT_CONFIG($1) -fi - -GCC=$lt_save_GCC -AC_LANG_RESTORE -CC="$lt_save_CC" -])# _LT_LANG_RC_CONFIG - - -# LT_PROG_GCJ -# ----------- -AC_DEFUN([LT_PROG_GCJ], -[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], - [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], - [AC_CHECK_TOOL(GCJ, gcj,) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS)])])[]dnl -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_GCJ], []) - - -# LT_PROG_RC -# ---------- -AC_DEFUN([LT_PROG_RC], -[AC_CHECK_TOOL(RC, windres,) -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_RC], []) - - -# _LT_DECL_EGREP -# -------------- -# If we don't have a new enough Autoconf to choose the best grep -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_EGREP], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_REQUIRE([AC_PROG_FGREP])dnl -test -z "$GREP" && GREP=grep -_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) -_LT_DECL([], [EGREP], [1], [An ERE matcher]) -_LT_DECL([], [FGREP], [1], [A literal string matcher]) -dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too -AC_SUBST([GREP]) -]) - - -# _LT_DECL_OBJDUMP -# -------------- -# If we don't have a new enough Autoconf to choose the best objdump -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_OBJDUMP], -[AC_CHECK_TOOL(OBJDUMP, objdump, false) -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) -AC_SUBST([OBJDUMP]) -]) - - -# _LT_DECL_SED -# ------------ -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -m4_defun([_LT_DECL_SED], -[AC_PROG_SED -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" -_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) -_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], - [Sed that helps us avoid accidentally triggering echo(1) options like -n]) -])# _LT_DECL_SED - -m4_ifndef([AC_PROG_SED], [ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # - -m4_defun([AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -IFS=$as_save_IFS -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -]) -SED=$lt_cv_path_SED -AC_SUBST([SED]) -AC_MSG_RESULT([$SED]) -])#AC_PROG_SED -])#m4_ifndef - -# Old name: -AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_SED], []) - - -# _LT_CHECK_SHELL_FEATURES -# ------------------------ -# Find out whether the shell is Bourne or XSI compatible, -# or has some other useful features. -m4_defun([_LT_CHECK_SHELL_FEATURES], -[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -AC_MSG_RESULT([$xsi_shell]) -_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) - -AC_MSG_CHECKING([whether the shell understands "+="]) -lt_shell_append=no -( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -AC_MSG_RESULT([$lt_shell_append]) -_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi -_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac -_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl -_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl -])# _LT_CHECK_SHELL_FEATURES - - -# _LT_PROG_XSI_SHELLFNS -# --------------------- -# Bourne and XSI compatible variants of some useful shell functions. -m4_defun([_LT_PROG_XSI_SHELLFNS], -[case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $[*] )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} - -_LT_EOF - ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} - -dnl func_dirname_and_basename -dnl A portable version of this function is already defined in general.m4sh -dnl so there is no need for it here. - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} - -# sed scripts: -my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[[^=]]*=//' - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"` -} - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "${1}" | $SED 's/\.[[^.]]*$/.lo/'` -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$[@]"` -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len` -} - -_LT_EOF -esac - -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]+=\$[2]" -} -_LT_EOF - ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$[1]=\$$[1]\$[2]" -} - -_LT_EOF - ;; - esac -]) - -# Helper functions for option handling. -*- Autoconf -*- -# -# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 7 ltoptions.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) - - -# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) -# ------------------------------------------ -m4_define([_LT_MANGLE_OPTION], -[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) - - -# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) -# --------------------------------------- -# Set option OPTION-NAME for macro MACRO-NAME, and if there is a -# matching handler defined, dispatch to it. Other OPTION-NAMEs are -# saved as a flag. -m4_define([_LT_SET_OPTION], -[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl -m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), - _LT_MANGLE_DEFUN([$1], [$2]), - [m4_warning([Unknown $1 option `$2'])])[]dnl -]) - - -# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) -# ------------------------------------------------------------ -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -m4_define([_LT_IF_OPTION], -[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) - - -# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) -# ------------------------------------------------------- -# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME -# are set. -m4_define([_LT_UNLESS_OPTIONS], -[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), - [m4_define([$0_found])])])[]dnl -m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 -])[]dnl -]) - - -# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) -# ---------------------------------------- -# OPTION-LIST is a space-separated list of Libtool options associated -# with MACRO-NAME. If any OPTION has a matching handler declared with -# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about -# the unknown option and exit. -m4_defun([_LT_SET_OPTIONS], -[# Set options -m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [_LT_SET_OPTION([$1], _LT_Option)]) - -m4_if([$1],[LT_INIT],[ - dnl - dnl Simply set some default values (i.e off) if boolean options were not - dnl specified: - _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no - ]) - _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no - ]) - dnl - dnl If no reference was made to various pairs of opposing options, then - dnl we run the default mode handler for the pair. For example, if neither - dnl `shared' nor `disable-shared' was passed, we enable building of shared - dnl archives by default: - _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) - _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], - [_LT_ENABLE_FAST_INSTALL]) - ]) -])# _LT_SET_OPTIONS - - - -# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) -# ----------------------------------------- -m4_define([_LT_MANGLE_DEFUN], -[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) - - -# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) -# ----------------------------------------------- -m4_define([LT_OPTION_DEFINE], -[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl -])# LT_OPTION_DEFINE - - -# dlopen -# ------ -LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes -]) - -AU_DEFUN([AC_LIBTOOL_DLOPEN], -[_LT_SET_OPTION([LT_INIT], [dlopen]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `dlopen' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) - - -# win32-dll -# --------- -# Declare package support for building win32 dll's. -LT_OPTION_DEFINE([LT_INIT], [win32-dll], -[enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -esac - -test -z "$AS" && AS=as -_LT_DECL([], [AS], [1], [Assembler program])dnl - -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl - -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl -])# win32-dll - -AU_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -_LT_SET_OPTION([LT_INIT], [win32-dll]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `win32-dll' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) - - -# _LT_ENABLE_SHARED([DEFAULT]) -# ---------------------------- -# implement the --enable-shared flag, and supports the `shared' and -# `disable-shared' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_SHARED], -[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([shared], - [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) - - _LT_DECL([build_libtool_libs], [enable_shared], [0], - [Whether or not to build shared libraries]) -])# _LT_ENABLE_SHARED - -LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) -]) - -AC_DEFUN([AC_DISABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], [disable-shared]) -]) - -AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_SHARED], []) -dnl AC_DEFUN([AM_DISABLE_SHARED], []) - - - -# _LT_ENABLE_STATIC([DEFAULT]) -# ---------------------------- -# implement the --enable-static flag, and support the `static' and -# `disable-static' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_STATIC], -[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([static], - [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]_LT_ENABLE_STATIC_DEFAULT) - - _LT_DECL([build_old_libs], [enable_static], [0], - [Whether or not to build static libraries]) -])# _LT_ENABLE_STATIC - -LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) -]) - -AC_DEFUN([AC_DISABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], [disable-static]) -]) - -AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_STATIC], []) -dnl AC_DEFUN([AM_DISABLE_STATIC], []) - - - -# _LT_ENABLE_FAST_INSTALL([DEFAULT]) -# ---------------------------------- -# implement the --enable-fast-install flag, and support the `fast-install' -# and `disable-fast-install' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_FAST_INSTALL], -[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([fast-install], - [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) - -_LT_DECL([fast_install], [enable_fast_install], [0], - [Whether or not to optimize for fast installation])dnl -])# _LT_ENABLE_FAST_INSTALL - -LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) - -# Old names: -AU_DEFUN([AC_ENABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `fast-install' option into LT_INIT's first parameter.]) -]) - -AU_DEFUN([AC_DISABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `disable-fast-install' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) -dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) - - -# _LT_WITH_PIC([MODE]) -# -------------------- -# implement the --with-pic flag, and support the `pic-only' and `no-pic' -# LT_INIT options. -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -m4_define([_LT_WITH_PIC], -[AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) - -test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) - -_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl -])# _LT_WITH_PIC - -LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) - -# Old name: -AU_DEFUN([AC_LIBTOOL_PICMODE], -[_LT_SET_OPTION([LT_INIT], [pic-only]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `pic-only' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) - - -m4_define([_LTDL_MODE], []) -LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], - [m4_define([_LTDL_MODE], [nonrecursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [recursive], - [m4_define([_LTDL_MODE], [recursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [subproject], - [m4_define([_LTDL_MODE], [subproject])]) - -m4_define([_LTDL_TYPE], []) -LT_OPTION_DEFINE([LTDL_INIT], [installable], - [m4_define([_LTDL_TYPE], [installable])]) -LT_OPTION_DEFINE([LTDL_INIT], [convenience], - [m4_define([_LTDL_TYPE], [convenience])]) - -# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 6 ltsugar.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) - - -# lt_join(SEP, ARG1, [ARG2...]) -# ----------------------------- -# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their -# associated separator. -# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier -# versions in m4sugar had bugs. -m4_define([lt_join], -[m4_if([$#], [1], [], - [$#], [2], [[$2]], - [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) -m4_define([_lt_join], -[m4_if([$#$2], [2], [], - [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) - - -# lt_car(LIST) -# lt_cdr(LIST) -# ------------ -# Manipulate m4 lists. -# These macros are necessary as long as will still need to support -# Autoconf-2.59 which quotes differently. -m4_define([lt_car], [[$1]]) -m4_define([lt_cdr], -[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], - [$#], 1, [], - [m4_dquote(m4_shift($@))])]) -m4_define([lt_unquote], $1) - - -# lt_append(MACRO-NAME, STRING, [SEPARATOR]) -# ------------------------------------------ -# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. -# Note that neither SEPARATOR nor STRING are expanded; they are appended -# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). -# No SEPARATOR is output if MACRO-NAME was previously undefined (different -# than defined and empty). -# -# This macro is needed until we can rely on Autoconf 2.62, since earlier -# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. -m4_define([lt_append], -[m4_define([$1], - m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) - - - -# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) -# ---------------------------------------------------------- -# Produce a SEP delimited list of all paired combinations of elements of -# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list -# has the form PREFIXmINFIXSUFFIXn. -# Needed until we can rely on m4_combine added in Autoconf 2.62. -m4_define([lt_combine], -[m4_if(m4_eval([$# > 3]), [1], - [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl -[[m4_foreach([_Lt_prefix], [$2], - [m4_foreach([_Lt_suffix], - ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, - [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) - - -# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) -# ----------------------------------------------------------------------- -# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited -# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. -m4_define([lt_if_append_uniq], -[m4_ifdef([$1], - [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], - [lt_append([$1], [$2], [$3])$4], - [$5])], - [lt_append([$1], [$2], [$3])$4])]) - - -# lt_dict_add(DICT, KEY, VALUE) -# ----------------------------- -m4_define([lt_dict_add], -[m4_define([$1($2)], [$3])]) - - -# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) -# -------------------------------------------- -m4_define([lt_dict_add_subkey], -[m4_define([$1($2:$3)], [$4])]) - - -# lt_dict_fetch(DICT, KEY, [SUBKEY]) -# ---------------------------------- -m4_define([lt_dict_fetch], -[m4_ifval([$3], - m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), - m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) - - -# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) -# ----------------------------------------------------------------- -m4_define([lt_if_dict_fetch], -[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], - [$5], - [$6])]) - - -# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) -# -------------------------------------------------------------- -m4_define([lt_dict_filter], -[m4_if([$5], [], [], - [lt_join(m4_quote(m4_default([$4], [[, ]])), - lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), - [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl -]) - -# ltversion.m4 -- version numbers -*- Autoconf -*- -# -# Copyright (C) 2004 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# Generated from ltversion.in. - -# serial 3175 ltversion.m4 -# This file is part of GNU Libtool - -m4_define([LT_PACKAGE_VERSION], [2.2.10]) -m4_define([LT_PACKAGE_REVISION], [1.3175]) - -AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.2.10' -macro_revision='1.3175' -_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) -_LT_DECL(, macro_revision, 0) -]) - -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 5 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) -m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) -m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) -m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) -m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) -m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) -m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) - -# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -# (This private macro should not be called outside this file.) -AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.10' -dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to -dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.10], [], - [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl -]) - -# _AM_AUTOCONF_VERSION(VERSION) -# ----------------------------- -# aclocal traces this macro to find the Autoconf version. -# This is a private macro too. Using m4_define simplifies -# the logic in aclocal, which can simply ignore this definition. -m4_define([_AM_AUTOCONF_VERSION], []) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. -# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.10])dnl -_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) - -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to -# `$srcdir', `$srcdir/..', or `$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is `.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) - -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 8 - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ(2.52)dnl - ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE])dnl -AC_SUBST([$1_FALSE])dnl -_AM_SUBST_NOTMAKE([$1_TRUE])dnl -_AM_SUBST_NOTMAKE([$1_FALSE])dnl -if $2; then - $1_TRUE= - $1_FALSE='#' -else - $1_TRUE='#' - $1_FALSE= -fi -AC_CONFIG_COMMANDS_PRE( -[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then - AC_MSG_ERROR([[conditional "$1" was never defined. -Usually this means the macro was only invoked conditionally.]]) -fi])]) - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 9 - -# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be -# written in clear, in which case automake, when reading aclocal.m4, -# will think it sees a *use*, and therefore will trigger all it's -# C support machinery. Also note that it means that autoscan, seeing -# CC etc. in the Makefile, will ask for an AC_PROG_CC use... - - -# _AM_DEPENDENCIES(NAME) -# ---------------------- -# See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "GCJ", or "OBJC". -# We try a few techniques and use that to set a single cache variable. -# -# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was -# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular -# dependency, and given that the user is not expected to run this macro, -# just rely on AC_PROG_CC. -AC_DEFUN([_AM_DEPENDENCIES], -[AC_REQUIRE([AM_SET_DEPDIR])dnl -AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl -AC_REQUIRE([AM_MAKE_INCLUDE])dnl -AC_REQUIRE([AM_DEP_TRACK])dnl - -ifelse([$1], CC, [depcc="$CC" am_compiler_list=], - [$1], CXX, [depcc="$CXX" am_compiler_list=], - [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], UPC, [depcc="$UPC" am_compiler_list=], - [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) - -AC_CACHE_CHECK([dependency style of $depcc], - [am_cv_$1_dependencies_compiler_type], -[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE(dependency-tracking, -[ --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH])dnl -_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl -]) - -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -#serial 3 - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done -])# _AM_OUTPUT_DEPENDENCY_COMMANDS - - -# AM_OUTPUT_DEPENDENCY_COMMANDS -# ----------------------------- -# This macro should only be invoked once -- use via AC_REQUIRE. -# -# This code is only required when automatic dependency tracking -# is enabled. FIXME. This creates each `.P' file that we will -# need in order to bootstrap the dependency handling code. -AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], -[AC_CONFIG_COMMANDS([depfiles], - [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) -]) - -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 12 - -# This macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.60])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi -AC_SUBST([CYGPATH_W]) - -# Define the identity of the package. -dnl Distinguish between old-style and new-style calls. -m4_ifval([$2], -[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl -dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, - [m4_fatal([AC_INIT should be called with package and version arguments])])dnl - AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl - AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl - -_AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) - AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl - -# Some tools Automake needs. -AC_REQUIRE([AM_SANITY_CHECK])dnl -AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) -AM_MISSING_PROG(AUTOCONF, autoconf) -AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) -AM_MISSING_PROG(AUTOHEADER, autoheader) -AM_MISSING_PROG(MAKEINFO, makeinfo) -AM_PROG_INSTALL_SH -AM_PROG_INSTALL_STRIP -AC_REQUIRE([AM_PROG_MKDIR_P])dnl -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES(CC)], - [define([AC_PROG_CC], - defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES(CXX)], - [define([AC_PROG_CXX], - defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES(OBJC)], - [define([AC_PROG_OBJC], - defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl -]) -]) - - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $1 | $1:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} -AC_SUBST(install_sh)]) - -# Copyright (C) 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) - -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 3 - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) - -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 5 - -# AM_MISSING_PROG(NAME, PROGRAM) -# ------------------------------ -AC_DEFUN([AM_MISSING_PROG], -[AC_REQUIRE([AM_MISSING_HAS_RUN]) -$1=${$1-"${am_missing_run}$2"} -AC_SUBST($1)]) - - -# AM_MISSING_HAS_RUN -# ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - AC_MSG_WARN([`missing' script is too old or missing]) -fi -]) - -# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_MKDIR_P -# --------------- -# Check for `mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) - -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 3 - -# _AM_MANGLE_OPTION(NAME) -# ----------------------- -AC_DEFUN([_AM_MANGLE_OPTION], -[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) - -# _AM_SET_OPTION(NAME) -# ------------------------------ -# Set option NAME. Presently that only means defining a flag for this option. -AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) - -# _AM_SET_OPTIONS(OPTIONS) -# ---------------------------------- -# OPTIONS is a space-separated list of Automake options. -AC_DEFUN([_AM_SET_OPTIONS], -[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) - -# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) -# ------------------------------------------- -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -AC_DEFUN([_AM_IF_OPTION], -[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) - -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 -# Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 4 - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken -alias in your environment]) - fi - - test "$[2]" = conftest.file - ) -then - # Ok. - : -else - AC_MSG_ERROR([newly created file is older than distributed files! -Check your system clock]) -fi -AC_MSG_RESULT(yes)]) - -# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor `install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in `make install-strip', and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be `maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) - -# Copyright (C) 2006 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004, 2005 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# serial 2 - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of `v7', `ustar', or `pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. -AM_MISSING_PROG([AMTAR], [tar]) -m4_if([$1], [v7], - [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], - [m4_case([$1], [ustar],, [pax],, - [m4_fatal([Unknown tar format])]) -AC_MSG_CHECKING([how to create a $1 tar archive]) -# Loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' -_am_tools=${am_cv_prog_tar_$1-$_am_tools} -# Do not fold the above two line into one, because Tru64 sh and -# Solaris sh will not grok spaces in the rhs of `-'. -for _am_tool in $_am_tools -do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; - do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi -done -rm -rf conftest.dir - -AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) -AC_MSG_RESULT([$am_cv_prog_tar_$1])]) -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR - diff --git a/lang/c/jansson/config.guess b/lang/c/jansson/config.guess deleted file mode 100755 index 396482d6cb5..00000000000 --- a/lang/c/jansson/config.guess +++ /dev/null @@ -1,1500 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2006-07-02' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - x86:Interix*:[3456]*) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - EM64T:Interix*:[3456]*) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^CPU/{ - s: ::g - p - }'`" - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. cd to the root directory to prevent - # problems with other programs or directories called `ld' in the path. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC) - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n ' - /^LIBC/{ - s: ::g - p - }'`" - test x"${LIBC}" != x && { - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit - } - test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } - ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i386. - echo i386-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 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) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/lang/c/jansson/config.h.in b/lang/c/jansson/config.h.in deleted file mode 100644 index b5c82aa825f..00000000000 --- a/lang/c/jansson/config.h.in +++ /dev/null @@ -1,75 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if the system has the type `long long int'. */ -#undef HAVE_LONG_LONG_INT - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to the type of a signed integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -#undef int32_t diff --git a/lang/c/jansson/config.sub b/lang/c/jansson/config.sub deleted file mode 100755 index fab0aa35566..00000000000 --- a/lang/c/jansson/config.sub +++ /dev/null @@ -1,1616 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, -# Inc. - -timestamp='2006-09-20' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ - uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | mt \ - | msp430 \ - | nios | nios2 \ - | ns16k | ns32k \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | score \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ - | xstormy16-* | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16c) - basic_machine=cr16c-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc) basic_machine=powerpc-unknown - ;; - ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/lang/c/jansson/configure b/lang/c/jansson/configure deleted file mode 100755 index 218c032292d..00000000000 --- a/lang/c/jansson/configure +++ /dev/null @@ -1,13010 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for jansson 2.1. -# -# Report bugs to . -# -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 - - test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ - || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org and petri@digip.org -$0: about your system, including any error possibly output -$0: before this message. Then install a modern shell, or -$0: manually run the script under such a shell if you do -$0: have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - -SHELL=${CONFIG_SHELL-/bin/sh} - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='jansson' -PACKAGE_TARNAME='jansson' -PACKAGE_VERSION='2.1' -PACKAGE_STRING='jansson 2.1' -PACKAGE_BUGREPORT='petri@digip.org' -PACKAGE_URL='' - -ac_unique_file="src/value.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='LTLIBOBJS -LIBOBJS -json_inline -json_have_long_long -GCC_FALSE -GCC_TRUE -CPP -OTOOL64 -OTOOL -LIPO -NMEDIT -DSYMUTIL -RANLIB -AR -OBJDUMP -LN_S -NM -ac_ct_DUMPBIN -DUMPBIN -LD -FGREP -EGREP -GREP -SED -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -LIBTOOL -am__fastdepCC_FALSE -am__fastdepCC_TRUE -CCDEPMODE -AMDEPBACKSLASH -AMDEP_FALSE -AMDEP_TRUE -am__quote -am__include -DEPDIR -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -am__untar -am__tar -AMTAR -am__leading_dot -SET_MAKE -AWK -mkdir_p -MKDIR_P -INSTALL_STRIP_PROGRAM -STRIP -install_sh -MAKEINFO -AUTOHEADER -AUTOMAKE -AUTOCONF -ACLOCAL -VERSION -PACKAGE -CYGPATH_W -am__isrc -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_dependency_tracking -enable_shared -enable_static -with_pic -enable_fast_install -with_gnu_ld -enable_libtool_lock -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures jansson 2.1 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/jansson] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -Program names: - --program-prefix=PREFIX prepend PREFIX to installed program names - --program-suffix=SUFFIX append SUFFIX to installed program names - --program-transform-name=PROGRAM run sed PROGRAM on installed program names - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of jansson 2.1:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-dependency-tracking speeds up one-time build - --enable-dependency-tracking do not reject slow dependency extractors - --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pic try to use only PIC/non-PIC objects [default=use - both] - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -jansson configure 2.1 -generated by GNU Autoconf 2.68 - -Copyright (C) 2010 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func - -# ac_fn_c_find_intX_t LINENO BITS VAR -# ----------------------------------- -# Finds a signed integer type with width BITS, setting cache variable VAR -# accordingly. -ac_fn_c_find_intX_t () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 -$as_echo_n "checking for int$2_t... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - # Order is important - never check a type that is potentially smaller - # than half of the expected target width. - for ac_type in int$2_t 'int' 'long int' \ - 'long long int' 'short int' 'signed char'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default - enum { N = $2 / 2 - 1 }; -int -main () -{ -static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default - enum { N = $2 / 2 - 1 }; -int -main () -{ -static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) - < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; -test_array [0] = 0 - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - case $ac_type in #( - int$2_t) : - eval "$3=yes" ;; #( - *) : - eval "$3=\$ac_type" ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if eval test \"x\$"$3"\" = x"no"; then : - -else - break -fi - done -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_find_intX_t -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by jansson $as_me 2.1, which was -generated by GNU Autoconf 2.68. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -am__api_version='1.10' - -ac_aux_dir= -for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 -$as_echo_n "checking whether build environment is sane... " >&6; } -# Just in case -sleep 1 -echo timestamp > conftest.file -# Do `set' in a subshell so we don't clobber the current shell's -# arguments. Must try -L first in case configure is actually a -# symlink; some systems play weird games with the mod time of symlinks -# (eg FreeBSD returns the mod time of the symlink's containing -# directory). -if ( - set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t $srcdir/configure conftest.file` - fi - rm -f conftest.file - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken -alias in your environment" "$LINENO" 5 - fi - - test "$2" = conftest.file - ) -then - # Ok. - : -else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -test "$program_prefix" != NONE && - program_transform_name="s&^&$program_prefix&;$program_transform_name" -# Use a double $ so make ignores it. -test "$program_suffix" != NONE && - program_transform_name="s&\$&$program_suffix&;$program_transform_name" -# Double any \ or $. -# By default was `s,x,x', remove it if useless. -ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' -program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` - -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` - -test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" -# Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " -else - am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 -$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } -if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do - for ac_exec_ext in '' $ac_executable_extensions; do - { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue - case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( - 'mkdir (GNU coreutils) '* | \ - 'mkdir (coreutils) '* | \ - 'mkdir (fileutils) '4.1*) - ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext - break 3;; - esac - done - done - done -IFS=$as_save_IFS - -fi - - test -d ./--version && rmdir ./--version - if test "${ac_cv_path_mkdir+set}" = set; then - MKDIR_P="$ac_cv_path_mkdir -p" - else - # As a last resort, use the slow shell script. Don't cache a - # value for MKDIR_P within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - MKDIR_P="$ac_install_sh -d" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 -$as_echo "$MKDIR_P" >&6; } - -mkdir_p="$MKDIR_P" -case $mkdir_p in - [\\/$]* | ?:[\\/]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null - -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - am__isrc=' -I$(srcdir)' - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 - fi -fi - -# test whether we have cygpath -if test -z "$CYGPATH_W"; then - if (cygpath --version) >/dev/null 2>/dev/null; then - CYGPATH_W='cygpath -w' - else - CYGPATH_W=echo - fi -fi - - -# Define the identity of the package. - PACKAGE='jansson' - VERSION='2.1' - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE "$PACKAGE" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define VERSION "$VERSION" -_ACEOF - -# Some tools Automake needs. - -ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} - - -AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} - - -AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} - - -AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} - - -MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} - -install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} - -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -# Always define AMTAR for backward compatibility. - -AMTAR=${AMTAR-"${am_missing_run}tar"} - -am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' - - - - - - - -ac_config_headers="$ac_config_headers config.h" - - -# Checks for programs. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -DEPDIR="${am__leading_dot}deps" - -ac_config_commands="$ac_config_commands depfiles" - - -am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo done -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 -$as_echo_n "checking for style of include used by $am_make... " >&6; } -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# We grep out `Entering directory' and `Leaving directory' -# messages which can occur if `w' ends up in MAKEFLAGS. -# In particular we don't look at `^make:' because GNU make might -# be invoked under some other name (usually "gmake"), in which -# case it prints its new name instead of `make'. -if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then - am__include=include - am__quote= - _am_result=GNU -fi -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then - am__include=.include - am__quote="\"" - _am_result=BSD - fi -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 -$as_echo "$_am_result" >&6; } -rm -f confinc confmf - -# Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : - enableval=$enable_dependency_tracking; -fi - -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' -fi - if test "x$enable_dependency_tracking" != xno; then - AMDEP_TRUE= - AMDEP_FALSE='#' -else - AMDEP_TRUE='#' - AMDEP_FALSE= -fi - - - -depcc="$CC" am_compiler_list= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 -$as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then - # We make a subdir and do the tests there. Otherwise we can end up - # making bogus files that we don't know about and never remove. For - # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named `D' -- because `-MD' means `put the output - # in D'. - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_CC_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` - fi - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with - # Solaris 8's {/usr,}/bin/sh. - touch sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - case $depmode in - nosideeffect) - # after this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested - if test "x$enable_dependency_tracking" = xyes; then - continue - else - break - fi - ;; - none) break ;; - esac - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. - if depmode=$depmode \ - source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_CC_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_CC_dependencies_compiler_type=none -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 -$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } -CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type - - if - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then - am__fastdepCC_TRUE= - am__fastdepCC_FALSE='#' -else - am__fastdepCC_TRUE='#' - am__fastdepCC_FALSE= -fi - - -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac - - - -macro_version='2.2.10' -macro_revision='1.3175' - - - - - - - - - - - - - -ltmain="$ac_aux_dir/ltmain.sh" - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -$as_echo_n "checking how to print strings... " >&6; } -# Test print first, because it will be a builtin if present. -if test "X`print -r -- -n 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "" -} - -case "$ECHO" in - printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -$as_echo "printf" >&6; } ;; - print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -$as_echo "print -r" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -$as_echo "cat" >&6; } ;; -esac - - - - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_SED_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 - fi -else - ac_cv_path_SED=$SED -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed - -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_FGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_FGREP=$FGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -test -z "$GREP" && GREP=grep - - - - - - - - - - - - - - - - - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - if test -n "$ac_tool_prefix"; then - for ac_prog in dumpbin "link -dump" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DUMPBIN"; then - ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DUMPBIN=$ac_cv_prog_DUMPBIN -if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$DUMPBIN" && break - done -fi -if test -z "$DUMPBIN"; then - ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in dumpbin "link -dump" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DUMPBIN"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN -if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_DUMPBIN" && break -done - - if test "x$ac_ct_DUMPBIN" = x; then - DUMPBIN=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DUMPBIN=$ac_ct_DUMPBIN - fi -fi - - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: output\"" >&5) - cat conftest.out >&5 - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -r -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - -# find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : - $as_echo_n "(cached) " >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } -fi -max_cmd_len=$lt_cv_sys_max_cmd_len - - - - - - -: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 -$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 -$as_echo "$xsi_shell" >&6; } - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 -$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } -lt_shell_append=no -( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 -$as_echo "$lt_shell_append" >&6; } - - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi - - - - - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_reload_flag='-r' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - darwin*) - if test "$GCC" = yes; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix[4-9]*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. - if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="${ac_tool_prefix}ar" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_AR"; then - ac_ct_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AR="ar" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -else - AR="$ac_cv_prog_AR" -fi - -test -z "$AR" && AR=ar -test -z "$AR_FLAGS" && AR_FLAGS=cru - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -test -z "$STRIP" && STRIP=: - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -test -z "$RANLIB" && RANLIB=: - - - - - - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : - $as_echo_n "(cached) " >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[ABCDGISTW]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK '"\ -" {last_section=section; section=\$ 3};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -r -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -const struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_save_LIBS="$LIBS" - lt_save_CFLAGS="$CFLAGS" - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS="$lt_save_LIBS" - CFLAGS="$lt_save_CFLAGS" - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } -fi - - - - - - - - - - - - - - - - - - - - - - - -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : - enableval=$enable_libtool_lock; -fi - -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_cc_needs_belf=yes -else - lt_cv_cc_needs_belf=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" - - - case $host_os in - rhapsody* | darwin*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. -set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DSYMUTIL"; then - ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DSYMUTIL=$ac_cv_prog_DSYMUTIL -if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DSYMUTIL"; then - ac_ct_DSYMUTIL=$DSYMUTIL - # Extract the first word of "dsymutil", so it can be a program name with args. -set dummy dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DSYMUTIL"; then - ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL -if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DSYMUTIL" = x; then - DSYMUTIL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DSYMUTIL=$ac_ct_DSYMUTIL - fi -else - DSYMUTIL="$ac_cv_prog_DSYMUTIL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. -set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NMEDIT"; then - ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -NMEDIT=$ac_cv_prog_NMEDIT -if test -n "$NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -$as_echo "$NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_NMEDIT"; then - ac_ct_NMEDIT=$NMEDIT - # Extract the first word of "nmedit", so it can be a program name with args. -set dummy nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_NMEDIT"; then - ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_NMEDIT="nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT -if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -$as_echo "$ac_ct_NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_NMEDIT" = x; then - NMEDIT=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - NMEDIT=$ac_ct_NMEDIT - fi -else - NMEDIT="$ac_cv_prog_NMEDIT" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. -set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LIPO"; then - ac_cv_prog_LIPO="$LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -LIPO=$ac_cv_prog_LIPO -if test -n "$LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -$as_echo "$LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_LIPO"; then - ac_ct_LIPO=$LIPO - # Extract the first word of "lipo", so it can be a program name with args. -set dummy lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_LIPO"; then - ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_LIPO="lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO -if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -$as_echo "$ac_ct_LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_LIPO" = x; then - LIPO=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LIPO=$ac_ct_LIPO - fi -else - LIPO="$ac_cv_prog_LIPO" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL"; then - ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL=$ac_cv_prog_OTOOL -if test -n "$OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -$as_echo "$OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL"; then - ac_ct_OTOOL=$OTOOL - # Extract the first word of "otool", so it can be a program name with args. -set dummy otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL"; then - ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OTOOL="otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL -if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -$as_echo "$ac_ct_OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL" = x; then - OTOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL=$ac_ct_OTOOL - fi -else - OTOOL="$ac_cv_prog_OTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL64"; then - ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL64=$ac_cv_prog_OTOOL64 -if test -n "$OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -$as_echo "$OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL64"; then - ac_ct_OTOOL64=$OTOOL64 - # Extract the first word of "otool64", so it can be a program name with args. -set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL64"; then - ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OTOOL64="otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 -if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -$as_echo "$ac_ct_OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL64" = x; then - OTOOL64=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL64=$ac_ct_OTOOL64 - fi -else - OTOOL64="$ac_cv_prog_OTOOL64" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -$as_echo_n "checking for -single_module linker flag... " >&6; } -if ${lt_cv_apple_cc_single_mod+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&5 - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -$as_echo "$lt_cv_apple_cc_single_mod" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if ${lt_cv_ld_exported_symbols_list+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_ld_exported_symbols_list=yes -else - lt_cv_ld_exported_symbols_list=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -$as_echo_n "checking for -force_load linker flag... " >&6; } -if ${lt_cv_ld_force_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 - echo "$RANLIB libconftest.a" >&5 - $RANLIB libconftest.a 2>&5 - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&5 - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -$as_echo "$lt_cv_ld_force_load" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[012]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF - -fi - -done - - - - - -# Set options - - - - enable_dlopen=no - - - enable_win32_dll=no - - - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi - - - - - - - - - - # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi - - - - - - - - - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : - withval=$with_pic; pic_mode="$withval" -else - pic_mode=default -fi - - -test -z "$pic_mode" && pic_mode=default - - - - - - - - # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi - - - - - - - - - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - - - - - - - - - - - - - - - - - - - - - - - - - - -test -z "$LN_S" && LN_S="ln -s" - - - - - - - - - - - - - - -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir - - - - - -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` - - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -# Use C for the default configuration in the libtool script - -lt_save_CC="$CC" -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM -r conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - -if test -n "$compiler"; then - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; - *) - lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $RM -r conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - - - - - - - lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } - - if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - lt_prog_compiler_wl='-Xlinker ' - lt_prog_compiler_pic='-Xcompiler -fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='--shared' - lt_prog_compiler_static='--static' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-qpic' - lt_prog_compiler_static='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ F* | *Sun*Fortran*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' - ;; - esac - ;; - esac - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 -$as_echo "$lt_prog_compiler_pic" >&6; } - - - - - - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_cv_prog_compiler_pic_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works=yes - fi - fi - $RM -r conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } - -if test x"$lt_cv_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi - - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works=yes - fi - else - lt_cv_prog_compiler_static_works=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -$as_echo "$lt_cv_prog_compiler_static_works" >&6; } - -if test x"$lt_cv_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM -r conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM -r conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM -r conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM -r conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM -r conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - runpath_var= - allow_undefined_flag= - always_export_symbols=no - archive_cmds= - archive_expsym_cmds= - compiler_needs_object=no - enable_shared_with_static_runtimes=no - export_dynamic_flag_spec= - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - hardcode_automatic=no - hardcode_direct=no - hardcode_direct_absolute=no - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= - hardcode_libdir_separator= - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - inherit_rpath=no - link_all_deplibs=unknown - module_cmds= - module_expsym_cmds= - old_archive_from_new_cmds= - old_archive_from_expsyms_cmds= - thread_safe_flag_spec= - whole_archive_flag_spec= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; - *\ \(GNU\ Binutils\)\ [3-9]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[3-9]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - export_dynamic_flag_spec='${wl}--export-all-symbols' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - - haiku*) - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - link_all_deplibs=yes - ;; - - interix[3-9]*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag= - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - whole_archive_flag_spec= - tmp_sharedflag='--shared' ;; - xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld='-rpath $libdir' - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_direct_absolute=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - file_list_spec='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - export_dynamic_flag_spec='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\(.*\)$/\1/ - p - } - }' -aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -# Check for a 64-bit object if we didn't find anything. -if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - fi - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - fix_srcfile_path='`cygpath -w "$srcfile"`' - enable_shared_with_static_runtimes=yes - ;; - - darwin* | rhapsody*) - - - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - else - whole_archive_flag_spec='' - fi - link_all_deplibs=yes - allow_undefined_flag="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - - else - ld_shlibs=no - fi - - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -$as_echo_n "checking if $CC understands -b... " >&6; } -if ${lt_cv_prog_compiler__b+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler__b=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -b" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler__b=yes - fi - else - lt_cv_prog_compiler__b=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -$as_echo "$lt_cv_prog_compiler__b" >&6; } - -if test x"$lt_cv_prog_compiler__b" = xyes; then - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' -fi - - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo(void) {} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - inherit_rpath=yes - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - hardcode_shlibpath_var=no - hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - archive_cmds_need_lc='no' - hardcode_libdir_separator=: - ;; - - solaris*) - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='${wl}-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='${wl}-z,text' - allow_undefined_flag='${wl}-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-R,$libdir' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='${wl}-Blargedynsym' - ;; - esac - fi - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } -test "$ld_shlibs" = no && can_build_shared=no - -with_gnu_ld=$with_gnu_ld - - - - - - - - - - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc+:} false; then : - $as_echo_n "(cached) " >&6 -else - $RM -r conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM -r conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } - archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } - -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[lt_foo]++; } - if (lt_freq[lt_foo] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([A-Za-z]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[4-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$host_os in - yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*) - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - ;; - - *) - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - ;; - esac - dynamic_linker='Win32 ld.exe' - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext ${libname}${release}${versuffix}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -haiku*) - version_type=linux - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[3-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - lt_cv_shlibpath_overrides_runpath=yes -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - -fi - - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || - test -n "$runpath_var" || - test "X$hardcode_automatic" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } - -if test "$hardcode_action" = relink || - test "$inherit_rpath" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_shl_load=yes -else - ac_cv_lib_dld_shl_load=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -else - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_svld_dlopen=yes -else - ac_cv_lib_svld_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); -int -main () -{ -return dld_link (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_dld_link=yes -else - ac_cv_lib_dld_dld_link=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -void fnord () __attribute__((visibility("default"))); -#endif - -void fnord () { int i=42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -void fnord () __attribute__((visibility("default"))); -#endif - -void fnord () { int i=42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - - - - - - - - - - - - - - - - -striplib= -old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac -fi - - - - - - - - - - - - - # Report which library types will actually be built - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[4-9]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } - - - - -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - - - - - - - - - - - - - ac_config_commands="$ac_config_commands libtool" - - - - -# Only expand once: - - - if test x$GCC = xyes; then - GCC_TRUE= - GCC_FALSE='#' -else - GCC_TRUE='#' - GCC_FALSE= -fi - - -# Checks for libraries. - -# Checks for header files. - -# Checks for typedefs, structures, and compiler characteristics. -ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" -case $ac_cv_c_int32_t in #( - no|yes) ;; #( - *) - -cat >>confdefs.h <<_ACEOF -#define int32_t $ac_cv_c_int32_t -_ACEOF -;; -esac - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5 -$as_echo_n "checking for long long int... " >&6; } -if ${ac_cv_type_long_long_int+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - /* For now, do not test the preprocessor; as of 2007 there are too many - implementations with broken preprocessors. Perhaps this can - be revisited in 2012. In the meantime, code should not expect - #if to work with literals wider than 32 bits. */ - /* Test literals. */ - long long int ll = 9223372036854775807ll; - long long int nll = -9223372036854775807LL; - unsigned long long int ull = 18446744073709551615ULL; - /* Test constant expressions. */ - typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) - ? 1 : -1)]; - typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; - int i = 63; -int -main () -{ -/* Test availability of runtime routines for shift and division. */ - long long int llmax = 9223372036854775807ll; - unsigned long long int ullmax = 18446744073709551615ull; - return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll) - | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) - | (ullmax / ull) | (ullmax % ull)); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if test "$cross_compiling" = yes; then : - ac_cv_type_long_long_int=yes -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #ifndef LLONG_MAX - # define HALF \ - (1LL << (sizeof (long long int) * CHAR_BIT - 2)) - # define LLONG_MAX (HALF - 1 + HALF) - #endif -int -main () -{ -long long int n = 1; - int i; - for (i = 0; ; i++) - { - long long int m = n << i; - if (m >> i != n) - return 1; - if (LLONG_MAX / 2 < m) - break; - } - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_type_long_long_int=yes -else - ac_cv_type_long_long_int=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -else - ac_cv_type_long_long_int=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5 -$as_echo "$ac_cv_type_long_long_int" >&6; } - if test $ac_cv_type_long_long_int = yes; then - -$as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h - - fi - -case $ac_cv_type_long_long_int in - yes) json_have_long_long=1;; - *) json_have_long_long=0;; -esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_inline=$ac_kw -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } - -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac - -case $ac_cv_c_inline in - yes) json_inline=inline;; - no) json_inline=;; - *) json_inline=$ac_cv_c_inline;; -esac - - -# Checks for library functions. - -ac_config_files="$ac_config_files jansson.pc Makefile doc/Makefile src/Makefile src/jansson_config.h test/Makefile test/bin/Makefile test/suites/Makefile test/suites/api/Makefile" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - -if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${GCC_TRUE}" && test -z "${GCC_FALSE}"; then - as_fn_error $? "conditional \"GCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by jansson $as_me 2.1, which was -generated by GNU Autoconf 2.68. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -jansson config.status 2.1 -configured by $0, generated by GNU Autoconf 2.68, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2010 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -MKDIR_P='$MKDIR_P' -AWK='$AWK' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# -AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" - - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' -macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' -enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' -enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' -pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' -SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' -ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' -host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' -host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' -host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' -build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' -build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' -build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' -SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' -Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' -GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' -EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' -FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' -LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' -NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' -LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' -ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' -exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' -lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' -reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' -AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' -STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' -RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' -lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' -CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' -compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' -GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' -objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' -need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' -LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' -libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' -module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' -fix_srcfile_path='`$ECHO "$fix_srcfile_path" | $SED "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' -version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' -runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' -libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' -soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' -install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' -finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' -old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' -striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' - -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in SHELL \ -ECHO \ -SED \ -GREP \ -EGREP \ -FGREP \ -LD \ -NM \ -LN_S \ -lt_SP2NL \ -lt_NL2SP \ -reload_flag \ -OBJDUMP \ -deplibs_check_method \ -file_magic_cmd \ -AR \ -AR_FLAGS \ -STRIP \ -RANLIB \ -CC \ -CFLAGS \ -compiler \ -lt_cv_sys_global_symbol_pipe \ -lt_cv_sys_global_symbol_to_cdecl \ -lt_cv_sys_global_symbol_to_c_name_address \ -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -lt_prog_compiler_no_builtin_flag \ -lt_prog_compiler_wl \ -lt_prog_compiler_pic \ -lt_prog_compiler_static \ -lt_cv_prog_compiler_c_o \ -need_locks \ -DSYMUTIL \ -NMEDIT \ -LIPO \ -OTOOL \ -OTOOL64 \ -shrext_cmds \ -export_dynamic_flag_spec \ -whole_archive_flag_spec \ -compiler_needs_object \ -with_gnu_ld \ -allow_undefined_flag \ -no_undefined_flag \ -hardcode_libdir_flag_spec \ -hardcode_libdir_flag_spec_ld \ -hardcode_libdir_separator \ -fix_srcfile_path \ -exclude_expsyms \ -include_expsyms \ -file_list_spec \ -variables_saved_for_relink \ -libname_spec \ -library_names_spec \ -soname_spec \ -install_override_mode \ -finish_eval \ -old_striplib \ -striplib; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in reload_cmds \ -old_postinstall_cmds \ -old_postuninstall_cmds \ -old_archive_cmds \ -extract_expsyms_cmds \ -old_archive_from_new_cmds \ -old_archive_from_expsyms_cmds \ -archive_cmds \ -archive_expsym_cmds \ -module_cmds \ -module_expsym_cmds \ -export_symbols_cmds \ -prelink_cmds \ -postinstall_cmds \ -postuninstall_cmds \ -finish_cmds \ -sys_lib_search_path_spec \ -sys_lib_dlsearch_path_spec; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -ac_aux_dir='$ac_aux_dir' -xsi_shell='$xsi_shell' -lt_shell_append='$lt_shell_append' - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - - - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile' - - - - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; - "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; - "jansson.pc") CONFIG_FILES="$CONFIG_FILES jansson.pc" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; - "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; - "src/jansson_config.h") CONFIG_FILES="$CONFIG_FILES src/jansson_config.h" ;; - "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; - "test/bin/Makefile") CONFIG_FILES="$CONFIG_FILES test/bin/Makefile" ;; - "test/suites/Makefile") CONFIG_FILES="$CONFIG_FILES test/suites/Makefile" ;; - "test/suites/api/Makefile") CONFIG_FILES="$CONFIG_FILES test/suites/api/Makefile" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac - ac_MKDIR_P=$MKDIR_P - case $MKDIR_P in - [\\/$]* | ?:[\\/]* ) ;; - */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -s&@MKDIR_P@&$ac_MKDIR_P&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi -# Compute "$ac_file"'s index in $config_headers. -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - "$ac_file" | "$ac_file":* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for "$ac_file"" >`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'`/stamp-h$_am_stamp_count - ;; - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || -$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$mf" : 'X\(//\)[^/]' \| \ - X"$mf" : 'X\(//\)$' \| \ - X"$mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$mf" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || -$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$file" : 'X\(//\)[^/]' \| \ - X"$file" : 'X\(//\)$' \| \ - X"$file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done -done - ;; - "libtool":C) - - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM -f \"$cfgfile\"; exit 1" 1 2 15 - $RM -f "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -# Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - -# The names of the tagged configurations supported by this script. -available_tags="" - -# ### BEGIN LIBTOOL CONFIG - -# Which release of libtool.m4 was used? -macro_version=$macro_version -macro_revision=$macro_revision - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# What type of objects to build. -pic_mode=$pic_mode - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that protects backslashes. -ECHO=$lt_ECHO - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="\$SED -e 1s/^X//" - -# A grep program that handles long lines. -GREP=$lt_GREP - -# An ERE matcher. -EGREP=$lt_EGREP - -# A literal string matcher. -FGREP=$lt_FGREP - -# A BSD- or MS-compatible name lister. -NM=$lt_NM - -# Whether we need soft or hard links. -LN_S=$lt_LN_S - -# What is the maximum length of a command? -max_cmd_len=$max_cmd_len - -# Object file suffix (normally "o"). -objext=$ac_objext - -# Executable file suffix (normally ""). -exeext=$exeext - -# whether the shell understands "unset". -lt_unset=$lt_unset - -# turn spaces into newlines. -SP2NL=$lt_lt_SP2NL - -# turn newlines into spaces. -NL2SP=$lt_lt_NL2SP - -# An object symbol dumper. -OBJDUMP=$lt_OBJDUMP - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method == "file_magic". -file_magic_cmd=$lt_file_magic_cmd - -# The archiver. -AR=$lt_AR -AR_FLAGS=$lt_AR_FLAGS - -# A symbol stripping program. -STRIP=$lt_STRIP - -# Commands used to install an old-style archive. -RANLIB=$lt_RANLIB -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Whether to use a lock for old archive extraction. -lock_old_archive_extraction=$lock_old_archive_extraction - -# A C compiler. -LTCC=$lt_CC - -# LTCC compiler flags. -LTCFLAGS=$lt_CFLAGS - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration. -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair. -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# Transform the output of nm in a C name address pair when lib prefix is needed. -global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# Used to examine libraries when file_magic_cmd begins with "file". -MAGIC_CMD=$MAGIC_CMD - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Tool to manipulate archived DWARF debug symbol files on Mac OS X. -DSYMUTIL=$lt_DSYMUTIL - -# Tool to change global to local symbols on Mac OS X. -NMEDIT=$lt_NMEDIT - -# Tool to manipulate fat objects and archives on Mac OS X. -LIPO=$lt_LIPO - -# ldd/readelf like tool for Mach-O binaries on Mac OS X. -OTOOL=$lt_OTOOL - -# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. -OTOOL64=$lt_OTOOL64 - -# Old archive suffix (normally "a"). -libext=$libext - -# Shared library suffix (normally ".so"). -shrext_cmds=$lt_shrext_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at link time. -variables_saved_for_relink=$lt_variables_saved_for_relink - -# Do we need the "lib" prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Library versioning type. -version_type=$version_type - -# Shared library runtime path variable. -runpath_var=$runpath_var - -# Shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Permission mode override for installation of shared libraries. -install_override_mode=$lt_install_override_mode - -# Command to use after installation of a shared archive. -postinstall_cmds=$lt_postinstall_cmds - -# Command to use after uninstallation of a shared archive. -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# As "finish_cmds", except a single script fragment to be evaled but -# not shown. -finish_eval=$lt_finish_eval - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Compile-time system search path for libraries. -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries. -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - - -# The linker used to build libraries. -LD=$lt_LD - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds - -# A language specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU compiler? -with_gcc=$GCC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# If ld is used when linking, flag to hardcode \$libdir into a binary -# during linking. This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Fix the shell variable \$srcfile for the compiler. -fix_srcfile_path=$lt_fix_srcfile_path - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - -ltmain="$ac_aux_dir/ltmain.sh" - - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - case $xsi_shell in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=${1%%=*} - func_opt_split_arg=${1#*=} -} - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $* )) -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} - -_LT_EOF - ;; - *) # Bourne compatible functions. - cat << \_LT_EOF >> "$cfgfile" - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} - -# sed scripts: -my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q' -my_sed_long_arg='1s/^-[^=]*=//' - -# func_opt_split -func_opt_split () -{ - func_opt_split_opt=`$ECHO "${1}" | $SED "$my_sed_long_opt"` - func_opt_split_arg=`$ECHO "${1}" | $SED "$my_sed_long_arg"` -} - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` -} - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` -} - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "$@"` -} - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` -} - -_LT_EOF -esac - -case $lt_shell_append in - yes) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1+=\$2" -} -_LT_EOF - ;; - *) - cat << \_LT_EOF >> "$cfgfile" - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "$1=\$$1\$2" -} - -_LT_EOF - ;; - esac - - - sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - diff --git a/lang/c/jansson/configure.ac b/lang/c/jansson/configure.ac deleted file mode 100644 index da04bf86432..00000000000 --- a/lang/c/jansson/configure.ac +++ /dev/null @@ -1,49 +0,0 @@ -AC_PREREQ([2.60]) -AC_INIT([jansson], [2.1], [petri@digip.org]) - -AM_INIT_AUTOMAKE([1.10 foreign]) - -AC_CONFIG_SRCDIR([src/value.c]) -AC_CONFIG_HEADERS([config.h]) - -# Checks for programs. -AC_PROG_CC -AC_PROG_LIBTOOL -AM_CONDITIONAL([GCC], [test x$GCC = xyes]) - -# Checks for libraries. - -# Checks for header files. - -# Checks for typedefs, structures, and compiler characteristics. -AC_TYPE_INT32_T - -AC_TYPE_LONG_LONG_INT -case $ac_cv_type_long_long_int in - yes) json_have_long_long=1;; - *) json_have_long_long=0;; -esac -AC_SUBST([json_have_long_long]) - -AC_C_INLINE -case $ac_cv_c_inline in - yes) json_inline=inline;; - no) json_inline=;; - *) json_inline=$ac_cv_c_inline;; -esac -AC_SUBST([json_inline]) - -# Checks for library functions. - -AC_CONFIG_FILES([ - jansson.pc - Makefile - doc/Makefile - src/Makefile - src/jansson_config.h - test/Makefile - test/bin/Makefile - test/suites/Makefile - test/suites/api/Makefile -]) -AC_OUTPUT diff --git a/lang/c/jansson/depcomp b/lang/c/jansson/depcomp deleted file mode 100755 index ca5ea4e1ef9..00000000000 --- a/lang/c/jansson/depcomp +++ /dev/null @@ -1,584 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2006-10-15.18 - -# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software -# Foundation, Inc. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by `PROGRAMS ARGS'. - object Object file output by `PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputing dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. -## Unfortunately, FreeBSD c89 acceptance of flags depends upon -## the command line argument order; so add the flags where they -## appear in depend2.am. Note that the slowdown incurred here -## affects only configure: in makefiles, %FASTDEP% shortcuts this. - for arg - do - case $arg in - -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; - *) set fnord "$@" "$arg" ;; - esac - shift # fnord - shift # $arg - done - "$@" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - stat=$? - - if test -f "$tmpdepfile"; then : - else - stripped=`echo "$stripped" | sed 's,^.*/,,'` - tmpdepfile="$stripped.u" - fi - - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - outname="$stripped.o" - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp2) - # The "hp" stanza above does not work with aCC (C++) and HP's ia64 - # compilers, which have integrated preprocessors. The correct option - # to use with these is +Maked; it writes dependencies to a file named - # 'foo.d', which lands next to the object file, wherever that - # happens to be. - # Much of this is similar to the tru64 case; see comments there. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - if test "$libtool" = yes; then - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir.libs/$base.d - "$@" -Wc,+Maked - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - "$@" +Maked - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" - # Add `dependent.h:' lines. - sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" "$tmpdepfile2" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mechanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no - for arg in "$@"; do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - "$@" || exit $? - IFS=" " - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/lang/c/jansson/doc/Makefile.am b/lang/c/jansson/doc/Makefile.am deleted file mode 100644 index 6c79b546388..00000000000 --- a/lang/c/jansson/doc/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -EXTRA_DIST = conf.py apiref.rst changes.rst conformance.rst \ - gettingstarted.rst github_commits.c index.rst tutorial.rst \ - upgrading.rst ext/refcounting.py - -SPHINXBUILD = sphinx-build -SPHINXOPTS = -d _build/doctrees $(SPHINXOPTS_EXTRA) - -html-local: - $(SPHINXBUILD) -b html $(SPHINXOPTS) $(srcdir) _build/html - -install-html-local: html - mkdir -p $(DESTDIR)$(htmldir) - cp -r _build/html $(DESTDIR)$(htmldir) - -uninstall-local: - rm -rf $(DESTDIR)$(htmldir) - -clean-local: - rm -rf _build - rm -f ext/refcounting.pyc diff --git a/lang/c/jansson/doc/Makefile.in b/lang/c/jansson/doc/Makefile.in deleted file mode 100644 index 2fa9a3a0709..00000000000 --- a/lang/c/jansson/doc/Makefile.in +++ /dev/null @@ -1,352 +0,0 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = doc -DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -json_have_long_long = @json_have_long_long@ -json_inline = @json_inline@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -EXTRA_DIST = conf.py apiref.rst changes.rst conformance.rst \ - gettingstarted.rst github_commits.c index.rst tutorial.rst \ - upgrading.rst ext/refcounting.py - -SPHINXBUILD = sphinx-build -SPHINXOPTS = -d _build/doctrees $(SPHINXOPTS_EXTRA) -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign doc/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags: TAGS -TAGS: - -ctags: CTAGS -CTAGS: - - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-local mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: html-local - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-exec-am: - -install-html: install-html-am - -install-html-am: install-html-local - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-local - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - clean-local distclean distclean-generic distclean-libtool \ - distdir dvi dvi-am html html-am html-local info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-html-local install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ - uninstall-local - - -html-local: - $(SPHINXBUILD) -b html $(SPHINXOPTS) $(srcdir) _build/html - -install-html-local: html - mkdir -p $(DESTDIR)$(htmldir) - cp -r _build/html $(DESTDIR)$(htmldir) - -uninstall-local: - rm -rf $(DESTDIR)$(htmldir) - -clean-local: - rm -rf _build - rm -f ext/refcounting.pyc -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lang/c/jansson/doc/README b/lang/c/jansson/doc/README deleted file mode 100644 index 930b3bf0c3f..00000000000 --- a/lang/c/jansson/doc/README +++ /dev/null @@ -1,5 +0,0 @@ -To build the documentation, invoke - - make html - -Then point your browser to _build/html/index.html. diff --git a/lang/c/jansson/doc/apiref.rst b/lang/c/jansson/doc/apiref.rst deleted file mode 100644 index 48ff979ff3f..00000000000 --- a/lang/c/jansson/doc/apiref.rst +++ /dev/null @@ -1,1221 +0,0 @@ -.. _apiref: - -************* -API Reference -************* - -.. highlight:: c - -Preliminaries -============= - -All declarations are in :file:`jansson.h`, so it's enough to - -:: - - #include - -in each source file. - -All constants are prefixed with ``JSON_`` (except for those describing -the library version, prefixed with ``JANSSON_``). Other identifiers -are prefixed with ``json_``. Type names are suffixed with ``_t`` and -``typedef``\ 'd so that the ``struct`` keyword need not be used. - - -Library Version -=============== - -The Jansson version is of the form *A.B.C*, where *A* is the major -version, *B* is the minor version and *C* is the micro version. If the -micro version is zero, it's omitted from the version string, i.e. the -version string is just *A.B*. - -When a new release only fixes bugs and doesn't add new features or -functionality, the micro version is incremented. When new features are -added in a backwards compatible way, the minor version is incremented -and the micro version is set to zero. When there are backwards -incompatible changes, the major version is incremented and others are -set to zero. - -The following preprocessor constants specify the current version of -the library: - -``JANSSON_VERSION_MAJOR``, ``JANSSON_VERSION_MINOR``, ``JANSSON_VERSION_MICRO`` - Integers specifying the major, minor and micro versions, - respectively. - -``JANSSON_VERSION`` - A string representation of the current version, e.g. ``"1.2.1"`` or - ``"1.3"``. - -``JANSSON_VERSION_HEX`` - A 3-byte hexadecimal representation of the version, e.g. - ``0x010201`` for version 1.2.1 and ``0x010300`` for version 1.3. - This is useful in numeric comparisions, e.g.:: - - #if JANSSON_VERSION_HEX >= 0x010300 - /* Code specific to version 1.3 and above */ - #endif - - -Value Representation -==================== - -The JSON specification (:rfc:`4627`) defines the following data types: -*object*, *array*, *string*, *number*, *boolean*, and *null*. JSON -types are used dynamically; arrays and objects can hold any other data -type, including themselves. For this reason, Jansson's type system is -also dynamic in nature. There's one C type to represent all JSON -values, and this structure knows the type of the JSON value it holds. - -.. type:: json_t - - This data structure is used throughout the library to represent all - JSON values. It always contains the type of the JSON value it holds - and the value's reference count. The rest depends on the type of the - value. - -Objects of :type:`json_t` are always used through a pointer. There -are APIs for querying the type, manipulating the reference count, and -for constructing and manipulating values of different types. - -Unless noted otherwise, all API functions return an error value if an -error occurs. Depending on the function's signature, the error value -is either *NULL* or -1. Invalid arguments or invalid input are -apparent sources for errors. Memory allocation and I/O operations may -also cause errors. - - -Type ----- - -The type of a JSON value is queried and tested using the following -functions: - -.. type:: enum json_type - - The type of a JSON value. The following members are defined: - - +--------------------+ - | ``JSON_OBJECT`` | - +--------------------+ - | ``JSON_ARRAY`` | - +--------------------+ - | ``JSON_STRING`` | - +--------------------+ - | ``JSON_INTEGER`` | - +--------------------+ - | ``JSON_REAL`` | - +--------------------+ - | ``JSON_TRUE`` | - +--------------------+ - | ``JSON_FALSE`` | - +--------------------+ - | ``JSON_NULL`` | - +--------------------+ - - These correspond to JSON object, array, string, number, boolean and - null. A number is represented by either a value of the type - ``JSON_INTEGER`` or of the type ``JSON_REAL``. A true boolean value - is represented by a value of the type ``JSON_TRUE`` and false by a - value of the type ``JSON_FALSE``. - -.. function:: int json_typeof(const json_t *json) - - Return the type of the JSON value (a :type:`json_type` cast to - :type:`int`). *json* MUST NOT be *NULL*. This function is actually - implemented as a macro for speed. - -.. function:: json_is_object(const json_t *json) - json_is_array(const json_t *json) - json_is_string(const json_t *json) - json_is_integer(const json_t *json) - json_is_real(const json_t *json) - json_is_true(const json_t *json) - json_is_false(const json_t *json) - json_is_null(const json_t *json) - - These functions (actually macros) return true (non-zero) for values - of the given type, and false (zero) for values of other types and - for *NULL*. - -.. function:: json_is_number(const json_t *json) - - Returns true for values of types ``JSON_INTEGER`` and - ``JSON_REAL``, and false for other types and for *NULL*. - -.. function:: json_is_boolean(const json_t *json) - - Returns true for types ``JSON_TRUE`` and ``JSON_FALSE``, and false - for values of other types and for *NULL*. - - -.. _apiref-reference-count: - -Reference Count ---------------- - -The reference count is used to track whether a value is still in use -or not. When a value is created, it's reference count is set to 1. If -a reference to a value is kept (e.g. a value is stored somewhere for -later use), its reference count is incremented, and when the value is -no longer needed, the reference count is decremented. When the -reference count drops to zero, there are no references left, and the -value can be destroyed. - -The following functions are used to manipulate the reference count. - -.. function:: json_t *json_incref(json_t *json) - - Increment the reference count of *json* if it's not non-*NULL*. - Returns *json*. - -.. function:: void json_decref(json_t *json) - - Decrement the reference count of *json*. As soon as a call to - :func:`json_decref()` drops the reference count to zero, the value - is destroyed and it can no longer be used. - -Functions creating new JSON values set the reference count to 1. These -functions are said to return a **new reference**. Other functions -returning (existing) JSON values do not normally increase the -reference count. These functions are said to return a **borrowed -reference**. So, if the user will hold a reference to a value returned -as a borrowed reference, he must call :func:`json_incref`. As soon as -the value is no longer needed, :func:`json_decref` should be called -to release the reference. - -Normally, all functions accepting a JSON value as an argument will -manage the reference, i.e. increase and decrease the reference count -as needed. However, some functions **steal** the reference, i.e. they -have the same result as if the user called :func:`json_decref()` on -the argument right after calling the function. These functions are -suffixed with ``_new`` or have ``_new_`` somewhere in their name. - -For example, the following code creates a new JSON array and appends -an integer to it:: - - json_t *array, *integer; - - array = json_array(); - integer = json_integer(42); - - json_array_append(array, integer); - json_decref(integer); - -Note how the caller has to release the reference to the integer value -by calling :func:`json_decref()`. By using a reference stealing -function :func:`json_array_append_new()` instead of -:func:`json_array_append()`, the code becomes much simpler:: - - json_t *array = json_array(); - json_array_append_new(array, json_integer(42)); - -In this case, the user doesn't have to explicitly release the -reference to the integer value, as :func:`json_array_append_new()` -steals the reference when appending the value to the array. - -In the following sections it is clearly documented whether a function -will return a new or borrowed reference or steal a reference to its -argument. - - -Circular References -------------------- - -A circular reference is created when an object or an array is, -directly or indirectly, inserted inside itself. The direct case is -simple:: - - json_t *obj = json_object(); - json_object_set(obj, "foo", obj); - -Jansson will refuse to do this, and :func:`json_object_set()` (and -all the other such functions for objects and arrays) will return with -an error status. The indirect case is the dangerous one:: - - json_t *arr1 = json_array(), *arr2 = json_array(); - json_array_append(arr1, arr2); - json_array_append(arr2, arr1); - -In this example, the array ``arr2`` is contained in the array -``arr1``, and vice versa. Jansson cannot check for this kind of -indirect circular references without a performance hit, so it's up to -the user to avoid them. - -If a circular reference is created, the memory consumed by the values -cannot be freed by :func:`json_decref()`. The reference counts never -drops to zero because the values are keeping the references to each -other. Moreover, trying to encode the values with any of the encoding -functions will fail. The encoder detects circular references and -returns an error status. - - -True, False and Null -==================== - -These values are implemented as singletons, so each of these functions -returns the same value each time. - -.. function:: json_t *json_true(void) - - .. refcounting:: new - - Returns the JSON true value. - -.. function:: json_t *json_false(void) - - .. refcounting:: new - - Returns the JSON false value. - -.. function:: json_t *json_null(void) - - .. refcounting:: new - - Returns the JSON null value. - - -String -====== - -Jansson uses UTF-8 as the character encoding. All JSON strings must be -valid UTF-8 (or ASCII, as it's a subset of UTF-8). Normal null -terminated C strings are used, so JSON strings may not contain -embedded null characters. All other Unicode codepoints U+0001 through -U+10FFFF are allowed. - -.. function:: json_t *json_string(const char *value) - - .. refcounting:: new - - Returns a new JSON string, or *NULL* on error. *value* must be a - valid UTF-8 encoded Unicode string. - -.. function:: json_t *json_string_nocheck(const char *value) - - .. refcounting:: new - - Like :func:`json_string`, but doesn't check that *value* is valid - UTF-8. Use this function only if you are certain that this really - is the case (e.g. you have already checked it by other means). - -.. function:: const char *json_string_value(const json_t *string) - - Returns the associated value of *string* as a null terminated UTF-8 - encoded string, or *NULL* if *string* is not a JSON string. - - The retuned value is read-only and must not be modified or freed by - the user. It is valid as long as *string* exists, i.e. as long as - its reference count has not dropped to zero. - -.. function:: int json_string_set(const json_t *string, const char *value) - - Sets the associated value of *string* to *value*. *value* must be a - valid UTF-8 encoded Unicode string. Returns 0 on success and -1 on - error. - -.. function:: int json_string_set_nocheck(const json_t *string, const char *value) - - Like :func:`json_string_set`, but doesn't check that *value* is - valid UTF-8. Use this function only if you are certain that this - really is the case (e.g. you have already checked it by other - means). - - -Number -====== - -The JSON specification only contains one numeric type, "number". The C -programming language has distinct types for integer and floating-point -numbers, so for practical reasons Jansson also has distinct types for -the two. They are called "integer" and "real", respectively. For more -information, see :ref:`rfc-conformance`. - -.. type:: json_int_t - - This is the C type that is used to store JSON integer values. It - represents the widest integer type available on your system. In - practice it's just a typedef of ``long long`` if your compiler - supports it, otherwise ``long``. - - Usually, you can safely use plain ``int`` in place of - ``json_int_t``, and the implicit C integer conversion handles the - rest. Only when you know that you need the full 64-bit range, you - should use ``json_int_t`` explicitly. - -``JSON_INTEGER_IS_LONG_LONG`` - - This is a preprocessor variable that holds the value 1 if - :type:`json_int_t` is ``long long``, and 0 if it's ``long``. It - can be used as follows:: - - #if JSON_INTEGER_IS_LONG_LONG - /* Code specific for long long */ - #else - /* Code specific for long */ - #endif - -``JSON_INTEGER_FORMAT`` - - This is a macro that expands to a :func:`printf()` conversion - specifier that corresponds to :type:`json_int_t`, without the - leading ``%`` sign, i.e. either ``"lld"`` or ``"ld"``. This macro - is required because the actual type of :type:`json_int_t` can be - either ``long`` or ``long long``, and :func:`printf()` reuiqres - different length modifiers for the two. - - Example:: - - json_int_t x = 123123123; - printf("x is %" JSON_INTEGER_FORMAT "\n", x); - - -.. function:: json_t *json_integer(json_int_t value) - - .. refcounting:: new - - Returns a new JSON integer, or *NULL* on error. - -.. function:: json_int_t json_integer_value(const json_t *integer) - - Returns the associated value of *integer*, or 0 if *json* is not a - JSON integer. - -.. function:: int json_integer_set(const json_t *integer, json_int_t value) - - Sets the associated value of *integer* to *value*. Returns 0 on - success and -1 if *integer* is not a JSON integer. - -.. function:: json_t *json_real(double value) - - .. refcounting:: new - - Returns a new JSON real, or *NULL* on error. - -.. function:: double json_real_value(const json_t *real) - - Returns the associated value of *real*, or 0.0 if *real* is not a - JSON real. - -.. function:: int json_real_set(const json_t *real, double value) - - Sets the associated value of *real* to *value*. Returns 0 on - success and -1 if *real* is not a JSON real. - -In addition to the functions above, there's a common query function -for integers and reals: - -.. function:: double json_number_value(const json_t *json) - - Returns the associated value of the JSON integer or JSON real - *json*, cast to double regardless of the actual type. If *json* is - neither JSON real nor JSON integer, 0.0 is returned. - - -Array -===== - -A JSON array is an ordered collection of other JSON values. - -.. function:: json_t *json_array(void) - - .. refcounting:: new - - Returns a new JSON array, or *NULL* on error. Initially, the array - is empty. - -.. function:: size_t json_array_size(const json_t *array) - - Returns the number of elements in *array*, or 0 if *array* is NULL - or not a JSON array. - -.. function:: json_t *json_array_get(const json_t *array, size_t index) - - .. refcounting:: borrow - - Returns the element in *array* at position *index*. The valid range - for *index* is from 0 to the return value of - :func:`json_array_size()` minus 1. If *array* is not a JSON array, - if *array* is *NULL*, or if *index* is out of range, *NULL* is - returned. - -.. function:: int json_array_set(json_t *array, size_t index, json_t *value) - - Replaces the element in *array* at position *index* with *value*. - The valid range for *index* is from 0 to the return value of - :func:`json_array_size()` minus 1. Returns 0 on success and -1 on - error. - -.. function:: int json_array_set_new(json_t *array, size_t index, json_t *value) - - Like :func:`json_array_set()` but steals the reference to *value*. - This is useful when *value* is newly created and not used after - the call. - -.. function:: int json_array_append(json_t *array, json_t *value) - - Appends *value* to the end of *array*, growing the size of *array* - by 1. Returns 0 on success and -1 on error. - -.. function:: int json_array_append_new(json_t *array, json_t *value) - - Like :func:`json_array_append()` but steals the reference to - *value*. This is useful when *value* is newly created and not used - after the call. - -.. function:: int json_array_insert(json_t *array, size_t index, json_t *value) - - Inserts *value* to *array* at position *index*, shifting the - elements at *index* and after it one position towards the end of - the array. Returns 0 on success and -1 on error. - -.. function:: int json_array_insert_new(json_t *array, size_t index, json_t *value) - - Like :func:`json_array_insert()` but steals the reference to - *value*. This is useful when *value* is newly created and not used - after the call. - -.. function:: int json_array_remove(json_t *array, size_t index) - - Removes the element in *array* at position *index*, shifting the - elements after *index* one position towards the start of the array. - Returns 0 on success and -1 on error. - -.. function:: int json_array_clear(json_t *array) - - Removes all elements from *array*. Returns 0 on sucess and -1 on - error. - -.. function:: int json_array_extend(json_t *array, json_t *other_array) - - Appends all elements in *other_array* to the end of *array*. - Returns 0 on success and -1 on error. - - -Object -====== - -A JSON object is a dictionary of key-value pairs, where the key is a -Unicode string and the value is any JSON value. - -.. function:: json_t *json_object(void) - - .. refcounting:: new - - Returns a new JSON object, or *NULL* on error. Initially, the - object is empty. - -.. function:: size_t json_object_size(const json_t *object) - - Returns the number of elements in *object*, or 0 if *object* is not - a JSON object. - -.. function:: json_t *json_object_get(const json_t *object, const char *key) - - .. refcounting:: borrow - - Get a value corresponding to *key* from *object*. Returns *NULL* if - *key* is not found and on error. - -.. function:: int json_object_set(json_t *object, const char *key, json_t *value) - - Set the value of *key* to *value* in *object*. *key* must be a - valid null terminated UTF-8 encoded Unicode string. If there - already is a value for *key*, it is replaced by the new value. - Returns 0 on success and -1 on error. - -.. function:: int json_object_set_nocheck(json_t *object, const char *key, json_t *value) - - Like :func:`json_object_set`, but doesn't check that *key* is - valid UTF-8. Use this function only if you are certain that this - really is the case (e.g. you have already checked it by other - means). - -.. function:: int json_object_set_new(json_t *object, const char *key, json_t *value) - - Like :func:`json_object_set()` but steals the reference to - *value*. This is useful when *value* is newly created and not used - after the call. - -.. function:: int json_object_set_new_nocheck(json_t *object, const char *key, json_t *value) - - Like :func:`json_object_set_new`, but doesn't check that *key* is - valid UTF-8. Use this function only if you are certain that this - really is the case (e.g. you have already checked it by other - means). - -.. function:: int json_object_del(json_t *object, const char *key) - - Delete *key* from *object* if it exists. Returns 0 on success, or - -1 if *key* was not found. - - -.. function:: int json_object_clear(json_t *object) - - Remove all elements from *object*. Returns 0 on success and -1 if - *object* is not a JSON object. - -.. function:: int json_object_update(json_t *object, json_t *other) - - Update *object* with the key-value pairs from *other*, overwriting - existing keys. Returns 0 on success or -1 on error. - - -The following functions implement an iteration protocol for objects, -allowing to iterate through all key-value pairs in an object. The -items are not returned in any particular order, as this would require -sorting due to the internal object representation. - -.. function:: void *json_object_iter(json_t *object) - - Returns an opaque iterator which can be used to iterate over all - key-value pairs in *object*, or *NULL* if *object* is empty. - -.. function:: void *json_object_iter_at(json_t *object, const char *key) - - Like :func:`json_object_iter()`, but returns an iterator to the - key-value pair in *object* whose key is equal to *key*, or NULL if - *key* is not found in *object*. Iterating forward to the end of - *object* only yields all key-value pairs of the object if *key* - happens to be the first key in the underlying hash table. - -.. function:: void *json_object_iter_next(json_t *object, void *iter) - - Returns an iterator pointing to the next key-value pair in *object* - after *iter*, or *NULL* if the whole object has been iterated - through. - -.. function:: const char *json_object_iter_key(void *iter) - - Extract the associated key from *iter*. - -.. function:: json_t *json_object_iter_value(void *iter) - - .. refcounting:: borrow - - Extract the associated value from *iter*. - -.. function:: int json_object_iter_set(json_t *object, void *iter, json_t *value) - - Set the value of the key-value pair in *object*, that is pointed to - by *iter*, to *value*. - -.. function:: int json_object_iter_set_new(json_t *object, void *iter, json_t *value) - - Like :func:`json_object_iter_set()`, but steals the reference to - *value*. This is useful when *value* is newly created and not used - after the call. - -The iteration protocol can be used for example as follows:: - - /* obj is a JSON object */ - const char *key; - json_t *value; - void *iter = json_object_iter(obj); - while(iter) - { - key = json_object_iter_key(iter); - value = json_object_iter_value(iter); - /* use key and value ... */ - iter = json_object_iter_next(obj, iter); - } - - -Error reporting -=============== - -Jansson uses a single struct type to pass error information to the -user. See sections :ref:`apiref-decoding`, :ref:`apiref-pack` and -:ref:`apiref-unpack` for functions that pass error information using -this struct. - -.. type:: json_error_t - - .. member:: char text[] - - The error message (in UTF-8), or an empty string if a message is - not available. - - .. member:: char source[] - - Source of the error. This can be (a part of) the file name or a - special identifier in angle brackers (e.g. ````). - - .. member:: int line - - The line number on which the error occurred. - - .. member:: int column - - The column on which the error occurred. Note that this is the - *character column*, not the byte column, i.e. a multibyte UTF-8 - character counts as one column. - - .. member:: size_t position - - The position in bytes from the start of the input. This is - useful for debugging Unicode encoding problems. - -The normal use of :type:`json_error_t` is to allocate it on the stack, -and pass a pointer to a function. Example:: - - int main() { - json_t *json; - json_error_t error; - - json = json_load_file("/path/to/file.json", 0, &error); - if(!json) { - /* the error variable contains error information */ - } - ... - } - -Also note that if the call succeeded (``json != NULL`` in the above -example), the contents of ``error`` are unspecified. - -All functions also accept *NULL* as the :type:`json_error_t` pointer, -in which case no error information is returned to the caller. - - -Encoding -======== - -This sections describes the functions that can be used to encode -values to JSON. By default, only objects and arrays can be encoded -directly, since they are the only valid *root* values of a JSON text. -To encode any JSON value, use the ``JSON_ENCODE_ANY`` flag (see -below). - -By default, the output has no newlines, and spaces are used between -array and object elements for a readable output. This behavior can be -altered by using the ``JSON_INDENT`` and ``JSON_COMPACT`` flags -described below. A newline is never appended to the end of the encoded -JSON data. - -Each function takes a *flags* parameter that controls some aspects of -how the data is encoded. Its default value is 0. The following macros -can be ORed together to obtain *flags*. - -``JSON_INDENT(n)`` - Pretty-print the result, using newlines between array and object - items, and indenting with *n* spaces. The valid range for *n* is - between 0 and 32, other values result in an undefined output. If - ``JSON_INDENT`` is not used or *n* is 0, no newlines are inserted - between array and object items. - -``JSON_COMPACT`` - This flag enables a compact representation, i.e. sets the separator - between array and object items to ``","`` and between object keys - and values to ``":"``. Without this flag, the corresponding - separators are ``", "`` and ``": "`` for more readable output. - -``JSON_ENSURE_ASCII`` - If this flag is used, the output is guaranteed to consist only of - ASCII characters. This is achived by escaping all Unicode - characters outside the ASCII range. - -``JSON_SORT_KEYS`` - If this flag is used, all the objects in output are sorted by key. - This is useful e.g. if two JSON texts are diffed or visually - compared. - -``JSON_PRESERVE_ORDER`` - If this flag is used, object keys in the output are sorted into the - same order in which they were first inserted to the object. For - example, decoding a JSON text and then encoding with this flag - preserves the order of object keys. - -``JSON_ENCODE_ANY`` - Specifying this flag makes it possible to encode any JSON value on - its own. Without it, only objects and arrays can be passed as the - *root* value to the encoding functions. - - **Note:** Encoding any value may be useful in some scenarios, but - it's generally discouraged as it violates strict compatiblity with - :rfc:`4627`. If you use this flag, don't expect interoperatibility - with other JSON systems. Even Jansson itself doesn't have any means - to decode JSON texts whose root value is not object or array. - - .. versionadded:: 2.1 - -The following functions perform the actual JSON encoding. The result -is in UTF-8. - -.. function:: char *json_dumps(const json_t *root, size_t flags) - - Returns the JSON representation of *root* as a string, or *NULL* on - error. *flags* is described above. The return value must be freed - by the caller using :func:`free()`. - -.. function:: int json_dumpf(const json_t *root, FILE *output, size_t flags) - - Write the JSON representation of *root* to the stream *output*. - *flags* is described above. Returns 0 on success and -1 on error. - If an error occurs, something may have already been written to - *output*. In this case, the output is undefined and most likely not - valid JSON. - -.. function:: int json_dump_file(const json_t *json, const char *path, size_t flags) - - Write the JSON representation of *root* to the file *path*. If - *path* already exists, it is overwritten. *flags* is described - above. Returns 0 on success and -1 on error. - - -.. _apiref-decoding: - -Decoding -======== - -This sections describes the functions that can be used to decode JSON -text to the Jansson representation of JSON data. The JSON -specification requires that a JSON text is either a serialized array -or object, and this requirement is also enforced with the following -functions. In other words, the top level value in the JSON text being -decoded must be either array or object. - -See :ref:`rfc-conformance` for a discussion on Jansson's conformance -to the JSON specification. It explains many design decisions that -affect especially the behavior of the decoder. - -Each function takes a *flags* parameter that can be used to control -the behavior of the decoder. Its default value is 0. The following -macros can be ORed together to obtain *flags*. - -``JSON_REJECT_DUPLICATES`` - Issue a decoding error if any JSON object in the input text - contains duplicate keys. Without this flag, the value of the last - occurence of each key ends up in the result. Key equivalence is - checked byte-by-byte, without special Unicode comparison - algorithms. - - .. versionadded:: 2.1 - -``JSON_DISABLE_EOF_CHECK`` - By default, the decoder expects that its whole input constitutes a - valid JSON text, and issues an error if there's extra data after - the otherwise valid JSON input. With this flag enabled, the decoder - stops after decoding a valid JSON array or object, and thus allows - extra data after the JSON text. - - .. versionadded:: 2.1 - -The following functions perform the actual JSON decoding. - -.. function:: json_t *json_loads(const char *input, size_t flags, json_error_t *error) - - .. refcounting:: new - - Decodes the JSON string *input* and returns the array or object it - contains, or *NULL* on error, in which case *error* is filled with - information about the error. *flags* is described above. - -.. function:: json_t *json_loadb(const char *buffer, size_t buflen, size_t flags, json_error_t *error) - - .. refcounting:: new - - Decodes the JSON string *buffer*, whose length is *buflen*, and - returns the array or object it contains, or *NULL* on error, in - which case *error* is filled with information about the error. This - is similar to :func:`json_loads()` except that the string doesn't - need to be null-terminated. *flags* is described above. - - .. versionadded:: 2.1 - -.. function:: json_t *json_loadf(FILE *input, size_t flags, json_error_t *error) - - .. refcounting:: new - - Decodes the JSON text in stream *input* and returns the array or - object it contains, or *NULL* on error, in which case *error* is - filled with information about the error. *flags* is described - above. - -.. function:: json_t *json_load_file(const char *path, size_t flags, json_error_t *error) - - .. refcounting:: new - - Decodes the JSON text in file *path* and returns the array or - object it contains, or *NULL* on error, in which case *error* is - filled with information about the error. *flags* is described - above. - - -.. _apiref-pack: - -Building Values -=============== - -This sectinon describes functions that help to create, or *pack*, -complex JSON values, especially nested objects and arrays. Value -building is based on a *format string* that is used to tell the -functions about the expected arguments. - -For example, the format string ``"i"`` specifies a single integer -value, while the format string ``"[ssb]"`` or the equivalent ``"[s, s, -b]"`` specifies an array value with two integers and a boolean as its -items:: - - /* Create the JSON integer 42 */ - json_pack("i", 42); - - /* Create the JSON array ["foo", "bar", true] */ - json_pack("[ssb]", "foo", "bar", 1); - -Here's the full list of format characters. The type in parentheses -denotes the resulting JSON type, and the type in brackets (if any) -denotes the C type that is expected as the corresponding argument. - -``s`` (string) [const char \*] - Convert a NULL terminated UTF-8 string to a JSON string. - -``n`` (null) - Output a JSON null value. No argument is consumed. - -``b`` (boolean) [int] - Convert a C :type:`int` to JSON boolean value. Zero is converted - to ``false`` and non-zero to ``true``. - -``i`` (integer) [int] - Convert a C :type:`int` to JSON integer. - -``I`` (integer) [json_int_t] - Convert a C :type:`json_int_t` to JSON integer. - -``f`` (real) [double] - Convert a C :type:`double` to JSON real. - -``o`` (any value) [json_t \*] - Output any given JSON value as-is. If the value is added to an - array or object, the reference to the value passed to ``o`` is - stealed by the container. - -``O`` (any value) [json_t \*] - Like ``o``, but the argument's reference count is incremented. - This is useful if you pack into an array or object and want to - keep the reference for the JSON value consumed by ``O`` to - yourself. - -``[fmt]`` (array) - Build an array with contents from the inner format string. ``fmt`` - may contain objects and arrays, i.e. recursive value building is - supported. - -``{fmt}`` (object) - Build an object with contents from the inner format string - ``fmt``. The first, third, etc. format character represent a key, - and must be ``s`` (as object keys are always strings). The second, - fourth, etc. format character represent a value. Any value may be - an object or array, i.e. recursive value building is supported. - -The following functions compose the value building API: - -.. function:: json_t *json_pack(const char *fmt, ...) - - .. refcounting:: new - - Build a new JSON value according to the format string *fmt*. For - each format character (except for ``{}[]n``), one argument is - consumed and used to build the corresponding value. Returns *NULL* - on error. - -.. function:: json_t *json_pack_ex(json_error_t *error, size_t flags, const char *fmt, ...) - json_t *json_vpack_ex(json_error_t *error, size_t flags, const char *fmt, va_list ap) - - .. refcounting:: new - - Like :func:`json_pack()`, but an in the case of an error, an error - message is written to *error*, if it's not *NULL*. The *flags* - parameter is currently unused and should be set to 0. - - As only the errors in format string (and out-of-memory errors) can - be caught by the packer, these two functions are most likely only - useful for debugging format strings. - -More examples:: - - /* Build an empty JSON object */ - json_pack("{}"); - - /* Build the JSON object {"foo": 42, "bar": 7} */ - json_pack("{sisb}", "foo", 42, "bar", 7); - - /* Like above, ':', ',' and whitespace are ignored */ - json_pack("{s:i, s:b}", "foo", 42, "bar", 7); - - /* Build the JSON array [[1, 2], {"cool": true}] */ - json_pack("[[i,i],{s:b]]", 1, 2, "cool", 1); - - -.. _apiref-unpack: - -Parsing and Validating Values -============================= - -This sectinon describes functions that help to validate complex values -and extract, or *unpack*, data from them. Like :ref:`building values -`, this is also based on format strings. - -While a JSON value is unpacked, the type specified in the format -string is checked to match that of the JSON value. This is the -validation part of the process. In addition to this, the unpacking -functions can also check that all items of arrays and objects are -unpacked. This check be enabled with the format character ``!`` or by -using the flag ``JSON_STRICT``. See below for details. - -Here's the full list of format characters. The type in parentheses -denotes the JSON type, and the type in brackets (if any) denotes the C -type whose address should be passed. - -``s`` (string) [const char \*] - Convert a JSON string to a pointer to a NULL terminated UTF-8 - string. - -``n`` (null) - Expect a JSON null value. Nothing is extracted. - -``b`` (boolean) [int] - Convert a JSON boolean value to a C :type:`int`, so that ``true`` - is converted to 1 and ``false`` to 0. - -``i`` (integer) [int] - Convert a JSON integer to C :type:`int`. - -``I`` (integer) [json_int_t] - Convert a JSON integer to C :type:`json_int_t`. - -``f`` (real) [double] - Convert a JSON real to C :type:`double`. - -``F`` (integer or real) [double] - Convert a JSON number (integer or real) to C :type:`double`. - -``o`` (any value) [json_t \*] - Store a JSON value with no conversion to a :type:`json_t` pointer. - -``O`` (any value) [json_t \*] - Like ``O``, but the JSON value's reference count is incremented. - -``[fmt]`` (array) - Convert each item in the JSON array according to the inner format - string. ``fmt`` may contain objects and arrays, i.e. recursive - value extraction is supporetd. - -``{fmt}`` (object) - Convert each item in the JSON object according to the inner format - string ``fmt``. The first, third, etc. format character represent - a key, and must be ``s``. The corresponding argument to unpack - functions is read as the object key. The second fourth, etc. - format character represent a value and is written to the address - given as the corresponding argument. **Note** that every other - argument is read from and every other is written to. - - ``fmt`` may contain objects and arrays as values, i.e. recursive - value extraction is supporetd. - -``!`` - This special format character is used to enable the check that - all object and array items are accessed, on a per-value basis. It - must appear inside an array or object as the last format character - before the closing bracket or brace. To enable the check globally, - use the ``JSON_STRICT`` unpacking flag. - -``*`` - This special format character is the opposite of ``!``. If the - ``JSON_STRICT`` flag is used, ``*`` can be used to disable the - strict check on a per-value basis. It must appear inside an array - or object as the last format character before the closing bracket - or brace. - -The following functions compose the parsing and validation API: - -.. function:: int json_unpack(json_t *root, const char *fmt, ...) - - Validate and unpack the JSON value *root* according to the format - string *fmt*. Returns 0 on success and -1 on failure. - -.. function:: int json_unpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, ...) - int json_vunpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, va_list ap) - - Validate and unpack the JSON value *root* according to the format - string *fmt*. If an error occurs and *error* is not *NULL*, write - error information to *error*. *flags* can be used to control the - behaviour of the unpacker, see below for the flags. Returns 0 on - success and -1 on failure. - -The following unpacking flags are available: - -``JSON_STRICT`` - Enable the extra validation step checking that all object and - array items are unpacked. This is equivalent to appending the - format character ``!`` to the end of every array and object in the - format string. - -``JSON_VALIDATE_ONLY`` - Don't extract any data, just validate the JSON value against the - given format string. Note that object keys must still be specified - after the format string. - -Examples:: - - /* root is the JSON integer 42 */ - int myint; - json_unpack(root, "i", &myint); - assert(myint == 42); - - /* root is the JSON object {"foo": "bar", "quux": true} */ - const char *str; - int boolean; - json_unpack(root, "{s:s, s:b}", "foo", &str, "quux", &boolean); - assert(strcmp(str, "bar") == 0 && boolean == 1); - - /* root is the JSON array [[1, 2], {"baz": null} */ - json_error_t error; - json_unpack_ex(root, &error, JSON_VALIDATE_ONLY, "[[i,i], {s:n}]", "baz"); - /* returns 0 for validation success, nothing is extracted */ - - /* root is the JSON array [1, 2, 3, 4, 5] */ - int myint1, myint2; - json_unpack(root, "[ii!]", &myint1, &myint2); - /* returns -1 for failed validation */ - - -Equality -======== - -Testing for equality of two JSON values cannot, in general, be -achieved using the ``==`` operator. Equality in the terms of the -``==`` operator states that the two :type:`json_t` pointers point to -exactly the same JSON value. However, two JSON values can be equal not -only if they are exactly the same value, but also if they have equal -"contents": - -* Two integer or real values are equal if their contained numeric - values are equal. An integer value is never equal to a real value, - though. - -* Two strings are equal if their contained UTF-8 strings are equal, - byte by byte. Unicode comparison algorithms are not implemented. - -* Two arrays are equal if they have the same number of elements and - each element in the first array is equal to the corresponding - element in the second array. - -* Two objects are equal if they have exactly the same keys and the - value for each key in the first object is equal to the value of the - corresponding key in the second object. - -* Two true, false or null values have no "contents", so they are equal - if their types are equal. (Because these values are singletons, - their equality can actually be tested with ``==``.) - -The following function can be used to test whether two JSON values are -equal. - -.. function:: int json_equal(json_t *value1, json_t *value2) - - Returns 1 if *value1* and *value2* are equal, as defined above. - Returns 0 if they are inequal or one or both of the pointers are - *NULL*. - - -Copying -======= - -Because of reference counting, passing JSON values around doesn't -require copying them. But sometimes a fresh copy of a JSON value is -needed. For example, if you need to modify an array, but still want to -use the original afterwards, you should take a copy of it first. - -Jansson supports two kinds of copying: shallow and deep. There is a -difference between these methods only for arrays and objects. Shallow -copying only copies the first level value (array or object) and uses -the same child values in the copied value. Deep copying makes a fresh -copy of the child values, too. Moreover, all the child values are deep -copied in a recursive fashion. - -.. function:: json_t *json_copy(json_t *value) - - .. refcounting:: new - - Returns a shallow copy of *value*, or *NULL* on error. - -.. function:: json_t *json_deep_copy(json_t *value) - - .. refcounting:: new - - Returns a deep copy of *value*, or *NULL* on error. - - -Custom Memory Allocation -======================== - -By default, Jansson uses :func:`malloc()` and :func:`free()` for -memory allocation. These functions can be overridden if custom -behavior is needed. - -.. type:: json_malloc_t - - A typedef for a function pointer with :func:`malloc()`'s - signature:: - - typedef void *(*json_malloc_t)(size_t); - -.. type:: json_free_t - - A typedef for a function pointer with :func:`free()`'s - signature:: - - typedef void (*json_free_t)(void *); - -.. function:: void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn) - - Use *malloc_fn* instead of :func:`malloc()` and *free_fn* instead - of :func:`free()`. This function has to be called before any other - Jansson's API functions to ensure that all memory operations use - the same functions. - -Examples: - -Use the `Boehm's conservative garbage collector`_ for memory -operations:: - - json_set_alloc_funcs(GC_malloc, GC_free); - -.. _Boehm's conservative garbage collector: http://www.hpl.hp.com/personal/Hans_Boehm/gc/ - -Allow storing sensitive data (e.g. passwords or encryption keys) in -JSON structures by zeroing all memory when freed:: - - static void *secure_malloc(size_t size) - { - /* Store the memory area size in the beginning of the block */ - void *ptr = malloc(size + 8); - *((size_t *)ptr) = size; - return ptr + 8; - } - - static void secure_free(void *ptr) - { - size_t size; - - ptr -= 8; - size = *((size_t *)ptr); - - guaranteed_memset(ptr, 0, size); - free(ptr); - } - - int main() - { - json_set_alloc_funcs(secure_malloc, secure_free); - /* ... */ - } - -For more information about the issues of storing sensitive data in -memory, see -http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/protect-secrets.html. -The page also examplains the :func:`guaranteed_memset()` function used -in the example and gives a sample implementation for it. diff --git a/lang/c/jansson/doc/changes.rst b/lang/c/jansson/doc/changes.rst deleted file mode 100644 index ea56843774f..00000000000 --- a/lang/c/jansson/doc/changes.rst +++ /dev/null @@ -1,5 +0,0 @@ -****************** -Changes in Jansson -****************** - -.. include:: ../CHANGES diff --git a/lang/c/jansson/doc/conf.py b/lang/c/jansson/doc/conf.py deleted file mode 100644 index ff3ba2e4048..00000000000 --- a/lang/c/jansson/doc/conf.py +++ /dev/null @@ -1,217 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Jansson documentation build configuration file, created by -# sphinx-quickstart on Sun Sep 5 21:47:20 2010. -# -# This file is execfile()d with the current directory set to its containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -import sys, os - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -sys.path.insert(0, os.path.abspath('ext')) - -# -- General configuration ----------------------------------------------------- - -# If your documentation needs a minimal Sphinx version, state it here. -needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['refcounting'] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix of source filenames. -source_suffix = '.rst' - -# The encoding of source files. -#source_encoding = 'utf-8-sig' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = u'Jansson' -copyright = u'2009-2011, Petri Lehtinen' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = '2.1' -# The full version, including alpha/beta/rc tags. -release = '2.1' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -#language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ['_build'] - -# The reST default role (used for this markup: `text`) to use for all documents. -default_role = 'c:func' -primary_domain = 'c' - -# If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -#add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -#show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] - - -# -- Options for HTML output --------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -#html_theme = 'default' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -#html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -#html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -#html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -#html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -#html_static_path = ['_static'] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -#html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -#html_additional_pages = {} - -# If false, no module index is generated. -#html_domain_indices = True - -# If false, no index is generated. -#html_use_index = True - -# If true, the index is split into individual pages for each letter. -#html_split_index = False - -# If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -#html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None - -# Output file base name for HTML help builder. -htmlhelp_basename = 'Janssondoc' - - -# -- Options for LaTeX output -------------------------------------------------- - -# The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' - -# The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass [howto/manual]). -latex_documents = [ - ('index', 'Jansson.tex', u'Jansson Documentation', - u'Petri Lehtinen', 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -#latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False - -# If true, show page references after internal links. -#latex_show_pagerefs = False - -# If true, show URL addresses after external links. -#latex_show_urls = False - -# Additional stuff for the LaTeX preamble. -#latex_preamble = '' - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_domain_indices = True - - -# -- Options for manual page output -------------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'jansson', u'Jansson Documentation', - [u'Petri Lehtinen'], 1) -] diff --git a/lang/c/jansson/doc/conformance.rst b/lang/c/jansson/doc/conformance.rst deleted file mode 100644 index 34d60bd3546..00000000000 --- a/lang/c/jansson/doc/conformance.rst +++ /dev/null @@ -1,112 +0,0 @@ -.. _rfc-conformance: - -*************** -RFC Conformance -*************** - -JSON is specified in :rfc:`4627`, *"The application/json Media Type -for JavaScript Object Notation (JSON)"*. This chapter discusses -Jansson's conformance to this specification. - -Character Encoding -================== - -Jansson only supports UTF-8 encoded JSON texts. It does not support or -auto-detect any of the other encodings mentioned in the RFC, namely -UTF-16LE, UTF-16BE, UTF-32LE or UTF-32BE. Pure ASCII is supported, as -it's a subset of UTF-8. - -Strings -======= - -JSON strings are mapped to C-style null-terminated character arrays, -and UTF-8 encoding is used internally. Strings may not contain -embedded null characters, not even escaped ones. - -For example, trying to decode the following JSON text leads to a parse -error:: - - ["this string contains the null character: \u0000"] - -All other Unicode codepoints U+0001 through U+10FFFF are allowed. - -Unicode normalization or any other transformation is never performed -on any strings (string values or object keys). When checking for -equivalence of strings or object keys, the comparison is performed -byte by byte between the original UTF-8 representations of the -strings. - -Numbers -======= - -Real vs. Integer ----------------- - -JSON makes no distinction between real and integer numbers; Jansson -does. Real numbers are mapped to the ``double`` type and integers to -the ``json_int_t`` type, which is a typedef of ``long long`` or -``long``, depending on whether ``long long`` is supported by your -compiler or not. - -A JSON number is considered to be a real number if its lexical -representation includes one of ``e``, ``E``, or ``.``; regardless if -its actual numeric value is a true integer (e.g., all of ``1E6``, -``3.0``, ``400E-2``, and ``3.14E3`` are mathematical integers, but -will be treated as real values). - -All other JSON numbers are considered integers. - -When encoding to JSON, real values are always represented -with a fractional part; e.g., the ``double`` value 3.0 will be -represented in JSON as ``3.0``, not ``3``. - -Overflow, Underflow & Precision -------------------------------- - -Real numbers whose absolute values are too small to be represented in -a C ``double`` will be silently estimated with 0.0. Thus, depending on -platform, JSON numbers very close to zero such as 1E-999 may result in -0.0. - -Real numbers whose absolute values are too large to be represented in -a C ``double`` will result in an overflow error (a JSON decoding -error). Thus, depending on platform, JSON numbers like 1E+999 or --1E+999 may result in a parsing error. - -Likewise, integer numbers whose absolute values are too large to be -represented in the ``json_int_t`` type (see above) will result in an -overflow error (a JSON decoding error). Thus, depending on platform, -JSON numbers like 1000000000000000 may result in parsing error. - -Parsing JSON real numbers may result in a loss of precision. As long -as overflow does not occur (i.e. a total loss of precision), the -rounded approximate value is silently used. Thus the JSON number -1.000000000000000005 may, depending on platform, result in the -``double`` value 1.0. - -Signed zeros ------------- - -JSON makes no statement about what a number means; however Javascript -(ECMAscript) does state that +0.0 and -0.0 must be treated as being -distinct values, i.e. -0.0 |not-equal| 0.0. Jansson relies on the -underlying floating point library in the C environment in which it is -compiled. Therefore it is platform-dependent whether 0.0 and -0.0 will -be distinct values. Most platforms that use the IEEE 754 -floating-point standard will support signed zeros. - -Note that this only applies to floating-point; neither JSON, C, or -IEEE support the concept of signed integer zeros. - -.. |not-equal| unicode:: U+2260 - -Types ------ - -No support is provided in Jansson for any C numeric types other than -``json_int_t`` and ``double``. This excludes things such as unsigned -types, ``long double``, etc. Obviously, shorter types like ``short``, -``int``, ``long`` (if ``json_int_t`` is ``long long``) and ``float`` -are implicitly handled via the ordinary C type coercion rules (subject -to overflow semantics). Also, no support or hooks are provided for any -supplemental "bignum" type add-on packages. diff --git a/lang/c/jansson/doc/ext/refcounting.py b/lang/c/jansson/doc/ext/refcounting.py deleted file mode 100644 index 5bf4aab7faf..00000000000 --- a/lang/c/jansson/doc/ext/refcounting.py +++ /dev/null @@ -1,59 +0,0 @@ -""" - refcounting - ~~~~~~~~~~~ - - Reference count annotations for C API functions. Has the same - result as the sphinx.ext.refcounting extension but works for all - functions regardless of the signature, and the reference counting - information is written inline with the documentation instead of a - separate file. - - Adds a new directive "refcounting". The directive has no content - and one required positional parameter:: "new" or "borrow". - - Example: - - .. cfunction:: json_t *json_object(void) - - .. refcounting:: new - - - - :copyright: Copyright (c) 2009-2011 Petri Lehtinen - :license: MIT, see LICENSE for details. -""" - -from docutils import nodes - -class refcounting(nodes.emphasis): pass - -def visit(self, node): - self.visit_emphasis(node) - -def depart(self, node): - self.depart_emphasis(node) - -def html_visit(self, node): - self.body.append(self.starttag(node, 'em', '', CLASS='refcount')) - -def html_depart(self, node): - self.body.append('') - - -def refcounting_directive(name, arguments, options, content, lineno, - content_offset, block_text, state, state_machine): - if arguments[0] == 'borrow': - text = 'Return value: Borrowed reference.' - elif arguments[0] == 'new': - text = 'Return value: New reference.' - else: - raise Error('Valid arguments: new, borrow') - - return [refcounting(text, text)] - -def setup(app): - app.add_node(refcounting, - html=(html_visit, html_depart), - latex=(visit, depart), - text=(visit, depart)) - app.add_directive('refcounting', refcounting_directive, 0, (1, 0, 0)) diff --git a/lang/c/jansson/doc/gettingstarted.rst b/lang/c/jansson/doc/gettingstarted.rst deleted file mode 100644 index eb5f6833e3e..00000000000 --- a/lang/c/jansson/doc/gettingstarted.rst +++ /dev/null @@ -1,123 +0,0 @@ -*************** -Getting Started -*************** - -.. highlight:: c - -Compiling and Installing Jansson -================================ - -The Jansson source is available at -http://www.digip.org/jansson/releases/. - -Unix-like systems ------------------ - -Unpack the source tarball and change to the source directory: - -.. parsed-literal:: - - bunzip2 -c jansson-|release|.tar.bz2 | tar xf - - cd jansson-|release| - -The source uses GNU Autotools (autoconf_, automake_, libtool_), so -compiling and installing is extremely simple:: - - ./configure - make - make check - make install - -To change the destination directory (``/usr/local`` by default), use -the ``--prefix=DIR`` argument to ``./configure``. See ``./configure ---help`` for the list of all possible installation options. (There are -no options to customize the resulting Jansson binary.) - -The command ``make check`` runs the test suite distributed with -Jansson. This step is not strictly necessary, but it may find possible -problems that Jansson has on your platform. If any problems are found, -please report them. - -If you obtained the source from a Git repository (or any other source -control system), there's no ``./configure`` script as it's not kept in -version control. To create the script, the build system needs to be -bootstrapped. There are many ways to do this, but the easiest one is -to use ``autoreconf``:: - - autoreconf -vi - -This command creates the ``./configure`` script, which can then be -used as described above. - -.. _autoconf: http://www.gnu.org/software/autoconf/ -.. _automake: http://www.gnu.org/software/automake/ -.. _libtool: http://www.gnu.org/software/libtool/ - - -Other Systems -------------- - -On Windows and other non Unix-like systems, you may be unable to run -the ``./configure`` script. In this case, follow these steps. All the -files mentioned can be found in the ``src/`` directory. - -1. Create ``jansson_config.h``. This file has some platform-specific - parameters that are normally filled in by the ``./configure`` - script: - - - On Windows, rename ``jansson_config.h.win32`` to ``jansson_config.h``. - - - On other systems, edit ``jansson_config.h.in``, replacing all - ``@variable@`` placeholders, and rename the file to - ``jansson_config.h``. - -2. Make ``jansson.h`` and ``jansson_config.h`` available to the - compiler, so that they can be found when compiling programs that - use Jansson. - -3. Compile all the ``.c`` files (in the ``src/`` directory) into a - library file. Make the library available to the compiler, as in - step 2. - - -Building the Documentation --------------------------- - -(This subsection describes how to build the HTML documentation you are -currently reading, so it can be safely skipped.) - -Documentation is in the ``doc/`` subdirectory. It's written in -reStructuredText_ with Sphinx_ annotations. To generate the HTML -documentation, invoke:: - - make html - -and point your browser to ``doc/_build/html/index.html``. Sphinx_ 1.0 -or newer is required to generate the documentation. - -.. _reStructuredText: http://docutils.sourceforge.net/rst.html -.. _Sphinx: http://sphinx.pocoo.org/ - - -Compiling Programs that Use Jansson -=================================== - -Jansson involves one C header file, :file:`jansson.h`, so it's enough -to put the line - -:: - - #include - -in the beginning of every source file that uses Jansson. - -There's also just one library to link with, ``libjansson``. Compile and -link the program as follows:: - - cc -o prog prog.c -ljansson - -Starting from version 1.2, there's also support for pkg-config_:: - - cc -o prog prog.c `pkg-config --cflags --libs jansson` - -.. _pkg-config: http://pkg-config.freedesktop.org/ diff --git a/lang/c/jansson/doc/github_commits.c b/lang/c/jansson/doc/github_commits.c deleted file mode 100644 index 9ba36b75401..00000000000 --- a/lang/c/jansson/doc/github_commits.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include - -#include -#include - -#define BUFFER_SIZE (256 * 1024) /* 256 KB */ - -#define URL_FORMAT "http://github.com/api/v2/json/commits/list/%s/%s/master" -#define URL_SIZE 256 - -/* Return the offset of the first newline in text or the length of - text if there's no newline */ -static int newline_offset(const char *text) -{ - const char *newline = strchr(text, '\n'); - if(!newline) - return strlen(text); - else - return (int)(newline - text); -} - -struct write_result -{ - char *data; - int pos; -}; - -static size_t write_response(void *ptr, size_t size, size_t nmemb, void *stream) -{ - struct write_result *result = (struct write_result *)stream; - - if(result->pos + size * nmemb >= BUFFER_SIZE - 1) - { - fprintf(stderr, "error: too small buffer\n"); - return 0; - } - - memcpy(result->data + result->pos, ptr, size * nmemb); - result->pos += size * nmemb; - - return size * nmemb; -} - -static char *request(const char *url) -{ - CURL *curl; - CURLcode status; - char *data; - long code; - - curl = curl_easy_init(); - data = malloc(BUFFER_SIZE); - if(!curl || !data) - return NULL; - - struct write_result write_result = { - .data = data, - .pos = 0 - }; - - curl_easy_setopt(curl, CURLOPT_URL, url); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_response); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &write_result); - - status = curl_easy_perform(curl); - if(status != 0) - { - fprintf(stderr, "error: unable to request data from %s:\n", url); - fprintf(stderr, "%s\n", curl_easy_strerror(status)); - return NULL; - } - - curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code); - if(code != 200) - { - fprintf(stderr, "error: server responded with code %ld\n", code); - return NULL; - } - - curl_easy_cleanup(curl); - curl_global_cleanup(); - - /* zero-terminate the result */ - data[write_result.pos] = '\0'; - - return data; -} - -int main(int argc, char *argv[]) -{ - size_t i; - char *text; - char url[URL_SIZE]; - - json_t *root; - json_error_t error; - json_t *commits; - - if(argc != 3) - { - fprintf(stderr, "usage: %s USER REPOSITORY\n\n", argv[0]); - fprintf(stderr, "List commits at USER's REPOSITORY.\n\n"); - return 2; - } - - snprintf(url, URL_SIZE, URL_FORMAT, argv[1], argv[2]); - - text = request(url); - if(!text) - return 1; - - root = json_loads(text, 0, &error); - free(text); - - if(!root) - { - fprintf(stderr, "error: on line %d: %s\n", error.line, error.text); - return 1; - } - - commits = json_object_get(root, "commits"); - if(!json_is_array(commits)) - { - fprintf(stderr, "error: commits is not an array\n"); - return 1; - } - - for(i = 0; i < json_array_size(commits); i++) - { - json_t *commit, *id, *message; - const char *message_text; - - commit = json_array_get(commits, i); - if(!json_is_object(commit)) - { - fprintf(stderr, "error: commit %d is not an object\n", i + 1); - return 1; - } - - id = json_object_get(commit, "id"); - if(!json_is_string(id)) - { - fprintf(stderr, "error: commit %d: id is not a string\n", i + 1); - return 1; - } - - message = json_object_get(commit, "message"); - if(!json_is_string(message)) - { - fprintf(stderr, "error: commit %d: message is not a string\n", i + 1); - return 1; - } - - message_text = json_string_value(message); - printf("%.8s %.*s\n", - json_string_value(id), - newline_offset(message_text), - message_text); - } - - json_decref(root); - return 0; -} diff --git a/lang/c/jansson/doc/index.rst b/lang/c/jansson/doc/index.rst deleted file mode 100644 index b5a3be8e17c..00000000000 --- a/lang/c/jansson/doc/index.rst +++ /dev/null @@ -1,47 +0,0 @@ -Jansson Documentation -===================== - -This is the documentation for Jansson_ |release|, last updated |today|. - -Introduction ------------- - -Jansson_ is a C library for encoding, decoding and manipulating JSON -data. Its main features and design principles are: - -- Simple and intuitive API and data model - -- Comprehensive documentation - -- No dependencies on other libraries - -- Full Unicode support (UTF-8) - -- Extensive test suite - -Jansson is licensed under the `MIT license`_; see LICENSE in the -source distribution for details. - - -.. _`MIT license`: http://www.opensource.org/licenses/mit-license.php -.. _Jansson: http://www.digip.org/jansson/ - -Contents --------- - -.. toctree:: - :maxdepth: 2 - - gettingstarted - upgrading - tutorial - conformance - apiref - changes - - -Indices and Tables -================== - -* :ref:`genindex` -* :ref:`search` diff --git a/lang/c/jansson/doc/tutorial.rst b/lang/c/jansson/doc/tutorial.rst deleted file mode 100644 index dd7ae1943ec..00000000000 --- a/lang/c/jansson/doc/tutorial.rst +++ /dev/null @@ -1,275 +0,0 @@ -.. _tutorial: - -******** -Tutorial -******** - -.. highlight:: c - -In this tutorial, we create a program that fetches the latest commits -of a repository in GitHub_ over the web. One of the response formats -supported by `GitHub API`_ is JSON, so the result can be parsed using -Jansson. - -To stick to the the scope of this tutorial, we will only cover the the -parts of the program related to handling JSON data. For the best user -experience, the full source code is available: -:download:`github_commits.c`. To compile it (on Unix-like systems with -gcc), use the following command:: - - gcc -o github_commits github_commits.c -ljansson -lcurl - -libcurl_ is used to communicate over the web, so it is required to -compile the program. - -The command line syntax is:: - - github_commits USER REPOSITORY - -``USER`` is a GitHub user ID and ``REPOSITORY`` is the repository -name. Please note that the GitHub API is rate limited, so if you run -the program too many times within a short period of time, the sever -starts to respond with an error. - -.. _GitHub: http://github.com/ -.. _GitHub API: http://develop.github.com/ -.. _libcurl: http://curl.haxx.se/ - - -.. _tutorial-github-commits-api: - -The GitHub Commits API -====================== - -The `GitHub commits API`_ is used by sending HTTP requests to URLs -starting with ``http://github.com/api/v2/json/commits/``. Our program -only lists the latest commits, so the rest of the URL is -``list/USER/REPOSITORY/BRANCH``, where ``USER``, ``REPOSITORY`` and -``BRANCH`` are the GitHub user ID, the name of the repository, and the -name of the branch whose commits are to be listed, respectively. - -GitHub responds with a JSON object of the following form: - -.. code-block:: none - - { - "commits": [ - { - "id": "", - "message": "", - - }, - { - "id": "", - "message": "", - - }, - - ] - } - -In our program, the HTTP request is sent using the following -function:: - - static char *request(const char *url); - -It takes the URL as a parameter, preforms a HTTP GET request, and -returns a newly allocated string that contains the response body. If -the request fails, an error message is printed to stderr and the -return value is *NULL*. For full details, refer to :download:`the code -`, as the actual implementation is not important -here. - -.. _GitHub commits API: http://develop.github.com/p/commits.html - -.. _tutorial-the-program: - -The Program -=========== - -First the includes:: - - #include - #include - -Like all the programs using Jansson, we need to include -:file:`jansson.h`. - -The following definitions are used to build the GitHub commits API -request URL:: - - #define URL_FORMAT "http://github.com/api/v2/json/commits/list/%s/%s/master" - #define URL_SIZE 256 - -The following function is used when formatting the result to find the -first newline in the commit message:: - - /* Return the offset of the first newline in text or the length of - text if there's no newline */ - static int newline_offset(const char *text) - { - const char *newline = strchr(text, '\n'); - if(!newline) - return strlen(text); - else - return (int)(newline - text); - } - -The main function follows. In the beginning, we first declare a bunch -of variables and check the command line parameters:: - - size_t i; - char *text; - char url[URL_SIZE]; - - json_t *root; - json_error_t error; - json_t *commits; - - if(argc != 3) - { - fprintf(stderr, "usage: %s USER REPOSITORY\n\n", argv[0]); - fprintf(stderr, "List commits at USER's REPOSITORY.\n\n"); - return 2; - } - -Then we build the request URL using the user and repository names -given as command line parameters:: - - snprintf(url, URL_SIZE, URL_FORMAT, argv[1], argv[2]); - -This uses the ``URL_SIZE`` and ``URL_FORMAT`` constants defined above. -Now we're ready to actually request the JSON data over the web:: - - text = request(url); - if(!text) - return 1; - -If an error occurs, our function ``request`` prints the error and -returns *NULL*, so it's enough to just return 1 from the main -function. - -Next we'll call :func:`json_loads()` to decode the JSON text we got -as a response:: - - root = json_loads(text, 0, &error); - free(text); - - if(!root) - { - fprintf(stderr, "error: on line %d: %s\n", error.line, error.text); - return 1; - } - -We don't need the JSON text anymore, so we can free the ``text`` -variable right after decoding it. If :func:`json_loads()` fails, it -returns *NULL* and sets error information to the :type:`json_error_t` -structure given as the second parameter. In this case, our program -prints the error information out and returns 1 from the main function. - -Now we're ready to extract the data out of the decoded JSON response. -The structure of the response JSON was explained in section -:ref:`tutorial-github-commits-api`. - -First, we'll extract the ``commits`` array from the JSON response:: - - commits = json_object_get(root, "commits"); - if(!json_is_array(commits)) - { - fprintf(stderr, "error: commits is not an array\n"); - return 1; - } - -This is the array that contains objects describing latest commits in -the repository. We check that the returned value really is an array. -If the key ``commits`` doesn't exist, :func:`json_object_get()` -returns *NULL*, but :func:`json_is_array()` handles this case, too. - -Then we proceed to loop over all the commits in the array:: - - for(i = 0; i < json_array_size(commits); i++) - { - json_t *commit, *id, *message; - const char *message_text; - - commit = json_array_get(commits, i); - if(!json_is_object(commit)) - { - fprintf(stderr, "error: commit %d is not an object\n", i + 1); - return 1; - } - ... - -The function :func:`json_array_size()` returns the size of a JSON -array. First, we again declare some variables and then extract the -i'th element of the ``commits`` array using :func:`json_array_get()`. -We also check that the resulting value is a JSON object. - -Next we'll extract the commit ID and commit message, and check that -they both are JSON strings:: - - id = json_object_get(commit, "id"); - if(!json_is_string(id)) - { - fprintf(stderr, "error: commit %d: id is not a string\n", i + 1); - return 1; - } - - message = json_object_get(commit, "message"); - if(!json_is_string(message)) - { - fprintf(stderr, "error: commit %d: message is not a string\n", i + 1); - return 1; - } - ... - -And finally, we'll print the first 8 characters of the commit ID and -the first line of the commit message. A C-style string is extracted -from a JSON string using :func:`json_string_value()`:: - - message_text = json_string_value(message); - printf("%.8s %.*s\n", - json_string_value(id), - newline_offset(message_text), - message_text); - } - -After sending the HTTP request, we decoded the JSON text using -:func:`json_loads()`, remember? It returns a *new reference* to the -JSON value it decodes. When we're finished with the value, we'll need -to decrease the reference count using :func:`json_decref()`. This way -Jansson can release the resources:: - - json_decref(root); - return 0; - -For a detailed explanation of reference counting in Jansson, see -:ref:`apiref-reference-count` in :ref:`apiref`. - -The program's ready, let's test it and view the latest commits in -Jansson's repository:: - - $ ./github_commits akheron jansson - 86dc1d62 Fix indentation - b67e130f json_dumpf: Document the output shortage on error - 4cd77771 Enhance handling of circular references - 79009e62 json_dumps: Close the strbuffer if dumping fails - 76999799 doc: Fix a small typo in apiref - 22af193a doc/Makefile.am: Remove *.pyc in clean - 951d091f Make integer, real and string mutable - 185e107d Don't use non-portable asprintf() - ca7703fb Merge branch '1.0' - 12cd4e8c jansson 1.0.4 - - - -Conclusion -========== - -In this tutorial, we implemented a program that fetches the latest -commits of a GitHub repository using the GitHub commits API. Jansson -was used to decode the JSON response and to extract the commit data. - -This tutorial only covered a small part of Jansson. For example, we -did not create or manipulate JSON values at all. Proceed to -:ref:`apiref` to explore all features of Jansson. diff --git a/lang/c/jansson/doc/upgrading.rst b/lang/c/jansson/doc/upgrading.rst deleted file mode 100644 index 9b4904610ec..00000000000 --- a/lang/c/jansson/doc/upgrading.rst +++ /dev/null @@ -1,76 +0,0 @@ -.. highlight:: c - -****************** -Upgrading from 1.x -****************** - -This chapter lists the backwards incompatible changes introduced in -Jansson 2.0, and the steps that are needed for upgrading your code. - -**The incompatibilities are not dramatic.** The biggest change is that -all decoding functions now require and extra parameter. Most programs -can be modified to work with 2.0 by adding a ``0`` as the second -parameter to all calls of :func:`json_loads()`, :func:`json_loadf()` -and :func:`json_load_file()`. - - -Compatibility -============= - -Jansson 2.0 is backwards incompatible with the Jansson 1.x releases. -It is ABI incompatible, i.e. all programs dynamically linking to the -Jansson library need to be recompiled. It's also API incompatible, -i.e. the source code of programs using Jansson 1.x may need -modifications to make them compile against Jansson 2.0. - -All the 2.x releases are guaranteed to be backwards compatible for -both ABI and API, so no recompilation or source changes are needed -when upgrading from 2.x to 2.y. - - -List of Incompatible Changes -============================ - -**Decoding flags** - For future needs, a ``flags`` parameter was added as the second - parameter to all decoding functions, i.e. :func:`json_loads()`, - :func:`json_loadf()` and :func:`json_load_file()`. All calls to - these functions need to be changed by adding a ``0`` as the second - argument. For example:: - - /* old code */ - json_loads(input, &error); - - /* new code */ - json_loads(input, 0, &error); - - -**Underlying type of JSON integers** - The underlying C type of JSON integers has been changed from - :type:`int` to the widest available signed integer type, i.e. - :type:`long long` or :type:`long`, depending on whether - :type:`long long` is supported on your system or not. This makes - the whole 64-bit integer range available on most modern systems. - - ``jansson.h`` has a typedef :type:`json_int_t` to the underlying - integer type. :type:`int` should still be used in most cases when - dealing with smallish JSON integers, as the compiler handles - implicit type coercion. Only when the full 64-bit range is needed, - :type:`json_int_t` should be explicitly used. - - -**Maximum encoder indentation depth** - The maximum argument of the ``JSON_INDENT()`` macro has been - changed from 255 to 31, to free up bits from the ``flags`` - parameter of :func:`json_dumps()`, :func:`json_dumpf()` and - :func:`json_dump_file()`. If your code uses a bigger indentation - than 31, it needs to be changed. - - -**Unsigned integers in API functions** - Version 2.0 unifies unsigned integer usage in the API. All uses of - :type:`unsigned int` and :type:`unsigned long` have been replaced - with :type:`size_t`. This includes flags, container sizes, etc. - This should not require source code changes, as both - :type:`unsigned int` and :type:`unsigned long` are usually - compatible with :type:`size_t`. diff --git a/lang/c/jansson/install-sh b/lang/c/jansson/install-sh deleted file mode 100755 index 4fbbae7b7ff..00000000000 --- a/lang/c/jansson/install-sh +++ /dev/null @@ -1,507 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2006-10-14.15 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -posix_glob= -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chmodcmd=$chmodprog -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= -dstarg= -no_target_directory= - -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - shift - shift - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac -done - -if test $# -ne 0 && test -z "$dir_arg$dstarg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - trap '(exit $?); exit' 1 2 13 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix=/ ;; - -*) prefix=./ ;; - *) prefix= ;; - esac - - case $posix_glob in - '') - if (set -f) 2>/dev/null; then - posix_glob=true - else - posix_glob=false - fi ;; - esac - - oIFS=$IFS - IFS=/ - $posix_glob && set -f - set fnord $dstdir - shift - $posix_glob && set +f - IFS=$oIFS - - prefixes= - - for d - do - test -z "$d" && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dst"; then - $doit $rmcmd -f "$dst" 2>/dev/null \ - || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ - && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ - || { - echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - } || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/lang/c/jansson/jansson.pc.in b/lang/c/jansson/jansson.pc.in deleted file mode 100644 index d9bf4dade69..00000000000 --- a/lang/c/jansson/jansson.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=${prefix}/include - -Name: Jansson -Description: Library for encoding, decoding and manipulating JSON data -Version: @VERSION@ -Libs: -L${libdir} -ljansson -Cflags: -I${includedir} diff --git a/lang/c/jansson/ltmain.sh b/lang/c/jansson/ltmain.sh deleted file mode 100755 index c856b8d4bb6..00000000000 --- a/lang/c/jansson/ltmain.sh +++ /dev/null @@ -1,8745 +0,0 @@ -# Generated from ltmain.m4sh. - -# libtool (GNU libtool) 2.2.10 -# Written by Gordon Matzigkeit , 1996 - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# GNU Libtool is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# Usage: $progname [OPTION]... [MODE-ARG]... -# -# Provide generalized library-building support services. -# -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --no-quiet, --no-silent -# print informational messages (default) -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print more informational messages than default -# --no-verbose don't print the extra informational messages -# --version print version information -# -h, --help, --help-all print short, long, or detailed help message -# -# MODE must be one of the following: -# -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory -# -# MODE-ARGS vary depending on the MODE. When passed as first option, -# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. -# Try `$progname --help --mode=MODE' for a more detailed description of MODE. -# -# When reporting a bug, please describe a test case to reproduce it and -# include the following information: -# -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.2.10 -# automake: $automake_version -# autoconf: $autoconf_version -# -# Report bugs to . - -PROGRAM=libtool -PACKAGE=libtool -VERSION=2.2.10 -TIMESTAMP="" -package_revision=1.3175 - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - -# NLS nuisances: We save the old values to restore during execute mode. -lt_user_locale= -lt_safe_locale= -for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES -do - eval "if test \"\${$lt_var+set}\" = set; then - save_$lt_var=\$$lt_var - $lt_var=C - export $lt_var - lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" - lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" - fi" -done -LC_ALL=C -LANGUAGE=C -export LANGUAGE LC_ALL - -$lt_unset CDPATH - - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - - - -: ${CP="cp -f"} -test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} -: ${EGREP="/usr/bin/grep -E"} -: ${FGREP="/usr/bin/grep -F"} -: ${GREP="/usr/bin/grep"} -: ${LN_S="ln -s"} -: ${MAKE="make"} -: ${MKDIR="mkdir"} -: ${MV="mv -f"} -: ${RM="rm -f"} -: ${SED="/usr/bin/sed"} -: ${SHELL="${CONFIG_SHELL-/bin/sh}"} -: ${Xsed="$SED -e 1s/^X//"} - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. -EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. - -exit_status=$EXIT_SUCCESS - -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" - -dirname="s,/[^/]*$,," -basename="s,^.*/,," - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` -} - -# Generated shell functions inserted here. - -# These SED scripts presuppose an absolute path with a trailing slash. -pathcar='s,^/\([^/]*\).*$,\1,' -pathcdr='s,^/[^/]*,,' -removedotparts=':dotsl - s@/\./@/@g - t dotsl - s,/\.$,/,' -collapseslashes='s@/\{1,\}@/@g' -finalslash='s,/*$,/,' - -# func_normal_abspath PATH -# Remove doubled-up and trailing slashes, "." path components, -# and cancel out any ".." path components in PATH after making -# it an absolute path. -# value returned in "$func_normal_abspath_result" -func_normal_abspath () -{ - # Start from root dir and reassemble the path. - func_normal_abspath_result= - func_normal_abspath_tpath=$1 - func_normal_abspath_altnamespace= - case $func_normal_abspath_tpath in - "") - # Empty path, that just means $cwd. - func_stripname '' '/' "`pwd`" - func_normal_abspath_result=$func_stripname_result - return - ;; - # The next three entries are used to spot a run of precisely - # two leading slashes without using negated character classes; - # we take advantage of case's first-match behaviour. - ///*) - # Unusual form of absolute path, do nothing. - ;; - //*) - # Not necessarily an ordinary path; POSIX reserves leading '//' - # and for example Cygwin uses it to access remote file shares - # over CIFS/SMB, so we conserve a leading double slash if found. - func_normal_abspath_altnamespace=/ - ;; - /*) - # Absolute path, do nothing. - ;; - *) - # Relative path, prepend $cwd. - func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath - ;; - esac - # Cancel out all the simple stuff to save iterations. We also want - # the path to end with a slash for ease of parsing, so make sure - # there is one (and only one) here. - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` - while :; do - # Processed it all yet? - if test "$func_normal_abspath_tpath" = / ; then - # If we ascended to the root using ".." the result may be empty now. - if test -z "$func_normal_abspath_result" ; then - func_normal_abspath_result=/ - fi - break - fi - func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcar"` - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcdr"` - # Figure out what to do with it - case $func_normal_abspath_tcomponent in - "") - # Trailing empty path component, ignore it. - ;; - ..) - # Parent dir; strip last assembled component from result. - func_dirname "$func_normal_abspath_result" - func_normal_abspath_result=$func_dirname_result - ;; - *) - # Actual path component, append it. - func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent - ;; - esac - done - # Restore leading double-slash if one was found on entry. - func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result -} - -# func_relative_path SRCDIR DSTDIR -# generates a relative path from SRCDIR to DSTDIR, with a trailing -# slash if non-empty, suitable for immediately appending a filename -# without needing to append a separator. -# value returned in "$func_relative_path_result" -func_relative_path () -{ - func_relative_path_result= - func_normal_abspath "$1" - func_relative_path_tlibdir=$func_normal_abspath_result - func_normal_abspath "$2" - func_relative_path_tbindir=$func_normal_abspath_result - - # Ascend the tree starting from libdir - while :; do - # check if we have found a prefix of bindir - case $func_relative_path_tbindir in - $func_relative_path_tlibdir) - # found an exact match - func_relative_path_tcancelled= - break - ;; - $func_relative_path_tlibdir*) - # found a matching prefix - func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" - func_relative_path_tcancelled=$func_stripname_result - if test -z "$func_relative_path_result"; then - func_relative_path_result=. - fi - break - ;; - *) - func_dirname $func_relative_path_tlibdir - func_relative_path_tlibdir=${func_dirname_result} - if test "x$func_relative_path_tlibdir" = x ; then - # Have to descend all the way to the root! - func_relative_path_result=../$func_relative_path_result - func_relative_path_tcancelled=$func_relative_path_tbindir - break - fi - func_relative_path_result=../$func_relative_path_result - ;; - esac - done - - # Now calculate path; take care to avoid doubling-up slashes. - func_stripname '' '/' "$func_relative_path_result" - func_relative_path_result=$func_stripname_result - func_stripname '/' '/' "$func_relative_path_tcancelled" - if test "x$func_stripname_result" != x ; then - func_relative_path_result=${func_relative_path_result}/${func_stripname_result} - fi - - # Normalisation. If bindir is libdir, return empty string, - # else relative path ending with a slash; either way, target - # file name can be directly appended. - if test ! -z "$func_relative_path_result"; then - func_stripname './' '' "$func_relative_path_result/" - func_relative_path_result=$func_stripname_result - fi -} - -# The name of this program: -func_dirname_and_basename "$progpath" -progname=$func_basename_result - -# Make sure we have an absolute path for reexecution: -case $progpath in - [\\/]*|[A-Za-z]:\\*) ;; - *[\\/]*) - progdir=$func_dirname_result - progdir=`cd "$progdir" && pwd` - progpath="$progdir/$progname" - ;; - *) - save_IFS="$IFS" - IFS=: - for progdir in $PATH; do - IFS="$save_IFS" - test -x "$progdir/$progname" && break - done - IFS="$save_IFS" - test -n "$progdir" || progdir=`pwd` - progpath="$progdir/$progname" - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Re-`\' parameter expansions in output of double_quote_subst that were -# `\'-ed in input to the same. If an odd number of `\' preceded a '$' -# in input to double_quote_subst, that '$' was protected from expansion. -# Since each input `\' is now two `\'s, look for any number of runs of -# four `\'s followed by two `\'s and then a '$'. `\' that '$'. -bs='\\' -bs2='\\\\' -bs4='\\\\\\\\' -dollar='\$' -sed_double_backslash="\ - s/$bs4/&\\ -/g - s/^$bs2$dollar/$bs&/ - s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g - s/\n//g" - -# Standard options: -opt_dry_run=false -opt_help=false -opt_quiet=false -opt_verbose=false -opt_warning=: - -# func_echo arg... -# Echo program name prefixed message, along with the current mode -# name if it has been set yet. -func_echo () -{ - $ECHO "$progname${mode+: }$mode: $*" -} - -# func_verbose arg... -# Echo program name prefixed message in verbose mode only. -func_verbose () -{ - $opt_verbose && func_echo ${1+"$@"} - - # A bug in bash halts the script if the last line of a function - # fails when set -e is in force, so we need another command to - # work around that: - : -} - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -# func_error arg... -# Echo program name prefixed message to standard error. -func_error () -{ - $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2 -} - -# func_warning arg... -# Echo program name prefixed warning message to standard error. -func_warning () -{ - $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2 - - # bash bug again: - : -} - -# func_fatal_error arg... -# Echo program name prefixed message to standard error, and exit. -func_fatal_error () -{ - func_error ${1+"$@"} - exit $EXIT_FAILURE -} - -# func_fatal_help arg... -# Echo program name prefixed message to standard error, followed by -# a help hint, and exit. -func_fatal_help () -{ - func_error ${1+"$@"} - func_fatal_error "$help" -} -help="Try \`$progname --help' for more information." ## default - - -# func_grep expression filename -# Check whether EXPRESSION matches any line of FILENAME, without output. -func_grep () -{ - $GREP "$1" "$2" >/dev/null 2>&1 -} - - -# func_mkdir_p directory-path -# Make sure the entire path to DIRECTORY-PATH is available. -func_mkdir_p () -{ - my_directory_path="$1" - my_dir_list= - - if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then - - # Protect directory names starting with `-' - case $my_directory_path in - -*) my_directory_path="./$my_directory_path" ;; - esac - - # While some portion of DIR does not yet exist... - while test ! -d "$my_directory_path"; do - # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. - my_dir_list="$my_directory_path:$my_dir_list" - - # If the last portion added has no slash in it, the list is done - case $my_directory_path in */*) ;; *) break ;; esac - - # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` - done - my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` - - save_mkdir_p_IFS="$IFS"; IFS=':' - for my_dir in $my_dir_list; do - IFS="$save_mkdir_p_IFS" - # mkdir can fail with a `File exist' error if two processes - # try to create one of the directories concurrently. Don't - # stop in that case! - $MKDIR "$my_dir" 2>/dev/null || : - done - IFS="$save_mkdir_p_IFS" - - # Bail out if we (or some other process) failed to create a directory. - test -d "$my_directory_path" || \ - func_fatal_error "Failed to create \`$1'" - fi -} - - -# func_mktempdir [string] -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. -func_mktempdir () -{ - my_template="${TMPDIR-/tmp}/${1-$progname}" - - if test "$opt_dry_run" = ":"; then - # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" - else - - # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` - - if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" - - save_mktempdir_umask=`umask` - umask 0077 - $MKDIR "$my_tmpdir" - umask $save_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || \ - func_fatal_error "cannot create temporary directory \`$my_tmpdir'" - fi - - $ECHO "$my_tmpdir" -} - - -# func_quote_for_eval arg -# Aesthetically quote ARG to be evaled later. -# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT -# is double-quoted, suitable for a subsequent eval, whereas -# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters -# which are still active within double quotes backslashified. -func_quote_for_eval () -{ - case $1 in - *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; - *) - func_quote_for_eval_unquoted_result="$1" ;; - esac - - case $func_quote_for_eval_unquoted_result in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and and variable - # expansion for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" - ;; - *) - func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" - esac -} - - -# func_quote_for_expand arg -# Aesthetically quote ARG to be evaled later; same as above, -# but do not quote variable references. -func_quote_for_expand () -{ - case $1 in - *[\\\`\"]*) - my_arg=`$ECHO "$1" | $SED \ - -e "$double_quote_subst" -e "$sed_double_backslash"` ;; - *) - my_arg="$1" ;; - esac - - case $my_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting and command substitution for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - my_arg="\"$my_arg\"" - ;; - esac - - func_quote_for_expand_result="$my_arg" -} - - -# func_show_eval cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. -func_show_eval () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$my_cmd" - my_status=$? - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - -# func_show_eval_locale cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. Use the saved locale for evaluation. -func_show_eval_locale () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$lt_user_locale - $my_cmd" - my_status=$? - eval "$lt_safe_locale" - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - -# func_version -# Echo version message to standard output and exit. -func_version () -{ - $SED -n '/(C)/!b go - :more - /\./!{ - N - s/\n# / / - b more - } - :go - /^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# // - s/^# *$// - s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ - p - }' < "$progpath" - exit $? -} - -# func_usage -# Echo short help message to standard output and exit. -func_usage () -{ - $SED -n '/^# Usage:/,/^# *.*--help/ { - s/^# // - s/^# *$// - s/\$progname/'$progname'/ - p - }' < "$progpath" - echo - $ECHO "run \`$progname --help | more' for full usage" - exit $? -} - -# func_help [NOEXIT] -# Echo long help message to standard output and exit, -# unless 'noexit' is passed as argument. -func_help () -{ - $SED -n '/^# Usage:/,/# Report bugs to/ { - s/^# // - s/^# *$// - s*\$progname*'$progname'* - s*\$host*'"$host"'* - s*\$SHELL*'"$SHELL"'* - s*\$LTCC*'"$LTCC"'* - s*\$LTCFLAGS*'"$LTCFLAGS"'* - s*\$LD*'"$LD"'* - s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ - p - }' < "$progpath" - ret=$? - if test -z "$1"; then - exit $ret - fi -} - -# func_missing_arg argname -# Echo program name prefixed message to standard error and set global -# exit_cmd. -func_missing_arg () -{ - func_error "missing argument for $1." - exit_cmd=exit -} - -exit_cmd=: - - - - - - -magic="%%%MAGIC variable%%%" -magic_exe="%%%MAGIC EXE variable%%%" - -# Global variables. -# $mode is unset -nonopt= -execute_dlfiles= -preserve_args= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" -extracted_archives= -extracted_serial=0 - -opt_dry_run=false -opt_duplicate_deps=false -opt_silent=false -opt_debug=: - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -# func_fatal_configuration arg... -# Echo program name prefixed message to standard error, followed by -# a configuration failure hint, and exit. -func_fatal_configuration () -{ - func_error ${1+"$@"} - func_error "See the $PACKAGE documentation for more information." - func_fatal_error "Fatal configuration error." -} - - -# func_config -# Display the configuration for all the tags in this script. -func_config () -{ - re_begincf='^# ### BEGIN LIBTOOL' - re_endcf='^# ### END LIBTOOL' - - # Default configuration. - $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" - - # Now print the configurations for the tags. - for tagname in $taglist; do - $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" - done - - exit $? -} - -# func_features -# Display the features supported by this script. -func_features () -{ - echo "host: $host" - if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" - else - echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - echo "enable static libraries" - else - echo "disable static libraries" - fi - - exit $? -} - -# func_enable_tag tagname -# Verify that TAGNAME is valid, and either flag an error and exit, or -# enable the TAGNAME tag. We also add TAGNAME to the global $taglist -# variable here. -func_enable_tag () -{ - # Global variable: - tagname="$1" - - re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" - re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" - sed_extractcf="/$re_begincf/,/$re_endcf/p" - - # Validate tagname. - case $tagname in - *[!-_A-Za-z0-9,/]*) - func_fatal_error "invalid tag name: $tagname" - ;; - esac - - # Don't test for the "default" C tag, as we know it's - # there but not specially marked. - case $tagname in - CC) ;; - *) - if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then - taglist="$taglist $tagname" - - # Evaluate the configuration. Be careful to quote the path - # and the sed script, to avoid splitting on whitespace, but - # also don't use non-portable quotes within backquotes within - # quotes we have to do it in 2 steps: - extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` - eval "$extractedcf" - else - func_error "ignoring unknown tag $tagname" - fi - ;; - esac -} - -# Parse options once, thoroughly. This comes as soon as possible in -# the script to make things like `libtool --version' happen quickly. -{ - - # Shorthand for --mode=foo, only valid as the first argument - case $1 in - clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; - compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; - execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; - finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; - install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; - link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; - uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; - esac - - # Parse non-mode specific arguments: - while test "$#" -gt 0; do - opt="$1" - shift - - case $opt in - --config) func_config ;; - - --debug) preserve_args="$preserve_args $opt" - func_echo "enabling shell trace mode" - opt_debug='set -x' - $opt_debug - ;; - - -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break - execute_dlfiles="$execute_dlfiles $1" - shift - ;; - - --dry-run | -n) opt_dry_run=: ;; - --features) func_features ;; - --finish) mode="finish" ;; - - --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break - case $1 in - # Valid mode arguments: - clean) ;; - compile) ;; - execute) ;; - finish) ;; - install) ;; - link) ;; - relink) ;; - uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; - esac - - mode="$1" - shift - ;; - - --preserve-dup-deps) - opt_duplicate_deps=: ;; - - --quiet|--silent) preserve_args="$preserve_args $opt" - opt_silent=: - opt_verbose=false - ;; - - --no-quiet|--no-silent) - preserve_args="$preserve_args $opt" - opt_silent=false - ;; - - --verbose| -v) preserve_args="$preserve_args $opt" - opt_silent=false - opt_verbose=: - ;; - - --no-verbose) preserve_args="$preserve_args $opt" - opt_verbose=false - ;; - - --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break - preserve_args="$preserve_args $opt $1" - func_enable_tag "$1" # tagname is set here - shift - ;; - - # Separate optargs to long options: - -dlopen=*|--mode=*|--tag=*) - func_opt_split "$opt" - set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"} - shift - ;; - - -\?|-h) func_usage ;; - --help) opt_help=: ;; - --help-all) opt_help=': help-all' ;; - --version) func_version ;; - - -*) func_fatal_help "unrecognized option \`$opt'" ;; - - *) nonopt="$opt" - break - ;; - esac - done - - - case $host in - *cygwin* | *mingw* | *pw32* | *cegcc*) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: - ;; - *) - opt_duplicate_compiler_generated_deps=$opt_duplicate_deps - ;; - esac - - # Having warned about all mis-specified options, bail out if - # anything was wrong. - $exit_cmd $EXIT_FAILURE -} - -# func_check_version_match -# Ensure that we are using m4 macros, and libtool script from the same -# release of libtool. -func_check_version_match () -{ - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from an older release. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - fi - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, -$progname: but the definition of this LT_INIT comes from revision $macro_revision. -$progname: You should recreate aclocal.m4 with macros from revision $package_revision -$progname: of $PACKAGE $VERSION and run autoconf again. -_LT_EOF - fi - - exit $EXIT_MISMATCH - fi -} - - -## ----------- ## -## Main. ## -## ----------- ## - -$opt_help || { - # Sanity checks first: - func_check_version_match - - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi - - test -z "$mode" && func_fatal_error "error: you must specify a MODE." - - - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" - - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$mode' for more information." -} - - -# func_lalib_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_lalib_p () -{ - test -f "$1" && - $SED -e 4q "$1" 2>/dev/null \ - | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 -} - -# func_lalib_unsafe_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function implements the same check as func_lalib_p without -# resorting to external programs. To this end, it redirects stdin and -# closes it afterwards, without saving the original file descriptor. -# As a safety measure, use it only where a negative result would be -# fatal anyway. Works if `file' does not exist. -func_lalib_unsafe_p () -{ - lalib_p=no - if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then - for lalib_p_l in 1 2 3 4 - do - read lalib_p_line - case "$lalib_p_line" in - \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; - esac - done - exec 0<&5 5<&- - fi - test "$lalib_p" = yes -} - -# func_ltwrapper_script_p file -# True iff FILE is a libtool wrapper script -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_script_p () -{ - func_lalib_p "$1" -} - -# func_ltwrapper_executable_p file -# True iff FILE is a libtool wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_executable_p () -{ - func_ltwrapper_exec_suffix= - case $1 in - *.exe) ;; - *) func_ltwrapper_exec_suffix=.exe ;; - esac - $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 -} - -# func_ltwrapper_scriptname file -# Assumes file is an ltwrapper_executable -# uses $file to determine the appropriate filename for a -# temporary ltwrapper_script. -func_ltwrapper_scriptname () -{ - func_ltwrapper_scriptname_result="" - if func_ltwrapper_executable_p "$1"; then - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" - fi -} - -# func_ltwrapper_p file -# True iff FILE is a libtool wrapper script or wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_p () -{ - func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" -} - - -# func_execute_cmds commands fail_cmd -# Execute tilde-delimited COMMANDS. -# If FAIL_CMD is given, eval that upon failure. -# FAIL_CMD may read-access the current command in variable CMD! -func_execute_cmds () -{ - $opt_debug - save_ifs=$IFS; IFS='~' - for cmd in $1; do - IFS=$save_ifs - eval cmd=\"$cmd\" - func_show_eval "$cmd" "${2-:}" - done - IFS=$save_ifs -} - - -# func_source file -# Source FILE, adding directory component if necessary. -# Note that it is not necessary on cygwin/mingw to append a dot to -# FILE even if both FILE and FILE.exe exist: automatic-append-.exe -# behavior happens only for exec(3), not for open(2)! Also, sourcing -# `FILE.' does not work on cygwin managed mounts. -func_source () -{ - $opt_debug - case $1 in - */* | *\\*) . "$1" ;; - *) . "./$1" ;; - esac -} - - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () -{ - $opt_debug - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - func_quote_for_eval "$arg" - CC_quoted="$CC_quoted $func_quote_for_eval_result" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case "$@ " in - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - func_echo "unable to infer tagged configuration" - func_fatal_error "specify a tag with \`--tag'" -# else -# func_verbose "using $tagname tagged configuration" - fi - ;; - esac - fi -} - - - -# func_write_libtool_object output_name pic_name nonpic_name -# Create a libtool object file (analogous to a ".la" file), -# but don't create it if we're doing a dry run. -func_write_libtool_object () -{ - write_libobj=${1} - if test "$build_libtool_libs" = yes; then - write_lobj=\'${2}\' - else - write_lobj=none - fi - - if test "$build_old_libs" = yes; then - write_oldobj=\'${3}\' - else - write_oldobj=none - fi - - $opt_dry_run || { - cat >${write_libobj}T <?"'"'"' &()|`$[]' \ - && func_warning "libobj name \`$libobj' may not contain shell special characters." - func_dirname_and_basename "$obj" "/" "" - objname="$func_basename_result" - xdir="$func_dirname_result" - lobj=${xdir}$objdir/$objname - - test -z "$base_compile" && \ - func_fatal_help "you must specify a compilation command" - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2* | cegcc*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $ECHO "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - removelist="$removelist $output_obj" - $ECHO "$srcfile" > "$lockfile" - fi - - $opt_dry_run || $RM $removelist - removelist="$removelist $lockfile" - trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - - if test -n "$fix_srcfile_path"; then - eval srcfile=\"$fix_srcfile_path\" - fi - func_quote_for_eval "$srcfile" - qsrcfile=$func_quote_for_eval_result - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" - else - # Don't build PIC code - command="$base_compile $qsrcfile" - fi - - func_mkdir_p "$xdir$objdir" - - if test -z "$output_obj"; then - # Place PIC objects in $objdir - command="$command -o $lobj" - fi - - func_show_eval_locale "$command" \ - 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - func_show_eval '$MV "$output_obj" "$lobj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - - # Allow error messages only from the first compilation. - if test "$suppress_opt" = yes; then - suppress_output=' >/dev/null 2>&1' - fi - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then - # Don't build PIC code - command="$base_compile $qsrcfile$pie_flag" - else - command="$base_compile $qsrcfile $pic_flag" - fi - if test "$compiler_c_o" = yes; then - command="$command -o $obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - command="$command$suppress_output" - func_show_eval_locale "$command" \ - '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - func_show_eval '$MV "$output_obj" "$obj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - fi - - $opt_dry_run || { - func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - removelist=$lockfile - $RM "$lockfile" - fi - } - - exit $EXIT_SUCCESS -} - -$opt_help || { - test "$mode" = compile && func_mode_compile ${1+"$@"} -} - -func_mode_help () -{ - # We need to display help for each of the modes. - case $mode in - "") - # Generic help is extracted from the usage comments - # at the start of this file. - func_help - ;; - - clean) - $ECHO \ -"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - - compile) - $ECHO \ -"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -no-suppress do not suppress compiler output for multiple passes - -prefer-pic try to build PIC objects only - -prefer-non-pic try to build non-PIC objects only - -shared do not build a \`.o' file suitable for static linking - -static only build a \`.o' file suitable for static linking - -Wc,FLAG pass FLAG directly to the compiler - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - - execute) - $ECHO \ -"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - - finish) - $ECHO \ -"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - - install) - $ECHO \ -"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The following components of INSTALL-COMMAND are treated specially: - - -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - - link) - $ECHO \ -"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -bindir BINDIR specify path to binaries directory (for systems where - libraries must be found in the PATH setting at runtime) - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -shared only do dynamic linking of libtool libraries - -shrext SUFFIX override the standard shared library file extension - -static do not do any dynamic linking of uninstalled libtool libraries - -static-libtool-libs - do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -weak LIBNAME declare that the target provides the LIBNAME interface - -Wc,FLAG - -Xcompiler FLAG pass linker-specific FLAG directly to the compiler - -Wl,FLAG - -Xlinker FLAG pass linker-specific FLAG directly to the linker - -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - - uninstall) - $ECHO \ -"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - - *) - func_fatal_help "invalid operation mode \`$mode'" - ;; - esac - - echo - $ECHO "Try \`$progname --help' for more information about other modes." -} - -# Now that we've collected a possible --mode arg, show help if necessary -if $opt_help; then - if test "$opt_help" = :; then - func_mode_help - else - { - func_help noexit - for mode in compile link execute install finish uninstall clean; do - func_mode_help - done - } | sed -n '1p; 2,$s/^Usage:/ or: /p' - { - func_help noexit - for mode in compile link execute install finish uninstall clean; do - echo - func_mode_help - done - } | - sed '1d - /^When reporting/,/^Report/{ - H - d - } - $x - /information about other modes/d - /more detailed .*MODE/d - s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' - fi - exit $? -fi - - -# func_mode_execute arg... -func_mode_execute () -{ - $opt_debug - # The first argument is the command name. - cmd="$nonopt" - test -z "$cmd" && \ - func_fatal_help "you must specify a COMMAND" - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - test -f "$file" \ - || func_fatal_help "\`$file' is not a file" - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$lib' is not a valid libtool archive" - - # Read the libtool library. - dlname= - library_names= - func_source "$file" - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && \ - func_warning "\`$file' was not linked with \`-export-dynamic'" - continue - fi - - func_dirname "$file" "" "." - dir="$func_dirname_result" - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - if test ! -f "$dir/$dlname"; then - func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" - fi - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - func_dirname "$file" "" "." - dir="$func_dirname_result" - ;; - - *) - func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -* | *.la | *.lo ) ;; - *) - # Do a test to see if this is really a libtool program. - if func_ltwrapper_script_p "$file"; then - func_source "$file" - # Transform arg to wrapped name. - file="$progdir/$program" - elif func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - func_source "$func_ltwrapper_scriptname_result" - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - func_quote_for_eval "$file" - args="$args $func_quote_for_eval_result" - done - - if test "X$opt_dry_run" = Xfalse; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES - do - eval "if test \"\${save_$lt_var+set}\" = set; then - $lt_var=\$save_$lt_var; export $lt_var - else - $lt_unset $lt_var - fi" - done - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - echo "export $shlibpath_var" - fi - $ECHO "$cmd$args" - exit $EXIT_SUCCESS - fi -} - -test "$mode" = execute && func_mode_execute ${1+"$@"} - - -# func_mode_finish arg... -func_mode_finish () -{ - $opt_debug - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - func_execute_cmds "$finish_cmds" 'admincmds="$admincmds -'"$cmd"'"' - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - $opt_silent && exit $EXIT_SUCCESS - - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" - for libdir in $libdirs; do - $ECHO " $libdir" - done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" - fi - if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $ECHO " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $ECHO " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - echo - - echo "See any operating system documentation about shared libraries for" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" - echo "pages." - ;; - *) - echo "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - echo "----------------------------------------------------------------------" - exit $EXIT_SUCCESS -} - -test "$mode" = finish && func_mode_finish ${1+"$@"} - - -# func_mode_install arg... -func_mode_install () -{ - $opt_debug - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - case $nonopt in *shtool*) :;; *) false;; esac; then - # Aesthetically quote it. - func_quote_for_eval "$nonopt" - install_prog="$func_quote_for_eval_result " - arg=$1 - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - func_quote_for_eval "$arg" - install_prog="$install_prog$func_quote_for_eval_result" - install_shared_prog=$install_prog - case " $install_prog " in - *[\\\ /]cp\ *) install_cp=: ;; - *) install_cp=false ;; - esac - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - no_mode=: - for arg - do - arg2= - if test -n "$dest"; then - files="$files $dest" - dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) - if $install_cp; then :; else - prev=$arg - fi - ;; - -g | -m | -o) - prev=$arg - ;; - -s) - stripme=" -s" - continue - ;; - -*) - ;; - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - if test "x$prev" = x-m && test -n "$install_override_mode"; then - arg2=$install_override_mode - no_mode=false - fi - prev= - else - dest=$arg - continue - fi - ;; - esac - - # Aesthetically quote the argument. - func_quote_for_eval "$arg" - install_prog="$install_prog $func_quote_for_eval_result" - if test -n "$arg2"; then - func_quote_for_eval "$arg2" - fi - install_shared_prog="$install_shared_prog $func_quote_for_eval_result" - done - - test -z "$install_prog" && \ - func_fatal_help "you must specify an install program" - - test -n "$prev" && \ - func_fatal_help "the \`$prev' option requires an argument" - - if test -n "$install_override_mode" && $no_mode; then - if $install_cp; then :; else - func_quote_for_eval "$install_override_mode" - install_shared_prog="$install_shared_prog -m $func_quote_for_eval_result" - fi - fi - - if test -z "$files"; then - if test -z "$dest"; then - func_fatal_help "no file or destination specified" - else - func_fatal_help "you must specify a destination" - fi - fi - - # Strip any trailing slash from the destination. - func_stripname '' '/' "$dest" - dest=$func_stripname_result - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - func_dirname_and_basename "$dest" "" "." - destdir="$func_dirname_result" - destname="$func_basename_result" - - # Not a directory, so check to see that there is only one file specified. - set dummy $files; shift - test "$#" -gt 1 && \ - func_fatal_help "\`$dest' is not a directory" - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - func_fatal_help "\`$destdir' must be an absolute directory name" - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$file' is not a valid libtool archive" - - library_names= - old_library= - relink_command= - func_source "$file" - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - func_dirname "$file" "/" "" - dir="$func_dirname_result" - dir="$dir$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - test "$inst_prefix_dir" = "$destdir" && \ - func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - func_warning "relinking \`$file'" - func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' - fi - - # See the names of the shared library. - set dummy $library_names; shift - if test -n "$1"; then - realname="$1" - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ - 'exit $?' - tstripme="$stripme" - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - case $realname in - *.dll.a) - tstripme="" - ;; - esac - ;; - esac - if test -n "$tstripme" && test -n "$striplib"; then - func_show_eval "$striplib $destdir/$realname" 'exit $?' - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on - # the symlink we replace! Solaris /bin/ln does not understand -f, - # so we also need to try rm && ln -s. - for linkname - do - test "$linkname" != "$realname" \ - && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - func_execute_cmds "$postinstall_cmds" 'exit $?' - fi - - # Install the pseudo-library for information purposes. - func_basename "$file" - name="$func_basename_result" - instname="$dir/$name"i - func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - func_lo2o "$destfile" - staticdest=$func_lo2o_result - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - func_fatal_help "cannot copy a libtool object to \`$destfile'" - ;; - esac - - # Install the libtool object if requested. - test -n "$destfile" && \ - func_show_eval "$install_prog $file $destfile" 'exit $?' - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - func_lo2o "$file" - staticobj=$func_lo2o_result - func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - func_stripname '' '.exe' "$file" - file=$func_stripname_result - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin* | *mingw*) - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - wrapper=$func_ltwrapper_scriptname_result - else - func_stripname '' '.exe' "$file" - wrapper=$func_stripname_result - fi - ;; - *) - wrapper=$file - ;; - esac - if func_ltwrapper_script_p "$wrapper"; then - notinst_deplibs= - relink_command= - - func_source "$wrapper" - - # Check the variables that should have been set. - test -z "$generated_by_libtool_version" && \ - func_fatal_error "invalid libtool wrapper script \`$wrapper'" - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - func_source "$lib" - fi - libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - func_warning "\`$lib' has not been installed in \`$libdir'" - finalize=no - fi - done - - relink_command= - func_source "$wrapper" - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - $opt_dry_run || { - if test "$finalize" = yes; then - tmpdir=`func_mktempdir` - func_basename "$file$stripped_ext" - file="$func_basename_result" - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` - - $opt_silent || { - func_quote_for_expand "$relink_command" - eval "func_echo $func_quote_for_expand_result" - } - if eval "$relink_command"; then : - else - func_error "error: relink \`$file' with the above command before installing it" - $opt_dry_run || ${RM}r "$tmpdir" - continue - fi - file="$outputname" - else - func_warning "cannot relink \`$file'" - fi - } - else - # Install the binary that we compiled earlier. - file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyway - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - func_stripname '' '.exe' "$destfile" - destfile=$func_stripname_result - ;; - esac - ;; - esac - func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' - $opt_dry_run || if test -n "$outputname"; then - ${RM}r "$tmpdir" - fi - ;; - esac - done - - for file in $staticlibs; do - func_basename "$file" - name="$func_basename_result" - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - func_show_eval "$install_prog \$file \$oldlib" 'exit $?' - - if test -n "$stripme" && test -n "$old_striplib"; then - func_show_eval "$old_striplib $oldlib" 'exit $?' - fi - - # Do each command in the postinstall commands. - func_execute_cmds "$old_postinstall_cmds" 'exit $?' - done - - test -n "$future_libdirs" && \ - func_warning "remember to run \`$progname --finish$future_libdirs'" - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - $opt_dry_run && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi -} - -test "$mode" = install && func_mode_install ${1+"$@"} - - -# func_generate_dlsyms outputname originator pic_p -# Extract symbols from dlprefiles and create ${outputname}S.o with -# a dlpreopen symbol table. -func_generate_dlsyms () -{ - $opt_debug - my_outputname="$1" - my_originator="$2" - my_pic_p="${3-no}" - my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` - my_dlsyms= - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - my_dlsyms="${my_outputname}S.c" - else - func_error "not configured to extract global symbols from dlpreopened files" - fi - fi - - if test -n "$my_dlsyms"; then - case $my_dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${my_outputname}.nm" - - func_show_eval "$RM $nlist ${nlist}S ${nlist}T" - - # Parse the name list into a source file. - func_verbose "creating $output_objdir/$my_dlsyms" - - $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ -/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ -/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) -#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" -#endif - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - func_verbose "generating symbol list for \`$output'" - - $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` - for progfile in $progfiles; do - func_verbose "extracting global C symbols from \`$progfile'" - $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $opt_dry_run || { - eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - if test -n "$export_symbols_regex"; then - $opt_dry_run || { - eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $opt_dry_run || { - $RM $export_symbols - eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' - ;; - esac - } - else - $opt_dry_run || { - eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' - ;; - esac - } - fi - fi - - for dlprefile in $dlprefiles; do - func_verbose "extracting global C symbols from \`$dlprefile'" - func_basename "$dlprefile" - name="$func_basename_result" - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - done - - $opt_dry_run || { - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $MV "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if $GREP -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - $GREP -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' - else - echo '/* NONE */' >> "$output_objdir/$my_dlsyms" - fi - - echo >> "$output_objdir/$my_dlsyms" "\ - -/* The mapping between symbol names and symbols. */ -typedef struct { - const char *name; - void *address; -} lt_dlsymlist; -" - case $host in - *cygwin* | *mingw* | *cegcc* ) - echo >> "$output_objdir/$my_dlsyms" "\ -/* DATA imports from DLLs on WIN32 con't be const, because - runtime relocations are performed -- see ld's documentation - on pseudo-relocs. */" - lt_dlsym_const= ;; - *osf5*) - echo >> "$output_objdir/$my_dlsyms" "\ -/* This system does not cope well with relocations in const data */" - lt_dlsym_const= ;; - *) - lt_dlsym_const=const ;; - esac - - echo >> "$output_objdir/$my_dlsyms" "\ -extern $lt_dlsym_const lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[]; -$lt_dlsym_const lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[] = -{\ - { \"$my_originator\", (void *) 0 }," - - case $need_lib_prefix in - no) - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - *) - eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - esac - echo >> "$output_objdir/$my_dlsyms" "\ - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_${my_prefix}_LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - } # !$opt_dry_run - - pic_flag_for_symtable= - case "$compile_command " in - *" -static "*) ;; - *) - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; - *-*-hpux*) - pic_flag_for_symtable=" $pic_flag" ;; - *) - if test "X$my_pic_p" != Xno; then - pic_flag_for_symtable=" $pic_flag" - fi - ;; - esac - ;; - esac - symtab_cflags= - for arg in $LTCFLAGS; do - case $arg in - -pie | -fpie | -fPIE) ;; - *) symtab_cflags="$symtab_cflags $arg" ;; - esac - done - - # Now compile the dynamic symbol file. - func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' - - # Clean up the generated files. - func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' - - # Transform the symbol file into the correct name. - symfileobj="$output_objdir/${my_outputname}S.$objext" - case $host in - *cygwin* | *mingw* | *cegcc* ) - if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - else - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - fi - ;; - *) - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - ;; - esac - ;; - *) - func_fatal_error "unknown suffix for \`$my_dlsyms'" - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` - fi -} - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -# Despite the name, also deal with 64 bit binaries. -func_win32_libid () -{ - $opt_debug - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then - win32_nmres=`eval $NM -f posix -A $1 | - $SED -n -e ' - 1,100{ - / I /{ - s,.*,import, - p - q - } - }'` - case $win32_nmres in - import*) win32_libid_type="x86 archive import";; - *) win32_libid_type="x86 archive static";; - esac - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $ECHO "$win32_libid_type" -} - - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - $opt_debug - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - if test "$lock_old_archive_extraction" = yes; then - lockfile=$f_ex_an_ar_oldlib.lock - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - fi - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ - 'stat=$?; rm -f "$lockfile"; exit $stat' - if test "$lock_old_archive_extraction" = yes; then - $opt_dry_run || rm -f "$lockfile" - fi - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : - else - func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" - fi -} - - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - $opt_debug - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - func_basename "$my_xlib" - my_xlib="$func_basename_result" - my_xlib_u=$my_xlib - while :; do - case " $extracted_archives " in - *" $my_xlib_u "*) - func_arith $extracted_serial + 1 - extracted_serial=$func_arith_result - my_xlib_u=lt$extracted_serial-$my_xlib ;; - *) break ;; - esac - done - extracted_archives="$extracted_archives $my_xlib_u" - my_xdir="$my_gentop/$my_xlib_u" - - func_mkdir_p "$my_xdir" - - case $host in - *-darwin*) - func_verbose "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - $opt_dry_run || { - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`basename "$darwin_archive"` - darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` - if test -n "$darwin_arches"; then - darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we've a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` - $LIPO -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - $RM -rf unfat-$$ - cd "$darwin_orig_dir" - else - cd $darwin_orig_dir - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - } # !$opt_dry_run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` - done - - func_extract_archives_result="$my_oldobjs" -} - - -# func_emit_wrapper [arg=no] -# -# Emit a libtool wrapper script on stdout. -# Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw -# wrapper executable. Must ONLY be called from within -# func_mode_link because it depends on a number of variables -# set therein. -# -# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR -# variable will take. If 'yes', then the emitted script -# will assume that the directory in which it is stored is -# the $objdir directory. This is a cygwin/mingw-specific -# behavior. -func_emit_wrapper () -{ - func_emit_wrapper_arg1=${1-no} - - $ECHO "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='$sed_quote_subst' - -# Be Bourne compatible -if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: - generated_by_libtool_version='$macro_version' - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$ECHO are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - file=\"\$0\"" - - qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` - $ECHO "\ - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - ECHO=\"$qECHO\" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string "--lt-" -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's $0 value, followed by "$@". -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=\$0 - shift - for lt_opt - do - case \"\$lt_opt\" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` - test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. - lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` - cat \"\$lt_dump_D/\$lt_dump_F\" - exit 0 - ;; - --lt-*) - \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n \"\$lt_option_debug\"; then - echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" - lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from \$@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - for lt_wr_arg - do - case \$lt_wr_arg in - --lt-*) ;; - *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; - esac - shift - done - func_exec_program_core \${1+\"\$@\"} -} - - # Parse options - func_parse_lt_options \"\$0\" \${1+\"\$@\"} - - # Find the directory that this script lives in. - thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 - if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then - # special case for '.' - if test \"\$thisdir\" = \".\"; then - thisdir=\`pwd\` - fi - # remove .libs from thisdir - case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; - $objdir ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $ECHO "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $MKDIR \"\$progdir\" - else - $RM \"\$progdir/\$file\" - fi" - - $ECHO "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $ECHO \"\$relink_command_output\" >&2 - $RM \"\$progdir/\$file\" - exit 1 - fi - fi - - $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $RM \"\$progdir/\$program\"; - $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $RM \"\$progdir/\$file\" - fi" - else - $ECHO "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $ECHO "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $ECHO "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $ECHO "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. - func_exec_program \${1+\"\$@\"} - fi - else - # The program doesn't exist. - \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 - \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" -} - - -# func_to_host_path arg -# -# Convert paths to host format when used with build tools. -# Intended for use with "native" mingw (where libtool itself -# is running under the msys shell), or in the following cross- -# build environments: -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# where wine is equipped with the `winepath' executable. -# In the native mingw case, the (msys) shell automatically -# converts paths for any non-msys applications it launches, -# but that facility isn't available from inside the cwrapper. -# Similar accommodations are necessary for $host mingw and -# $build cygwin. Calling this function does no harm for other -# $host/$build combinations not listed above. -# -# ARG is the path (on $build) that should be converted to -# the proper representation for $host. The result is stored -# in $func_to_host_path_result. -func_to_host_path () -{ - func_to_host_path_result="$1" - if test -n "$1"; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - case $build in - *mingw* ) # actually, msys - # awkward: cmd appends spaces to result - func_to_host_path_result=`( cmd //c echo "$1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_path_result=`cygpath -w "$1" | - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # Unfortunately, winepath does not exit with a non-zero - # error code, so we are forced to check the contents of - # stdout. On the other hand, if the command is not - # found, the shell will set an exit code of 127 and print - # *an error message* to stdout. So we must check for both - # error code of zero AND non-empty stdout, which explains - # the odd construction: - func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null` - if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then - func_to_host_path_result=`$ECHO "$func_to_host_path_tmp1" | - $SED -e "$lt_sed_naive_backslashify"` - else - # Allow warning below. - func_to_host_path_result= - fi - ;; - esac - if test -z "$func_to_host_path_result" ; then - func_error "Could not determine host path corresponding to" - func_error " \`$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_path_result="$1" - fi - ;; - esac - fi -} -# end: func_to_host_path - -# func_to_host_pathlist arg -# -# Convert pathlists to host format when used with build tools. -# See func_to_host_path(), above. This function supports the -# following $build/$host combinations (but does no harm for -# combinations not listed here): -# $build $host -# mingw (msys) mingw [e.g. native] -# cygwin mingw -# *nix + wine mingw -# -# Path separators are also converted from $build format to -# $host format. If ARG begins or ends with a path separator -# character, it is preserved (but converted to $host format) -# on output. -# -# ARG is a pathlist (on $build) that should be converted to -# the proper representation on $host. The result is stored -# in $func_to_host_pathlist_result. -func_to_host_pathlist () -{ - func_to_host_pathlist_result="$1" - if test -n "$1"; then - case $host in - *mingw* ) - lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_pathlist_tmp1=$func_stripname_result - case $build in - *mingw* ) # Actually, msys. - # Awkward: cmd appends spaces to result. - func_to_host_pathlist_result=` - ( cmd //c echo "$func_to_host_pathlist_tmp1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` - ;; - *cygwin* ) - func_to_host_pathlist_result=`cygpath -w -p "$func_to_host_pathlist_tmp1" | - $SED -e "$lt_sed_naive_backslashify"` - ;; - * ) - # unfortunately, winepath doesn't convert pathlists - func_to_host_pathlist_result="" - func_to_host_pathlist_oldIFS=$IFS - IFS=: - for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do - IFS=$func_to_host_pathlist_oldIFS - if test -n "$func_to_host_pathlist_f" ; then - func_to_host_path "$func_to_host_pathlist_f" - if test -n "$func_to_host_path_result" ; then - if test -z "$func_to_host_pathlist_result" ; then - func_to_host_pathlist_result="$func_to_host_path_result" - else - func_append func_to_host_pathlist_result ";$func_to_host_path_result" - fi - fi - fi - done - IFS=$func_to_host_pathlist_oldIFS - ;; - esac - if test -z "$func_to_host_pathlist_result"; then - func_error "Could not determine the host path(s) corresponding to" - func_error " \`$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This may break if $1 contains DOS-style drive - # specifications. The fix is not to complicate the expression - # below, but for the user to provide a working wine installation - # with winepath so that path translation in the cross-to-mingw - # case works properly. - lt_replace_pathsep_nix_to_dos="s|:|;|g" - func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\ - $SED -e "$lt_replace_pathsep_nix_to_dos"` - fi - # Now, add the leading and trailing path separators back - case "$1" in - :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result" - ;; - esac - case "$1" in - *: ) func_append func_to_host_pathlist_result ";" - ;; - esac - ;; - esac - fi -} -# end: func_to_host_pathlist - -# func_emit_cwrapperexe_src -# emit the source code for a wrapper executable on stdout -# Must ONLY be called from within func_mode_link because -# it depends on a number of variable set therein. -func_emit_cwrapperexe_src () -{ - cat < -#include -#ifdef _MSC_VER -# include -# include -# include -#else -# include -# include -# ifdef __CYGWIN__ -# include -# endif -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -/* declarations of non-ANSI functions */ -#if defined(__MINGW32__) -# ifdef __STRICT_ANSI__ -int _putenv (const char *); -# endif -#elif defined(__CYGWIN__) -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif -/* #elif defined (other platforms) ... */ -#endif - -/* portability defines, excluding path handling macros */ -#if defined(_MSC_VER) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -# define S_IXUSR _S_IEXEC -# ifndef _INTPTR_T_DEFINED -# define _INTPTR_T_DEFINED -# define intptr_t int -# endif -#elif defined(__MINGW32__) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -#elif defined(__CYGWIN__) -# define HAVE_SETENV -# define FOPEN_WB "wb" -/* #elif defined (other platforms) ... */ -#endif - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef S_IXOTH -# define S_IXOTH 0 -#endif -#ifndef S_IXGRP -# define S_IXGRP 0 -#endif - -/* path handling portability macros */ -#ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -# define PATH_SEPARATOR ':' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -# define HAVE_DOS_BASED_FILE_SYSTEM -# define FOPEN_WB "wb" -# ifndef DIR_SEPARATOR_2 -# define DIR_SEPARATOR_2 '\\' -# endif -# ifndef PATH_SEPARATOR_2 -# define PATH_SEPARATOR_2 ';' -# endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#ifndef PATH_SEPARATOR_2 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) -#else /* PATH_SEPARATOR_2 */ -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) -#endif /* PATH_SEPARATOR_2 */ - -#ifndef FOPEN_WB -# define FOPEN_WB "w" -#endif -#ifndef _O_BINARY -# define _O_BINARY 0 -#endif - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -#if defined(LT_DEBUGWRAPPER) -static int lt_debug = 1; -#else -static int lt_debug = 0; -#endif - -const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ - -void *xmalloc (size_t num); -char *xstrdup (const char *string); -const char *base_name (const char *name); -char *find_executable (const char *wrapper); -char *chase_symlinks (const char *pathspec); -int make_executable (const char *path); -int check_executable (const char *path); -char *strendzap (char *str, const char *pat); -void lt_debugprintf (const char *file, int line, const char *fmt, ...); -void lt_fatal (const char *file, int line, const char *message, ...); -static const char *nonnull (const char *s); -static const char *nonempty (const char *s); -void lt_setenv (const char *name, const char *value); -char *lt_extend_str (const char *orig_value, const char *add, int to_end); -void lt_update_exe_path (const char *name, const char *value); -void lt_update_lib_path (const char *name, const char *value); -char **prepare_spawn (char **argv); -void lt_dump_script (FILE *f); -EOF - - cat <= 0) - && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) - return 1; - else - return 0; -} - -int -make_executable (const char *path) -{ - int rval = 0; - struct stat st; - - lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", - nonempty (path)); - if ((!path) || (!*path)) - return 0; - - if (stat (path, &st) >= 0) - { - rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); - } - return rval; -} - -/* Searches for the full path of the wrapper. Returns - newly allocated full path name if found, NULL otherwise - Does not chase symlinks, even on platforms that support them. -*/ -char * -find_executable (const char *wrapper) -{ - int has_slash = 0; - const char *p; - const char *p_next; - /* static buffer for getcwd */ - char tmp[LT_PATHMAX + 1]; - int tmp_len; - char *concat_name; - - lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", - nonempty (wrapper)); - - if ((wrapper == NULL) || (*wrapper == '\0')) - return NULL; - - /* Absolute path? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - else - { -#endif - if (IS_DIR_SEPARATOR (wrapper[0])) - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - } -#endif - - for (p = wrapper; *p; p++) - if (*p == '/') - { - has_slash = 1; - break; - } - if (!has_slash) - { - /* no slashes; search PATH */ - const char *path = getenv ("PATH"); - if (path != NULL) - { - for (p = path; *p; p = p_next) - { - const char *q; - size_t p_len; - for (q = p; *q; q++) - if (IS_PATH_SEPARATOR (*q)) - break; - p_len = q - p; - p_next = (*q == '\0' ? q : q + 1); - if (p_len == 0) - { - /* empty path: current directory */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = - XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - } - else - { - concat_name = - XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, p, p_len); - concat_name[p_len] = '/'; - strcpy (concat_name + p_len + 1, wrapper); - } - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - } - /* not found in PATH; assume curdir */ - } - /* Relative path | not found in path: prepend cwd */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - return NULL; -} - -char * -chase_symlinks (const char *pathspec) -{ -#ifndef S_ISLNK - return xstrdup (pathspec); -#else - char buf[LT_PATHMAX]; - struct stat s; - char *tmp_pathspec = xstrdup (pathspec); - char *p; - int has_symlinks = 0; - while (strlen (tmp_pathspec) && !has_symlinks) - { - lt_debugprintf (__FILE__, __LINE__, - "checking path component for symlinks: %s\n", - tmp_pathspec); - if (lstat (tmp_pathspec, &s) == 0) - { - if (S_ISLNK (s.st_mode) != 0) - { - has_symlinks = 1; - break; - } - - /* search backwards for last DIR_SEPARATOR */ - p = tmp_pathspec + strlen (tmp_pathspec) - 1; - while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - p--; - if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - { - /* no more DIR_SEPARATORS left */ - break; - } - *p = '\0'; - } - else - { - lt_fatal (__FILE__, __LINE__, - "error accessing file \"%s\": %s", - tmp_pathspec, nonnull (strerror (errno))); - } - } - XFREE (tmp_pathspec); - - if (!has_symlinks) - { - return xstrdup (pathspec); - } - - tmp_pathspec = realpath (pathspec, buf); - if (tmp_pathspec == 0) - { - lt_fatal (__FILE__, __LINE__, - "could not follow symlinks for %s", pathspec); - } - return xstrdup (tmp_pathspec); -#endif -} - -char * -strendzap (char *str, const char *pat) -{ - size_t len, patlen; - - assert (str != NULL); - assert (pat != NULL); - - len = strlen (str); - patlen = strlen (pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp (str, pat) == 0) - *str = '\0'; - } - return str; -} - -void -lt_debugprintf (const char *file, int line, const char *fmt, ...) -{ - va_list args; - if (lt_debug) - { - (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); - } -} - -static void -lt_error_core (int exit_status, const char *file, - int line, const char *mode, - const char *message, va_list ap) -{ - fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *file, int line, const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); - va_end (ap); -} - -static const char * -nonnull (const char *s) -{ - return s ? s : "(null)"; -} - -static const char * -nonempty (const char *s) -{ - return (s && !*s) ? "(empty)" : nonnull (s); -} - -void -lt_setenv (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_setenv) setting '%s' to '%s'\n", - nonnull (name), nonnull (value)); - { -#ifdef HAVE_SETENV - /* always make a copy, for consistency with !HAVE_SETENV */ - char *str = xstrdup (value); - setenv (name, str, 1); -#else - int len = strlen (name) + 1 + strlen (value) + 1; - char *str = XMALLOC (char, len); - sprintf (str, "%s=%s", name, value); - if (putenv (str) != EXIT_SUCCESS) - { - XFREE (str); - } -#endif - } -} - -char * -lt_extend_str (const char *orig_value, const char *add, int to_end) -{ - char *new_value; - if (orig_value && *orig_value) - { - int orig_value_len = strlen (orig_value); - int add_len = strlen (add); - new_value = XMALLOC (char, add_len + orig_value_len + 1); - if (to_end) - { - strcpy (new_value, orig_value); - strcpy (new_value + orig_value_len, add); - } - else - { - strcpy (new_value, add); - strcpy (new_value + add_len, orig_value); - } - } - else - { - new_value = xstrdup (add); - } - return new_value; -} - -void -lt_update_exe_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - /* some systems can't cope with a ':'-terminated path #' */ - int len = strlen (new_value); - while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) - { - new_value[len-1] = '\0'; - } - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -void -lt_update_lib_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -EOF - case $host_os in - mingw*) - cat <<"EOF" - -/* Prepares an argument vector before calling spawn(). - Note that spawn() does not by itself call the command interpreter - (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : - ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&v); - v.dwPlatformId == VER_PLATFORM_WIN32_NT; - }) ? "cmd.exe" : "command.com"). - Instead it simply concatenates the arguments, separated by ' ', and calls - CreateProcess(). We must quote the arguments since Win32 CreateProcess() - interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a - special way: - - Space and tab are interpreted as delimiters. They are not treated as - delimiters if they are surrounded by double quotes: "...". - - Unescaped double quotes are removed from the input. Their only effect is - that within double quotes, space and tab are treated like normal - characters. - - Backslashes not followed by double quotes are not special. - - But 2*n+1 backslashes followed by a double quote become - n backslashes followed by a double quote (n >= 0): - \" -> " - \\\" -> \" - \\\\\" -> \\" - */ -#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -char ** -prepare_spawn (char **argv) -{ - size_t argc; - char **new_argv; - size_t i; - - /* Count number of arguments. */ - for (argc = 0; argv[argc] != NULL; argc++) - ; - - /* Allocate new argument vector. */ - new_argv = XMALLOC (char *, argc + 1); - - /* Put quoted arguments into the new argument vector. */ - for (i = 0; i < argc; i++) - { - const char *string = argv[i]; - - if (string[0] == '\0') - new_argv[i] = xstrdup ("\"\""); - else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) - { - int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); - size_t length; - unsigned int backslashes; - const char *s; - char *quoted_string; - char *p; - - length = 0; - backslashes = 0; - if (quote_around) - length++; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - length += backslashes + 1; - length++; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - length += backslashes + 1; - - quoted_string = XMALLOC (char, length + 1); - - p = quoted_string; - backslashes = 0; - if (quote_around) - *p++ = '"'; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - { - unsigned int j; - for (j = backslashes + 1; j > 0; j--) - *p++ = '\\'; - } - *p++ = c; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - { - unsigned int j; - for (j = backslashes; j > 0; j--) - *p++ = '\\'; - *p++ = '"'; - } - *p = '\0'; - - new_argv[i] = quoted_string; - } - else - new_argv[i] = (char *) string; - } - new_argv[argc] = NULL; - - return new_argv; -} -EOF - ;; - esac - - cat <<"EOF" -void lt_dump_script (FILE* f) -{ -EOF - func_emit_wrapper yes | - $SED -e 's/\([\\"]\)/\\\1/g' \ - -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' - - cat <<"EOF" -} -EOF -} -# end: func_emit_cwrapperexe_src - -# func_win32_import_lib_p ARG -# True if ARG is an import lib, as indicated by $file_magic_cmd -func_win32_import_lib_p () -{ - $opt_debug - case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in - *import*) : ;; - *) false ;; - esac -} - -# func_mode_link arg... -func_mode_link () -{ - $opt_debug - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - ;; - *) - allow_undefined=yes - ;; - esac - libtool_args=$nonopt - base_compile="$nonopt $@" - compile_command=$nonopt - finalize_command=$nonopt - - compile_rpath= - finalize_rpath= - compile_shlibpath= - finalize_shlibpath= - convenience= - old_convenience= - deplibs= - old_deplibs= - compiler_flags= - linker_flags= - dllsearchpath= - lib_search_path=`pwd` - inst_prefix_dir= - new_inherited_linker_flags= - - avoid_version=no - bindir= - dlfiles= - dlprefiles= - dlself=no - export_dynamic=no - export_symbols= - export_symbols_regex= - generated= - libobjs= - ltlibs= - module=no - no_install=no - objs= - non_pic_objects= - precious_files_regex= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - vinfo_number=no - weak_libs= - single_module="${wl}-single_module" - func_infer_tag $base_compile - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - break - ;; - -all-static | -static | -static-libtool-libs) - case $arg in - -all-static) - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - func_warning "complete static linking is impossible in this configuration" - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - -static) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=built - ;; - -static-libtool-libs) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - esac - build_libtool_libs=no - build_old_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - func_quote_for_eval "$arg" - qarg=$func_quote_for_eval_unquoted_result - func_append libtool_args " $func_quote_for_eval_result" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - func_append compile_command " @OUTPUT@" - func_append finalize_command " @OUTPUT@" - ;; - esac - - case $prev in - bindir) - bindir="$arg" - prev= - continue - ;; - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - func_append compile_command " @SYMFILE@" - func_append finalize_command " @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - test -f "$arg" \ - || func_fatal_error "symbol file \`$arg' does not exist" - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - framework) - case $host in - *-*-darwin*) - case "$deplibs " in - *" $qarg.ltframework "*) ;; - *) deplibs="$deplibs $qarg.ltframework" # this is fixed later - ;; - esac - ;; - esac - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat "$save_arg"` - do -# moreargs="$moreargs $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - done - else - func_fatal_error "link input file \`$arg' does not exist" - fi - arg=$save_arg - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath="$rpath $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; - esac - fi - prev= - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - weak) - weak_libs="$weak_libs $arg" - prev= - continue - ;; - xcclinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xcompiler) - compiler_flags="$compiler_flags $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" - prev= - func_append compile_command " $wl$qarg" - func_append finalize_command " $wl$qarg" - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - # See comment for -static flag below, for more details. - func_append compile_command " $link_static_flag" - func_append finalize_command " $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - func_fatal_error "\`-allow-undefined' must not be used because it is the default" - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -bindir) - prev=bindir - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - func_fatal_error "more than one -exported-symbols argument is not allowed" - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -framework) - prev=framework - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - func_append compile_command " $arg" - func_append finalize_command " $arg" - ;; - esac - continue - ;; - - -L*) - func_stripname '-L' '' "$arg" - dir=$func_stripname_result - if test -z "$dir"; then - if test "$#" -gt 0; then - func_fatal_error "require no space between \`-L' and \`$1'" - else - func_fatal_error "need path for \`-L' option" - fi - fi - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - test -z "$absdir" && \ - func_fatal_error "cannot determine absolute directory name of \`$dir'" - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "*) ;; - *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$dir:"*) ;; - ::) dllsearchpath=$dir;; - *) dllsearchpath="$dllsearchpath:$dir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs="$deplibs System.ltframework" - continue - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - test "X$arg" = "X-lc" && continue - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - test "X$arg" = "X-lc" && continue - ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - deplibs="$deplibs $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot) - compiler_flags="$compiler_flags $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - compiler_flags="$compiler_flags $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - case "$new_inherited_linker_flags " in - *" $arg "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;; - esac - continue - ;; - - -multi_module) - single_module="${wl}-multi_module" - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) - # The PATH hackery in wrapper scripts is required on Windows - # and Darwin in order for the loader to find any dlls it needs. - func_warning "\`-no-install' is ignored for $host" - func_warning "assuming \`-no-fast-install' instead" - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - func_stripname '-R' '' "$arg" - dir=$func_stripname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -shared) - # The effects of -shared are defined in a previous loop. - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -static | -static-libtool-libs) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -weak) - prev=weak - continue - ;; - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - arg="$arg $func_quote_for_eval_result" - compiler_flags="$compiler_flags $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Wl,*) - func_stripname '-Wl,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - arg="$arg $wl$func_quote_for_eval_result" - compiler_flags="$compiler_flags $wl$func_quote_for_eval_result" - linker_flags="$linker_flags $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # -msg_* for osf cc - -msg_*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - # Flags to be passed through unchanged, with rationale: - # -64, -mips[0-9] enable 64-bit mode for the SGI compiler - # -r[0-9][0-9]* specify processor for the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler - # +DA*, +DD* enable 64-bit mode for the HP compiler - # -q* compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* architecture-specific flags for GCC - # -F/path path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* profiling flags for GCC - # @file GCC response files - # -tp=* Portland pgcc target processor selection - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - func_append compile_command " $arg" - func_append finalize_command " $arg" - compiler_flags="$compiler_flags $arg" - continue - ;; - - # Some other compiler flag. - -* | +*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles="$dlfiles $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles="$dlprefiles $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - ;; - - *.$libext) - # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" - prev= - else - deplibs="$deplibs $arg" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - done # argument parsing loop - - test -n "$prev" && \ - func_fatal_help "the \`$prevarg' option requires an argument" - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - func_basename "$output" - outputname="$func_basename_result" - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - func_dirname "$output" "/" "" - output_objdir="$func_dirname_result$objdir" - # Create the object directory. - func_mkdir_p "$output_objdir" - - # Determine the type of output - case $output in - "") - func_fatal_help "you must specify an output file" - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if $opt_duplicate_deps ; then - case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - libs="$libs $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if $opt_duplicate_compiler_generated_deps; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - - case $linkmode in - lib) - passes="conv dlpreopen link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - - for pass in $passes; do - # The preopen pass in lib mode reverses $deplibs; put it back here - # so that -L comes before libs that need it for instance... - if test "$linkmode,$pass" = "lib,link"; then - ## FIXME: Find the place where the list is rebuilt in the wrong - ## order, and fix it there properly - tmp_deplibs= - for deplib in $deplibs; do - tmp_deplibs="$deplib $tmp_deplibs" - done - deplibs="$tmp_deplibs" - fi - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - if test "$linkmode,$pass" = "lib,dlpreopen"; then - # Collect and forward deplibs of preopened libtool libs - for lib in $dlprefiles; do - # Ignore non-libtool-libs - dependency_libs= - case $lib in - *.la) func_source "$lib" ;; - esac - - # Collect preopened libtool deplibs, except any this library - # has declared as weak libs - for deplib in $dependency_libs; do - func_basename "$deplib" - deplib_base=$func_basename_result - case " $weak_libs " in - *" $deplib_base "*) ;; - *) deplibs="$deplibs $deplib" ;; - esac - done - done - libs="$dlprefiles" - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - compiler_flags="$compiler_flags $deplib" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; - esac - fi - fi - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - func_warning "\`-l' is ignored for archives/objects" - continue - fi - func_stripname '-l' '' "$deplib" - name=$func_stripname_result - if test "$linkmode" = lib; then - searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" - else - searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" - fi - for searchdir in $searchdirs; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if func_lalib_p "$lib"; then - library_names= - old_library= - func_source "$lib" - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - *.ltframework) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;; - esac - fi - fi - continue - ;; - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" - ;; - *) - func_warning "\`-L' is ignored for archives/objects" - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - func_stripname '-R' '' "$deplib" - dir=$func_stripname_result - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) lib="$deplib" ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - # Linking convenience modules into shared libraries is allowed, - # but linking other static libraries is non-portable. - case " $dlpreconveniencelibs " in - *" $deplib "*) ;; - *) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - echo - $ECHO "*** Warning: Trying to link with static lib archive $deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because the file extensions .$libext of this argument makes me believe" - echo "*** that it is just a static archive that I should not use here." - else - echo - $ECHO "*** Warning: Linking the shared library $output against the" - $ECHO "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - ;; - esac - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - - if test "$found" = yes || test -f "$lib"; then : - else - func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" - fi - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$lib" \ - || func_fatal_error "\`$lib' is not a valid libtool archive" - - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - inherited_linker_flags= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - avoidtemprpath= - - - # Read the .la file - func_source "$lib" - - # Convert "-framework foo" to "foo.ltframework" - if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` - for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do - case " $new_inherited_linker_flags " in - *" $tmp_inherited_linker_flag "*) ;; - *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";; - esac - done - fi - dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" - elif test "$linkmode" != prog && test "$linkmode" != lib; then - func_fatal_error "\`$lib' is not a convenience library" - fi - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if $opt_duplicate_deps ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - if test -z "$linklib"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - func_fatal_error "cannot -dlopen a convenience library: \`$lib'" - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" - else - newdlfiles="$newdlfiles $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - func_warning "cannot determine absolute directory name of \`$ladir'" - func_warning "passing it literally to the linker, although it might fail" - abs_ladir="$ladir" - fi - ;; - esac - func_basename "$lib" - laname="$func_basename_result" - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - func_warning "library \`$lib' was moved." - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$libdir" - absdir="$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path="$notinst_path $abs_ladir" - fi - fi # $installed = yes - func_stripname 'lib' '.la' "$laname" - name=$func_stripname_result - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir" && test "$linkmode" = prog; then - func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" - fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - newlib_search_path="$newlib_search_path $func_stripname_result" - ;; - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if $opt_duplicate_deps ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { { test "$prefer_static_libs" = no || - test "$prefer_static_libs,$installed" = "built,yes"; } || - test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath:" in - *"$absdir:"*) ;; - *) temp_rpath="$temp_rpath$absdir:" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - use_static_libs=$prefer_static_libs - if test "$use_static_libs" = built && test "$installed" = yes; then - use_static_libs=no - fi - if test -n "$library_names" && - { test "$use_static_libs" = no || test -z "$old_library"; }; then - case $host in - *cygwin* | *mingw* | *cegcc*) - # No point in relinking DLLs because paths are not encoded - notinst_deplibs="$notinst_deplibs $lib" - need_relink=no - ;; - *) - if test "$installed" = no; then - notinst_deplibs="$notinst_deplibs $lib" - need_relink=yes - fi - ;; - esac - # This is a shared library - - # Warn about portability, can't link against -module's on some - # systems (darwin). Don't bleat about dlopened modules though! - dlopenmodule="" - for dlpremoduletest in $dlprefiles; do - if test "X$dlpremoduletest" = "X$lib"; then - dlopenmodule="$dlpremoduletest" - break - fi - done - if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - echo - if test "$linkmode" = prog; then - $ECHO "*** Warning: Linking the executable $output against the loadable module" - else - $ECHO "*** Warning: Linking the shared library $output against the loadable module" - fi - $ECHO "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - shift - realname="$1" - shift - libname=`eval "\\$ECHO \"$libname_spec\""` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw* | *cegcc*) - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - func_basename "$soroot" - soname="$func_basename_result" - func_stripname 'lib' '.dll' "$soname" - newlib=libimp-$func_stripname_result.a - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - func_verbose "extracting exported symbol list from \`$soname'" - func_execute_cmds "$extract_expsyms_cmds" 'exit $?' - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - func_verbose "generating import library for \`$soname'" - func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; - *-*-sysv4*uw2*) add_dir="-L$dir" ;; - *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ - *-*-unixware7*) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a (non-dlopened) module then we can not - # link against it, someone is ignoring the earlier warnings - if /usr/bin/file -L $add 2> /dev/null | - $GREP ": [^:]* bundle" >/dev/null ; then - if test "X$dlopenmodule" != "X$lib"; then - $ECHO "*** Warning: lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - echo - echo "*** And there doesn't seem to be a static archive available" - echo "*** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - elif test -n "$old_library"; then - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - func_fatal_configuration "unsupported hardcode properties" - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && - test "$hardcode_minus_L" != yes && - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - echo - $ECHO "*** Warning: This system can not link to static lib archive $lib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - echo "*** But as you try to build a module library, libtool will still create " - echo "*** a static module, that should work as long as the dlopening application" - echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) func_stripname '-R' '' "$libdir" - temp_xrpath=$func_stripname_result - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - *) temp_deplibs="$temp_deplibs $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - newlib_search_path="$newlib_search_path $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - if $opt_duplicate_deps ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - path= - case $deplib in - -L*) path="$deplib" ;; - *.la) - func_dirname "$deplib" "" "." - dir="$func_dirname_result" - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - func_warning "cannot determine absolute directory name of \`$dir'" - absdir="$dir" - fi - ;; - esac - if $GREP "^installed=no" $deplib > /dev/null; then - case $host in - *-*-darwin*) - depdepl= - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$absdir/$objdir/$depdepl" ; then - depdepl="$absdir/$objdir/$depdepl" - darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - if test -z "$darwin_install_name"; then - darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - fi - compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}" - path= - fi - fi - ;; - *) - path="-L$absdir/$objdir" - ;; - esac - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - test "$absdir" != "$libdir" && \ - func_warning "\`$deplib' seems to be moved" - - path="-L$absdir" - fi - ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - if test "$pass" = link; then - if test "$linkmode" = "prog"; then - compile_deplibs="$new_inherited_linker_flags $compile_deplibs" - finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" - else - compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - fi - fi - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - fi - if test "$linkmode" = prog || test "$linkmode" = lib; then - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for archives" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for archives" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for archives" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for archives" - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for archives" - - test -n "$release" && \ - func_warning "\`-release' is ignored for archives" - - test -n "$export_symbols$export_symbols_regex" && \ - func_warning "\`-export-symbols' is ignored for archives" - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - objs="$objs$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - func_stripname 'lib' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - test "$module" = no && \ - func_fatal_help "libtool library \`$output' must begin with \`lib'" - - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - func_stripname '' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - func_stripname '' '.la' "$outputname" - libname=$func_stripname_result - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" - else - echo - $ECHO "*** Warning: Linking the shared library $output against the non-libtool" - $ECHO "*** objects $objs is not portable!" - libobjs="$libobjs $objs" - fi - fi - - test "$dlself" != no && \ - func_warning "\`-dlopen self' is ignored for libtool libraries" - - set dummy $rpath - shift - test "$#" -gt 1 && \ - func_warning "ignoring multiple \`-rpath's for a libtool library" - - install_libdir="$1" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for convenience libraries" - - test -n "$release" && \ - func_warning "\`-release' is ignored for convenience libraries" - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - shift - IFS="$save_ifs" - - test -n "$7" && \ - func_fatal_help "too many parameters to \`-version-info'" - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$1" - number_minor="$2" - number_revision="$3" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows|none) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|qnx|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_minor" - lt_irix_increment=no - ;; - esac - ;; - no) - current="$1" - revision="$2" - age="$3" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "CURRENT \`$current' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "REVISION \`$revision' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "AGE \`$age' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - if test "$age" -gt "$current"; then - func_error "AGE \`$age' is greater than the current interface number \`$current'" - func_fatal_error "\`$vinfo' is not valid version information" - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - func_arith $current + 1 - minor_current=$func_arith_result - xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current" - ;; - - irix | nonstopux) - if test "X$lt_irix_increment" = "Xno"; then - func_arith $current - $age - else - func_arith $current - $age + 1 - fi - major=$func_arith_result - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - func_arith $revision - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - ;; - - osf) - func_arith $current - $age - major=.$func_arith_result - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - func_arith $current - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - qnx) - major=".$current" - versuffix=".$current" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - - *) - func_fatal_configuration "unknown library version type \`$version_type'" - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - func_warning "undefined symbols not allowed in $host shared libraries" - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - - fi - - func_generate_dlsyms "$libname" "$libname" "yes" - libobjs="$libobjs $symfileobj" - test "X$libobjs" = "X " && libobjs= - - if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$ECHO "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext | *.gcno) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - removelist="$removelist $p" - ;; - *) ;; - esac - done - test -n "$removelist" && \ - func_show_eval "${RM}r \$removelist" - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - #for path in $notinst_path; do - # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` - # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` - # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` - #done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - deplibs="$deplibs System.ltframework" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - deplibs="$deplibs -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $opt_dry_run || $RM conftest.c - cat > conftest.c </dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null | - $GREP " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | - $SED -e 10q | - $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for file magic test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a file magic. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - for a_deplib in $deplibs; do - case $a_deplib in - -l*) - func_stripname -l '' "$a_deplib" - name=$func_stripname_result - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval "\\$ECHO \"$libname_spec\""` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ - $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a regex pattern. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` - done - fi - case $tmp_deplibs in - *[!\ \ ]*) - echo - if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." - else - echo "*** Warning: inter-library dependencies are not known to be supported." - fi - echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - ;; - esac - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - $ECHO "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - echo - echo "*** Since this library must not contain undefined symbols," - echo "*** because either the platform does not support them or" - echo "*** it was explicitly requested with -no-undefined," - echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - case $host in - *-*-darwin*) - newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $deplibs " in - *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; - esac - ;; - *) new_libs="$new_libs $deplib" ;; - esac - done - deplibs="$new_libs" - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - shift - realname="$1" - shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - linknames= - for link - do - linknames="$linknames $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` - test "X$libobjs" = "X " && libobjs= - - delfiles= - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" - export_symbols="$output_objdir/$libname.uexp" - delfiles="$delfiles $export_symbols" - fi - - orig_export_symbols= - case $host_os in - cygwin* | mingw* | cegcc*) - if test -n "$export_symbols" && test -z "$export_symbols_regex"; then - # exporting using user supplied symfile - if test "x`$SED 1q $export_symbols`" != xEXPORTS; then - # and it's NOT already a .def file. Must figure out - # which of the given symbols are data symbols and tag - # them as such. So, trigger use of export_symbols_cmds. - # export_symbols gets reassigned inside the "prepare - # the list of exported symbols" if statement, so the - # include_expsyms logic still works. - orig_export_symbols="$export_symbols" - export_symbols= - always_export_symbols=yes - fi - fi - ;; - esac - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - func_len " $cmd" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - func_show_eval "$cmd" 'exit $?' - skipped_export=false - else - # The command line is too long to execute in one step. - func_verbose "using reloadable object file for export list..." - skipped_export=: - # Break out early, otherwise skipped_export may be - # set to false by a later but shorter cmd. - break - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs="$tmp_deplibs $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec" && - test "$compiler_needs_object" = yes && - test -z "$libobjs"; then - # extract the archives, so we have objects to list. - # TODO: could optimize this to just extract one archive. - whole_archive_flag_spec= - fi - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - else - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - libobjs="$libobjs $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && - func_len " $test_cmds" && - len=$func_len_result && - test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise - # or, if using GNU ld and skipped_export is not :, use a linker - # script. - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - func_basename "$output" - output_la=$func_basename_result - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - last_robj= - k=1 - - if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then - output=${output_objdir}/${output_la}.lnkscript - func_verbose "creating GNU ld script: $output" - echo 'INPUT (' > $output - for obj in $save_libobjs - do - $ECHO "$obj" >> $output - done - echo ')' >> $output - delfiles="$delfiles $output" - elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then - output=${output_objdir}/${output_la}.lnk - func_verbose "creating linker input file list: $output" - : > $output - set x $save_libobjs - shift - firstobj= - if test "$compiler_needs_object" = yes; then - firstobj="$1 " - shift - fi - for obj - do - $ECHO "$obj" >> $output - done - delfiles="$delfiles $output" - output=$firstobj\"$file_list_spec$output\" - else - if test -n "$save_libobjs"; then - func_verbose "creating reloadable object files..." - output=$output_objdir/$output_la-${k}.$objext - eval test_cmds=\"$reload_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - if test "X$objlist" = X || - test "$len" -lt "$max_cmd_len"; then - func_append objlist " $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - reload_objs=$objlist - eval concat_cmds=\"$reload_cmds\" - else - # All subsequent reloadable object files will link in - # the last one created. - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" - fi - last_robj=$output_objdir/$output_la-${k}.$objext - func_arith $k + 1 - k=$func_arith_result - output=$output_objdir/$output_la-${k}.$objext - objlist=" $obj" - func_len " $last_robj" - func_arith $len0 + $func_len_result - len=$func_arith_result - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\${concat_cmds}$reload_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" - fi - delfiles="$delfiles $output" - - else - output= - fi - - if ${skipped_export-false}; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - libobjs=$output - # Append the command to create the export file. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" - fi - fi - - test -n "$save_libobjs" && - func_verbose "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - if test -n "$export_symbols_regex" && ${skipped_export-false}; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - - if ${skipped_export-false}; then - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles="$delfiles $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - fi - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - fi - - if test -n "$delfiles"; then - # Append the command to remove temporary files to $cmds. - eval cmds=\"\$cmds~\$RM $delfiles\" - fi - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $dlprefiles - libobjs="$libobjs $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? - - if test -n "$convenience"; then - if test -z "$whole_archive_flag_spec"; then - func_show_eval '${RM}r "$gentop"' - fi - fi - - exit $EXIT_SUCCESS - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for objects" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for objects" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for objects" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for objects" - - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for objects" - - test -n "$release" && \ - func_warning "\`-release' is ignored for objects" - - case $output in - *.lo) - test -n "$objs$old_deplibs" && \ - func_fatal_error "cannot build library object \`$output' from non-libtool objects" - - libobj=$output - func_lo2o "$libobj" - obj=$func_lo2o_result - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $opt_dry_run || $RM $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec and hope we can get by with - # turning comma into space.. - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` - else - gentop="$output_objdir/${obj}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - func_execute_cmds "$reload_cmds" 'exit $?' - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - func_execute_cmds "$reload_cmds" 'exit $?' - fi - - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) func_stripname '' '.exe' "$output" - output=$func_stripname_result.exe;; - esac - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for programs" - - test -n "$release" && \ - func_warning "\`-release' is ignored for programs" - - test "$preload" = yes \ - && test "$dlopen_support" = unknown \ - && test "$dlopen_self" = unknown \ - && test "$dlopen_self_static" = unknown && \ - func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - case $host in - *-*-darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - # But is supposedly fixed on 10.4 or later (yay!). - if test "$tagname" = CXX ; then - case ${MACOSX_DEPLOYMENT_TARGET-10.0} in - 10.[0123]) - compile_command="$compile_command ${wl}-bind_at_load" - finalize_command="$finalize_command ${wl}-bind_at_load" - ;; - esac - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $compile_deplibs " in - *" -L$path/$objdir "*) - new_libs="$new_libs -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $compile_deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$new_libs $deplib" ;; - esac - ;; - *) new_libs="$new_libs $deplib" ;; - esac - done - compile_deplibs="$new_libs" - - - compile_command="$compile_command $compile_deplibs" - finalize_command="$finalize_command $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$libdir:"*) ;; - ::) dllsearchpath=$libdir;; - *) dllsearchpath="$dllsearchpath:$libdir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) dllsearchpath="$dllsearchpath:$testbindir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - fi - - func_generate_dlsyms "$outputname" "@PROGRAM@" "no" - - # template prelinking step - if test -n "$prelink_cmds"; then - func_execute_cmds "$prelink_cmds" 'exit $?' - fi - - wrappers_required=yes - case $host in - *cegcc* | *mingw32ce*) - # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. - wrappers_required=no - ;; - *cygwin* | *mingw* ) - if test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - *) - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - esac - if test "$wrappers_required" = no; then - # Replace the output file specification. - compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - exit_status=0 - func_show_eval "$link_command" 'exit_status=$?' - - # Delete the generated files. - if test -f "$output_objdir/${outputname}S.${objext}"; then - func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' - fi - - exit $exit_status - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $opt_dry_run || $RM $output - # Link the executable and exit - func_show_eval "$link_command" 'exit $?' - exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - func_warning "this platform does not like uninstalled shared libraries" - func_warning "\`$output' will be relinked during installation" - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname - - func_show_eval "$link_command" 'exit $?' - - # Now create the wrapper script. - func_verbose "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - fi - - # Only actually do things if not in dry run mode. - $opt_dry_run || { - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) func_stripname '' '.exe' "$output" - output=$func_stripname_result ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - func_stripname '' '.exe' "$outputname" - outputname=$func_stripname_result ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - func_dirname_and_basename "$output" "" "." - output_name=$func_basename_result - output_path=$func_dirname_result - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" - $RM $cwrappersource $cwrapper - trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - func_emit_cwrapperexe_src > $cwrappersource - - # The wrapper executable is built using the $host compiler, - # because it contains $host paths and files. If cross- - # compiling, it, like the target executable, must be - # executed on the $host or under an emulation environment. - $opt_dry_run || { - $LTCC $LTCFLAGS -o $cwrapper $cwrappersource - $STRIP $cwrapper - } - - # Now, create the wrapper script for func_source use: - func_ltwrapper_scriptname $cwrapper - $RM $func_ltwrapper_scriptname_result - trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 - $opt_dry_run || { - # note: this script will not be executed, so do not chmod. - if test "x$build" = "x$host" ; then - $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result - else - func_emit_wrapper no > $func_ltwrapper_scriptname_result - fi - } - ;; - * ) - $RM $output - trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 - - func_emit_wrapper no > $output - chmod +x $output - ;; - esac - } - exit $EXIT_SUCCESS - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save $symfileobj" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - if test "$preload" = yes && test -f "$symfileobj"; then - oldobjs="$oldobjs $symfileobj" - fi - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $addlibs - oldobjs="$oldobjs $func_extract_archives_result" - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds - else - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - func_extract_archives $gentop $dlprefiles - oldobjs="$oldobjs $func_extract_archives_result" - fi - - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - func_basename "$obj" - $ECHO "$func_basename_result" - done | sort | sort -uc >/dev/null 2>&1); then - : - else - echo "copying selected object files to avoid basename conflicts..." - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - func_mkdir_p "$gentop" - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - func_basename "$obj" - objbase="$func_basename_result" - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - func_arith $counter + 1 - counter=$func_arith_result - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - oldobjs="$oldobjs $gentop/$newobj" - ;; - *) oldobjs="$oldobjs $obj" ;; - esac - done - fi - eval cmds=\"$old_archive_cmds\" - - func_len " $cmds" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - func_verbose "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - oldobjs= - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - eval test_cmds=\"$old_archive_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - for obj in $save_oldobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - func_append objlist " $obj" - if test "$len" -lt "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - len=$len0 - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" - fi - fi - fi - func_execute_cmds "$cmds" 'exit $?' - done - - test -n "$generated" && \ - func_show_eval "${RM}r$generated" - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - func_verbose "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - - # Only create the output if not a dry run. - $opt_dry_run || { - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - func_basename "$deplib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - newdependency_libs="$newdependency_libs $libdir/$name" - ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - - for lib in $dlfiles; do - case $lib in - *.la) - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - newdlfiles="$newdlfiles $libdir/$name" - ;; - *) newdlfiles="$newdlfiles $lib" ;; - esac - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - *.la) - # Only pass preopened files to the pseudo-archive (for - # eventual linking with the app. that links it) if we - # didn't already link the preopened objects directly into - # the library: - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - newdlprefiles="$newdlprefiles $libdir/$name" - ;; - esac - done - dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlfiles="$newdlfiles $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlprefiles="$newdlprefiles $abs" - done - dlprefiles="$newdlprefiles" - fi - $RM $output - # place dlname in correct position for cygwin - # In fact, it would be nice if we could use this code for all target - # systems that can't hard-code library paths into their executables - # and that have no shared library path variable independent of PATH, - # but it turns out we can't easily determine that from inspecting - # libtool variables, so we have to hard-code the OSs to which it - # applies here; at the moment, that means platforms that use the PE - # object format with DLL files. See the long comment at the top of - # tests/bindir.at for full details. - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) - # If a -bindir argument was supplied, place the dll there. - if test "x$bindir" != x ; - then - func_relative_path "$install_libdir" "$bindir" - tdlname=$func_relative_path_result$dlname - else - # Otherwise fall back on heuristic. - tdlname=../bin/$dlname - fi - ;; - esac - $ECHO > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags='$new_inherited_linker_flags' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Names of additional weak libraries provided by this library -weak_library_names='$weak_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $ECHO >> $output "\ -relink_command=\"$relink_command\"" - fi - done - } - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' - ;; - esac - exit $EXIT_SUCCESS -} - -{ test "$mode" = link || test "$mode" = relink; } && - func_mode_link ${1+"$@"} - - -# func_mode_uninstall arg... -func_mode_uninstall () -{ - $opt_debug - RM="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) RM="$RM $arg"; rmforce=yes ;; - -*) RM="$RM $arg" ;; - *) files="$files $arg" ;; - esac - done - - test -z "$RM" && \ - func_fatal_help "you must specify an RM program" - - rmdirs= - - origobjdir="$objdir" - for file in $files; do - func_dirname "$file" "" "." - dir="$func_dirname_result" - if test "X$dir" = X.; then - objdir="$origobjdir" - else - objdir="$dir/$origobjdir" - fi - func_basename "$file" - name="$func_basename_result" - test "$mode" = uninstall && objdir="$dir" - - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then - case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if { test -L "$file"; } >/dev/null 2>&1 || - { test -h "$file"; } >/dev/null 2>&1 || - test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if func_lalib_p "$file"; then - func_source $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" - done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - - case "$mode" in - clean) - case " $library_names " in - # " " in the beginning catches empty $dlname - *" $dlname "*) ;; - *) rmfiles="$rmfiles $objdir/$dlname" ;; - esac - test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - ;; - uninstall) - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - # FIXME: should reinstall the best remaining shared library. - ;; - esac - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if func_lalib_p "$file"; then - - # Read the .lo file - func_source $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" && - test "$pic_object" != none; then - rmfiles="$rmfiles $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" && - test "$non_pic_object" != none; then - rmfiles="$rmfiles $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$mode" = clean ; then - noexename=$name - case $file in - *.exe) - func_stripname '' '.exe' "$file" - file=$func_stripname_result - func_stripname '' '.exe' "$name" - noexename=$func_stripname_result - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles="$rmfiles $file" - ;; - esac - # Do a test to see if this is a libtool program. - if func_ltwrapper_p "$file"; then - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - relink_command= - func_source $func_ltwrapper_scriptname_result - rmfiles="$rmfiles $func_ltwrapper_scriptname_result" - else - relink_command= - func_source $dir/$noexename - fi - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles="$rmfiles $objdir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles="$rmfiles $objdir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - func_show_eval "$RM $rmfiles" 'exit_status=1' - done - objdir="$origobjdir" - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - func_show_eval "rmdir $dir >/dev/null 2>&1" - fi - done - - exit $exit_status -} - -{ test "$mode" = uninstall || test "$mode" = clean; } && - func_mode_uninstall ${1+"$@"} - -test -z "$mode" && { - help="$generic_help" - func_fatal_help "you must specify a MODE" -} - -test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$mode'" - -if test -n "$exec_cmd"; then - eval exec "$exec_cmd" - exit $EXIT_FAILURE -fi - -exit $exit_status - - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: -# vi:sw=2 - diff --git a/lang/c/jansson/missing b/lang/c/jansson/missing deleted file mode 100755 index 1c8ff7049d8..00000000000 --- a/lang/c/jansson/missing +++ /dev/null @@ -1,367 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2006-05-10.23 - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 -# Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: -sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' -sed_minuso='s/.* -o \([^ ]*\).*/\1/p' - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -msg="missing on your system" - -case $1 in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - autom4te touch the output file, or create a stub one - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Send bug reports to ." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - -esac - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). -case $1 in - lex|yacc) - # Not GNU programs, they don't have --version. - ;; - - tar) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case $1 in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case $f in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if test $# -ne 1; then - eval LASTARG="\${$#}" - case $LASTARG in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if test ! -f y.tab.h; then - echo >y.tab.h - fi - if test ! -f y.tab.c; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if test $# -ne 1; then - eval LASTARG="\${$#}" - case $LASTARG in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if test ! -f lex.yy.c; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n ' - /^@setfilename/{ - s/.* \([^ ]*\) *$/\1/ - p - q - }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file - ;; - - tar) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case $firstarg in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case $firstarg in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/lang/c/jansson/src/Makefile.am b/lang/c/jansson/src/Makefile.am deleted file mode 100644 index cd163fd1613..00000000000 --- a/lang/c/jansson/src/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -#include_HEADERS = jansson.h jansson_config.h - -noinst_LTLIBRARIES = libjansson.la -libjansson_la_SOURCES = \ - jansson.h \ - jansson_config.h \ - dump.c \ - error.c \ - hashtable.c \ - hashtable.h \ - jansson_private.h \ - load.c \ - memory.c \ - pack_unpack.c \ - strbuffer.c \ - strbuffer.h \ - utf.c \ - utf.h \ - value.c -libjansson_la_LDFLAGS = \ - -export-symbols-regex '^json_' \ - -version-info 5:0:1 - -if GCC -# These flags are gcc specific -AM_CFLAGS = -Wall -Wextra -Wdeclaration-after-statement -Werror -endif diff --git a/lang/c/jansson/src/Makefile.in b/lang/c/jansson/src/Makefile.in deleted file mode 100644 index d20abb0999b..00000000000 --- a/lang/c/jansson/src/Makefile.in +++ /dev/null @@ -1,477 +0,0 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -#include_HEADERS = jansson.h jansson_config.h - -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = src -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/jansson_config.h.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = jansson_config.h -LTLIBRARIES = $(noinst_LTLIBRARIES) -libjansson_la_LIBADD = -am_libjansson_la_OBJECTS = dump.lo error.lo hashtable.lo load.lo \ - memory.lo pack_unpack.lo strbuffer.lo utf.lo value.lo -libjansson_la_OBJECTS = $(am_libjansson_la_OBJECTS) -libjansson_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(libjansson_la_LDFLAGS) $(LDFLAGS) -o $@ -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(libjansson_la_SOURCES) -DIST_SOURCES = $(libjansson_la_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -json_have_long_long = @json_have_long_long@ -json_inline = @json_inline@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -noinst_LTLIBRARIES = libjansson.la -libjansson_la_SOURCES = \ - jansson.h \ - jansson_config.h \ - dump.c \ - error.c \ - hashtable.c \ - hashtable.h \ - jansson_private.h \ - load.c \ - memory.c \ - pack_unpack.c \ - strbuffer.c \ - strbuffer.h \ - utf.c \ - utf.h \ - value.c - -libjansson_la_LDFLAGS = \ - -export-symbols-regex '^json_' \ - -version-info 5:0:1 - - -# These flags are gcc specific -@GCC_TRUE@AM_CFLAGS = -Wall -Wextra -Wdeclaration-after-statement -Werror -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign src/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -jansson_config.h: $(top_builddir)/config.status $(srcdir)/jansson_config.h.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libjansson.la: $(libjansson_la_OBJECTS) $(libjansson_la_DEPENDENCIES) - $(libjansson_la_LINK) $(libjansson_la_OBJECTS) $(libjansson_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dump.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hashtable.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/load.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memory.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pack_unpack.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strbuffer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utf.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/value.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-exec-am: - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES ctags distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lang/c/jansson/src/dump.c b/lang/c/jansson/src/dump.c deleted file mode 100644 index 5e40b861a89..00000000000 --- a/lang/c/jansson/src/dump.c +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#define _GNU_SOURCE -#include -#include -#include -#include - -#include -#include "jansson_private.h" -#include "strbuffer.h" -#include "utf.h" - -#define MAX_INTEGER_STR_LENGTH 100 -#define MAX_REAL_STR_LENGTH 100 - -typedef int (*dump_func)(const char *buffer, int size, void *data); - -struct string -{ - char *buffer; - int length; - int size; -}; - -static int dump_to_strbuffer(const char *buffer, int size, void *data) -{ - return strbuffer_append_bytes((strbuffer_t *)data, buffer, size); -} - -static int dump_to_file(const char *buffer, int size, void *data) -{ - FILE *dest = (FILE *)data; - if(fwrite(buffer, size, 1, dest) != 1) - return -1; - return 0; -} - -/* 32 spaces (the maximum indentation size) */ -static char whitespace[] = " "; - -static int dump_indent(size_t flags, int depth, int space, dump_func dump, void *data) -{ - if(JSON_INDENT(flags) > 0) - { - int i, ws_count = JSON_INDENT(flags); - - if(dump("\n", 1, data)) - return -1; - - for(i = 0; i < depth; i++) - { - if(dump(whitespace, ws_count, data)) - return -1; - } - } - else if(space && !(flags & JSON_COMPACT)) - { - return dump(" ", 1, data); - } - return 0; -} - -static int dump_string(const char *str, int ascii, dump_func dump, void *data) -{ - const char *pos, *end; - int32_t codepoint; - - if(dump("\"", 1, data)) - return -1; - - end = pos = str; - while(1) - { - const char *text; - char seq[13]; - int length; - - while(*end) - { - end = utf8_iterate(pos, &codepoint); - if(!end) - return -1; - - /* mandatory escape or control char */ - if(codepoint == '\\' || codepoint == '"' || codepoint < 0x20) - break; - - /* non-ASCII */ - if(ascii && codepoint > 0x7F) - break; - - pos = end; - } - - if(pos != str) { - if(dump(str, pos - str, data)) - return -1; - } - - if(end == pos) - break; - - /* handle \, ", and control codes */ - length = 2; - switch(codepoint) - { - case '\\': text = "\\\\"; break; - case '\"': text = "\\\""; break; - case '\b': text = "\\b"; break; - case '\f': text = "\\f"; break; - case '\n': text = "\\n"; break; - case '\r': text = "\\r"; break; - case '\t': text = "\\t"; break; - default: - { - /* codepoint is in BMP */ - if(codepoint < 0x10000) - { - sprintf(seq, "\\u%04x", (int) codepoint); - length = 6; - } - - /* not in BMP -> construct a UTF-16 surrogate pair */ - else - { - int32_t first, last; - - codepoint -= 0x10000; - first = 0xD800 | ((codepoint & 0xffc00) >> 10); - last = 0xDC00 | (codepoint & 0x003ff); - - sprintf(seq, "\\u%04x\\u%04x", (int) first, (int) last); - length = 12; - } - - text = seq; - break; - } - } - - if(dump(text, length, data)) - return -1; - - str = pos = end; - } - - return dump("\"", 1, data); -} - -static int object_key_compare_keys(const void *key1, const void *key2) -{ - return strcmp((*(const object_key_t **)key1)->key, - (*(const object_key_t **)key2)->key); -} - -static int object_key_compare_serials(const void *key1, const void *key2) -{ - return (*(const object_key_t **)key1)->serial - - (*(const object_key_t **)key2)->serial; -} - -static int do_dump(const json_t *json, size_t flags, int depth, - dump_func dump, void *data) -{ - int ascii = flags & JSON_ENSURE_ASCII ? 1 : 0; - - switch(json_typeof(json)) { - case JSON_NULL: - return dump("null", 4, data); - - case JSON_TRUE: - return dump("true", 4, data); - - case JSON_FALSE: - return dump("false", 5, data); - - case JSON_INTEGER: - { - char buffer[MAX_INTEGER_STR_LENGTH]; - int size; - - size = snprintf(buffer, MAX_INTEGER_STR_LENGTH, - "%" JSON_INTEGER_FORMAT, - json_integer_value(json)); - if(size >= MAX_INTEGER_STR_LENGTH) - return -1; - - return dump(buffer, size, data); - } - - case JSON_REAL: - { - char buffer[MAX_REAL_STR_LENGTH]; - int size; - - size = snprintf(buffer, MAX_REAL_STR_LENGTH, "%.17g", - json_real_value(json)); - if(size >= MAX_REAL_STR_LENGTH) - return -1; - - /* Make sure there's a dot or 'e' in the output. Otherwise - a real is converted to an integer when decoding */ - if(strchr(buffer, '.') == NULL && - strchr(buffer, 'e') == NULL) - { - if(size + 2 >= MAX_REAL_STR_LENGTH) { - /* No space to append ".0" */ - return -1; - } - buffer[size] = '.'; - buffer[size + 1] = '0'; - size += 2; - } - - return dump(buffer, size, data); - } - - case JSON_STRING: - return dump_string(json_string_value(json), ascii, dump, data); - - case JSON_ARRAY: - { - int i; - int n; - json_array_t *array; - - /* detect circular references */ - array = json_to_array(json); - if(array->visited) - goto array_error; - array->visited = 1; - - n = json_array_size(json); - - if(dump("[", 1, data)) - goto array_error; - if(n == 0) { - array->visited = 0; - return dump("]", 1, data); - } - if(dump_indent(flags, depth + 1, 0, dump, data)) - goto array_error; - - for(i = 0; i < n; ++i) { - if(do_dump(json_array_get(json, i), flags, depth + 1, - dump, data)) - goto array_error; - - if(i < n - 1) - { - if(dump(",", 1, data) || - dump_indent(flags, depth + 1, 1, dump, data)) - goto array_error; - } - else - { - if(dump_indent(flags, depth, 0, dump, data)) - goto array_error; - } - } - - array->visited = 0; - return dump("]", 1, data); - - array_error: - array->visited = 0; - return -1; - } - - case JSON_OBJECT: - { - json_object_t *object; - void *iter; - const char *separator; - int separator_length; - - if(flags & JSON_COMPACT) { - separator = ":"; - separator_length = 1; - } - else { - separator = ": "; - separator_length = 2; - } - - /* detect circular references */ - object = json_to_object(json); - if(object->visited) - goto object_error; - object->visited = 1; - - iter = json_object_iter((json_t *)json); - - if(dump("{", 1, data)) - goto object_error; - if(!iter) { - object->visited = 0; - return dump("}", 1, data); - } - if(dump_indent(flags, depth + 1, 0, dump, data)) - goto object_error; - - if(flags & JSON_SORT_KEYS || flags & JSON_PRESERVE_ORDER) - { - const object_key_t **keys; - size_t size, i; - int (*cmp_func)(const void *, const void *); - - size = json_object_size(json); - keys = (const object_key_t **) jsonp_malloc(size * sizeof(object_key_t *)); - if(!keys) - goto object_error; - - i = 0; - while(iter) - { - keys[i] = jsonp_object_iter_fullkey(iter); - iter = json_object_iter_next((json_t *)json, iter); - i++; - } - assert(i == size); - - if(flags & JSON_SORT_KEYS) - cmp_func = object_key_compare_keys; - else - cmp_func = object_key_compare_serials; - - qsort(keys, size, sizeof(object_key_t *), cmp_func); - - for(i = 0; i < size; i++) - { - const char *key; - json_t *value; - - key = keys[i]->key; - value = json_object_get(json, key); - assert(value); - - dump_string(key, ascii, dump, data); - if(dump(separator, separator_length, data) || - do_dump(value, flags, depth + 1, dump, data)) - { - jsonp_free(keys); - goto object_error; - } - - if(i < size - 1) - { - if(dump(",", 1, data) || - dump_indent(flags, depth + 1, 1, dump, data)) - { - jsonp_free(keys); - goto object_error; - } - } - else - { - if(dump_indent(flags, depth, 0, dump, data)) - { - jsonp_free(keys); - goto object_error; - } - } - } - - jsonp_free(keys); - } - else - { - /* Don't sort keys */ - - while(iter) - { - void *next = json_object_iter_next((json_t *)json, iter); - - dump_string(json_object_iter_key(iter), ascii, dump, data); - if(dump(separator, separator_length, data) || - do_dump(json_object_iter_value(iter), flags, depth + 1, - dump, data)) - goto object_error; - - if(next) - { - if(dump(",", 1, data) || - dump_indent(flags, depth + 1, 1, dump, data)) - goto object_error; - } - else - { - if(dump_indent(flags, depth, 0, dump, data)) - goto object_error; - } - - iter = next; - } - } - - object->visited = 0; - return dump("}", 1, data); - - object_error: - object->visited = 0; - return -1; - } - - default: - /* not reached */ - return -1; - } -} - - -char *json_dumps(const json_t *json, size_t flags) -{ - strbuffer_t strbuff; - char *result; - - if(!(flags & JSON_ENCODE_ANY)) { - if(!json_is_array(json) && !json_is_object(json)) - return NULL; - } - - if(strbuffer_init(&strbuff)) - return NULL; - - if(do_dump(json, flags, 0, dump_to_strbuffer, (void *)&strbuff)) { - strbuffer_close(&strbuff); - return NULL; - } - - result = jsonp_strdup(strbuffer_value(&strbuff)); - strbuffer_close(&strbuff); - - return result; -} - -int json_dumpf(const json_t *json, FILE *output, size_t flags) -{ - if(!(flags & JSON_ENCODE_ANY)) { - if(!json_is_array(json) && !json_is_object(json)) - return -1; - } - - return do_dump(json, flags, 0, dump_to_file, (void *)output); -} - -int json_dump_file(const json_t *json, const char *path, size_t flags) -{ - int result; - - FILE *output = fopen(path, "w"); - if(!output) - return -1; - - result = json_dumpf(json, output, flags); - - fclose(output); - return result; -} diff --git a/lang/c/jansson/src/error.c b/lang/c/jansson/src/error.c deleted file mode 100644 index a7c8cbb9e54..00000000000 --- a/lang/c/jansson/src/error.c +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include "jansson_private.h" - -void jsonp_error_init(json_error_t *error, const char *source) -{ - if(error) - { - error->text[0] = '\0'; - error->line = -1; - error->column = -1; - error->position = 0; - if(source) - jsonp_error_set_source(error, source); - else - error->source[0] = '\0'; - } -} - -void jsonp_error_set_source(json_error_t *error, const char *source) -{ - size_t length; - - if(!error || !source) - return; - - length = strlen(source); - if(length < JSON_ERROR_SOURCE_LENGTH) - strcpy(error->source, source); - else { - size_t extra = length - JSON_ERROR_SOURCE_LENGTH + 4; - strcpy(error->source, "..."); - strcpy(error->source + 3, source + extra); - } -} - -void jsonp_error_set(json_error_t *error, int line, int column, - size_t position, const char *msg, ...) -{ - va_list ap; - - va_start(ap, msg); - jsonp_error_vset(error, line, column, position, msg, ap); - va_end(ap); -} - -void jsonp_error_vset(json_error_t *error, int line, int column, - size_t position, const char *msg, va_list ap) -{ - if(!error) - return; - - if(error->text[0] != '\0') { - /* error already set */ - return; - } - - error->line = line; - error->column = column; - error->position = position; - - vsnprintf(error->text, JSON_ERROR_TEXT_LENGTH, msg, ap); -} diff --git a/lang/c/jansson/src/hashtable.c b/lang/c/jansson/src/hashtable.c deleted file mode 100644 index 515e4e2863c..00000000000 --- a/lang/c/jansson/src/hashtable.c +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include /* for JSON_INLINE */ -#include "jansson_private.h" /* for container_of() */ -#include "hashtable.h" - -typedef struct hashtable_list list_t; -typedef struct hashtable_pair pair_t; -typedef struct hashtable_bucket bucket_t; - -#define list_to_pair(list_) container_of(list_, pair_t, list) - -static JSON_INLINE void list_init(list_t *list) -{ - list->next = list; - list->prev = list; -} - -static JSON_INLINE void list_insert(list_t *list, list_t *node) -{ - node->next = list; - node->prev = list->prev; - list->prev->next = node; - list->prev = node; -} - -static JSON_INLINE void list_remove(list_t *list) -{ - list->prev->next = list->next; - list->next->prev = list->prev; -} - -static JSON_INLINE int bucket_is_empty(hashtable_t *hashtable, bucket_t *bucket) -{ - return bucket->first == &hashtable->list && bucket->first == bucket->last; -} - -static void insert_to_bucket(hashtable_t *hashtable, bucket_t *bucket, - list_t *list) -{ - if(bucket_is_empty(hashtable, bucket)) - { - list_insert(&hashtable->list, list); - bucket->first = bucket->last = list; - } - else - { - list_insert(bucket->first, list); - bucket->first = list; - } -} - -static size_t primes[] = { - 5, 13, 23, 53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593, - 49157, 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, - 12582917, 25165843, 50331653, 100663319, 201326611, 402653189, - 805306457, 1610612741 -}; -static const size_t num_primes = sizeof(primes) / sizeof(size_t); - -static JSON_INLINE size_t num_buckets(hashtable_t *hashtable) -{ - return primes[hashtable->num_buckets]; -} - - -static pair_t *hashtable_find_pair(hashtable_t *hashtable, bucket_t *bucket, - const void *key, size_t hash) -{ - list_t *list; - pair_t *pair; - - if(bucket_is_empty(hashtable, bucket)) - return NULL; - - list = bucket->first; - while(1) - { - pair = list_to_pair(list); - if(pair->hash == hash && hashtable->cmp_keys(pair->key, key)) - return pair; - - if(list == bucket->last) - break; - - list = list->next; - } - - return NULL; -} - -/* returns 0 on success, -1 if key was not found */ -static int hashtable_do_del(hashtable_t *hashtable, - const void *key, size_t hash) -{ - pair_t *pair; - bucket_t *bucket; - size_t index; - - index = hash % num_buckets(hashtable); - bucket = &hashtable->buckets[index]; - - pair = hashtable_find_pair(hashtable, bucket, key, hash); - if(!pair) - return -1; - - if(&pair->list == bucket->first && &pair->list == bucket->last) - bucket->first = bucket->last = &hashtable->list; - - else if(&pair->list == bucket->first) - bucket->first = pair->list.next; - - else if(&pair->list == bucket->last) - bucket->last = pair->list.prev; - - list_remove(&pair->list); - - if(hashtable->free_key) - hashtable->free_key(pair->key); - if(hashtable->free_value) - hashtable->free_value(pair->value); - - jsonp_free(pair); - hashtable->size--; - - return 0; -} - -static void hashtable_do_clear(hashtable_t *hashtable) -{ - list_t *list, *next; - pair_t *pair; - - for(list = hashtable->list.next; list != &hashtable->list; list = next) - { - next = list->next; - pair = list_to_pair(list); - if(hashtable->free_key) - hashtable->free_key(pair->key); - if(hashtable->free_value) - hashtable->free_value(pair->value); - jsonp_free(pair); - } -} - -static int hashtable_do_rehash(hashtable_t *hashtable) -{ - list_t *list, *next; - pair_t *pair; - size_t i, index, new_size; - - jsonp_free(hashtable->buckets); - - hashtable->num_buckets++; - new_size = num_buckets(hashtable); - - hashtable->buckets = (struct hashtable_bucket *) jsonp_malloc(new_size * sizeof(bucket_t)); - if(!hashtable->buckets) - return -1; - - for(i = 0; i < num_buckets(hashtable); i++) - { - hashtable->buckets[i].first = hashtable->buckets[i].last = - &hashtable->list; - } - - list = hashtable->list.next; - list_init(&hashtable->list); - - for(; list != &hashtable->list; list = next) { - next = list->next; - pair = list_to_pair(list); - index = pair->hash % new_size; - insert_to_bucket(hashtable, &hashtable->buckets[index], &pair->list); - } - - return 0; -} - - -hashtable_t *hashtable_create(key_hash_fn hash_key, key_cmp_fn cmp_keys, - free_fn free_key, free_fn free_value) -{ - hashtable_t *hashtable = (hashtable_t *) jsonp_malloc(sizeof(hashtable_t)); - if(!hashtable) - return NULL; - - if(hashtable_init(hashtable, hash_key, cmp_keys, free_key, free_value)) - { - jsonp_free(hashtable); - return NULL; - } - - return hashtable; -} - -void hashtable_destroy(hashtable_t *hashtable) -{ - hashtable_close(hashtable); - jsonp_free(hashtable); -} - -int hashtable_init(hashtable_t *hashtable, - key_hash_fn hash_key, key_cmp_fn cmp_keys, - free_fn free_key, free_fn free_value) -{ - size_t i; - - hashtable->size = 0; - hashtable->num_buckets = 0; /* index to primes[] */ - hashtable->buckets = (struct hashtable_bucket *) jsonp_malloc(num_buckets(hashtable) * sizeof(bucket_t)); - if(!hashtable->buckets) - return -1; - - list_init(&hashtable->list); - - hashtable->hash_key = hash_key; - hashtable->cmp_keys = cmp_keys; - hashtable->free_key = free_key; - hashtable->free_value = free_value; - - for(i = 0; i < num_buckets(hashtable); i++) - { - hashtable->buckets[i].first = hashtable->buckets[i].last = - &hashtable->list; - } - - return 0; -} - -void hashtable_close(hashtable_t *hashtable) -{ - hashtable_do_clear(hashtable); - jsonp_free(hashtable->buckets); -} - -int hashtable_set(hashtable_t *hashtable, void *key, void *value) -{ - pair_t *pair; - bucket_t *bucket; - size_t hash, index; - - /* rehash if the load ratio exceeds 1 */ - if(hashtable->size >= num_buckets(hashtable)) - if(hashtable_do_rehash(hashtable)) - return -1; - - hash = hashtable->hash_key(key); - index = hash % num_buckets(hashtable); - bucket = &hashtable->buckets[index]; - pair = hashtable_find_pair(hashtable, bucket, key, hash); - - if(pair) - { - if(hashtable->free_key) - hashtable->free_key(key); - if(hashtable->free_value) - hashtable->free_value(pair->value); - pair->value = value; - } - else - { - pair = (pair_t *) jsonp_malloc(sizeof(pair_t)); - if(!pair) - return -1; - - pair->key = key; - pair->value = value; - pair->hash = hash; - list_init(&pair->list); - - insert_to_bucket(hashtable, bucket, &pair->list); - - hashtable->size++; - } - return 0; -} - -void *hashtable_get(hashtable_t *hashtable, const void *key) -{ - pair_t *pair; - size_t hash; - bucket_t *bucket; - - hash = hashtable->hash_key(key); - bucket = &hashtable->buckets[hash % num_buckets(hashtable)]; - - pair = hashtable_find_pair(hashtable, bucket, key, hash); - if(!pair) - return NULL; - - return pair->value; -} - -int hashtable_del(hashtable_t *hashtable, const void *key) -{ - size_t hash = hashtable->hash_key(key); - return hashtable_do_del(hashtable, key, hash); -} - -void hashtable_clear(hashtable_t *hashtable) -{ - size_t i; - - hashtable_do_clear(hashtable); - - for(i = 0; i < num_buckets(hashtable); i++) - { - hashtable->buckets[i].first = hashtable->buckets[i].last = - &hashtable->list; - } - - list_init(&hashtable->list); - hashtable->size = 0; -} - -void *hashtable_iter(hashtable_t *hashtable) -{ - return hashtable_iter_next(hashtable, &hashtable->list); -} - -void *hashtable_iter_at(hashtable_t *hashtable, const void *key) -{ - pair_t *pair; - size_t hash; - bucket_t *bucket; - - hash = hashtable->hash_key(key); - bucket = &hashtable->buckets[hash % num_buckets(hashtable)]; - - pair = hashtable_find_pair(hashtable, bucket, key, hash); - if(!pair) - return NULL; - - return &pair->list; -} - -void *hashtable_iter_next(hashtable_t *hashtable, void *iter) -{ - list_t *list = (list_t *)iter; - if(list->next == &hashtable->list) - return NULL; - return list->next; -} - -void *hashtable_iter_key(void *iter) -{ - pair_t *pair = list_to_pair((list_t *)iter); - return pair->key; -} - -void *hashtable_iter_value(void *iter) -{ - pair_t *pair = list_to_pair((list_t *)iter); - return pair->value; -} - -void hashtable_iter_set(hashtable_t *hashtable, void *iter, void *value) -{ - pair_t *pair = list_to_pair((list_t *)iter); - - if(hashtable->free_value) - hashtable->free_value(pair->value); - - pair->value = value; -} diff --git a/lang/c/jansson/src/hashtable.h b/lang/c/jansson/src/hashtable.h deleted file mode 100644 index aa295e6f995..00000000000 --- a/lang/c/jansson/src/hashtable.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#ifndef HASHTABLE_H -#define HASHTABLE_H -#ifdef __cplusplus -extern "C" { -#define CLOSE_EXTERN } -#else -#define CLOSE_EXTERN -#endif - -#pragma GCC visibility push(hidden) - -typedef size_t (*key_hash_fn)(const void *key); -typedef int (*key_cmp_fn)(const void *key1, const void *key2); -typedef void (*free_fn)(void *key); - -struct hashtable_list { - struct hashtable_list *prev; - struct hashtable_list *next; -}; - -struct hashtable_pair { - void *key; - void *value; - size_t hash; - struct hashtable_list list; -}; - -struct hashtable_bucket { - struct hashtable_list *first; - struct hashtable_list *last; -}; - -typedef struct hashtable { - size_t size; - struct hashtable_bucket *buckets; - size_t num_buckets; /* index to primes[] */ - struct hashtable_list list; - - key_hash_fn hash_key; - key_cmp_fn cmp_keys; /* returns non-zero for equal keys */ - free_fn free_key; - free_fn free_value; -} hashtable_t; - -/** - * hashtable_create - Create a hashtable object - * - * @hash_key: The key hashing function - * @cmp_keys: The key compare function. Returns non-zero for equal and - * zero for unequal unequal keys - * @free_key: If non-NULL, called for a key that is no longer referenced. - * @free_value: If non-NULL, called for a value that is no longer referenced. - * - * Returns a new hashtable object that should be freed with - * hashtable_destroy when it's no longer used, or NULL on failure (out - * of memory). - */ -hashtable_t *hashtable_create(key_hash_fn hash_key, key_cmp_fn cmp_keys, - free_fn free_key, free_fn free_value); - -/** - * hashtable_destroy - Destroy a hashtable object - * - * @hashtable: The hashtable - * - * Destroys a hashtable created with hashtable_create(). - */ -void hashtable_destroy(hashtable_t *hashtable); - -/** - * hashtable_init - Initialize a hashtable object - * - * @hashtable: The (statically allocated) hashtable object - * @hash_key: The key hashing function - * @cmp_keys: The key compare function. Returns non-zero for equal and - * zero for unequal unequal keys - * @free_key: If non-NULL, called for a key that is no longer referenced. - * @free_value: If non-NULL, called for a value that is no longer referenced. - * - * Initializes a statically allocated hashtable object. The object - * should be cleared with hashtable_close when it's no longer used. - * - * Returns 0 on success, -1 on error (out of memory). - */ -int hashtable_init(hashtable_t *hashtable, - key_hash_fn hash_key, key_cmp_fn cmp_keys, - free_fn free_key, free_fn free_value); - -/** - * hashtable_close - Release all resources used by a hashtable object - * - * @hashtable: The hashtable - * - * Destroys a statically allocated hashtable object. - */ -void hashtable_close(hashtable_t *hashtable); - -/** - * hashtable_set - Add/modify value in hashtable - * - * @hashtable: The hashtable object - * @key: The key - * @value: The value - * - * If a value with the given key already exists, its value is replaced - * with the new value. - * - * Key and value are "stealed" in the sense that hashtable frees them - * automatically when they are no longer used. The freeing is - * accomplished by calling free_key and free_value functions that were - * supplied to hashtable_new. In case one or both of the free - * functions is NULL, the corresponding item is not "stealed". - * - * Returns 0 on success, -1 on failure (out of memory). - */ -int hashtable_set(hashtable_t *hashtable, void *key, void *value); - -/** - * hashtable_get - Get a value associated with a key - * - * @hashtable: The hashtable object - * @key: The key - * - * Returns value if it is found, or NULL otherwise. - */ -void *hashtable_get(hashtable_t *hashtable, const void *key); - -/** - * hashtable_del - Remove a value from the hashtable - * - * @hashtable: The hashtable object - * @key: The key - * - * Returns 0 on success, or -1 if the key was not found. - */ -int hashtable_del(hashtable_t *hashtable, const void *key); - -/** - * hashtable_clear - Clear hashtable - * - * @hashtable: The hashtable object - * - * Removes all items from the hashtable. - */ -void hashtable_clear(hashtable_t *hashtable); - -/** - * hashtable_iter - Iterate over hashtable - * - * @hashtable: The hashtable object - * - * Returns an opaque iterator to the first element in the hashtable. - * The iterator should be passed to hashtable_iter_* functions. - * The hashtable items are not iterated over in any particular order. - * - * There's no need to free the iterator in any way. The iterator is - * valid as long as the item that is referenced by the iterator is not - * deleted. Other values may be added or deleted. In particular, - * hashtable_iter_next() may be called on an iterator, and after that - * the key/value pair pointed by the old iterator may be deleted. - */ -void *hashtable_iter(hashtable_t *hashtable); - -/** - * hashtable_iter_at - Return an iterator at a specific key - * - * @hashtable: The hashtable object - * @key: The key that the iterator should point to - * - * Like hashtable_iter() but returns an iterator pointing to a - * specific key. - */ -void *hashtable_iter_at(hashtable_t *hashtable, const void *key); - -/** - * hashtable_iter_next - Advance an iterator - * - * @hashtable: The hashtable object - * @iter: The iterator - * - * Returns a new iterator pointing to the next element in the - * hashtable or NULL if the whole hastable has been iterated over. - */ -void *hashtable_iter_next(hashtable_t *hashtable, void *iter); - -/** - * hashtable_iter_key - Retrieve the key pointed by an iterator - * - * @iter: The iterator - */ -void *hashtable_iter_key(void *iter); - -/** - * hashtable_iter_value - Retrieve the value pointed by an iterator - * - * @iter: The iterator - */ -void *hashtable_iter_value(void *iter); - -/** - * hashtable_iter_set - Set the value pointed by an iterator - * - * @iter: The iterator - * @value: The value to set - */ -void hashtable_iter_set(hashtable_t *hashtable, void *iter, void *value); - -#pragma GCC visibility pop - -CLOSE_EXTERN -#endif diff --git a/lang/c/jansson/src/jansson.h b/lang/c/jansson/src/jansson.h deleted file mode 100644 index a0e678587d1..00000000000 --- a/lang/c/jansson/src/jansson.h +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#ifndef JANSSON_H -#define JANSSON_H - -#include -#include /* for size_t */ -#include - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#pragma GCC visibility push(hidden) - -/* version */ - -#define JANSSON_MAJOR_VERSION 2 -#define JANSSON_MINOR_VERSION 1 -#define JANSSON_MICRO_VERSION 0 - -/* Micro version is omitted if it's 0 */ -#define JANSSON_VERSION "2.1" - -/* Version as a 3-byte hex number, e.g. 0x010201 == 1.2.1. Use this - for numeric comparisons, e.g. #if JANSSON_VERSION_HEX >= ... */ -#define JANSSON_VERSION_HEX ((JANSSON_MAJOR_VERSION << 16) | \ - (JANSSON_MINOR_VERSION << 8) | \ - (JANSSON_MICRO_VERSION << 0)) - - -/* types */ - -typedef enum { - JSON_OBJECT, - JSON_ARRAY, - JSON_STRING, - JSON_INTEGER, - JSON_REAL, - JSON_TRUE, - JSON_FALSE, - JSON_NULL -} json_type; - -typedef struct { - json_type type; - size_t refcount; -} json_t; - -#if JSON_INTEGER_IS_LONG_LONG -#define JSON_INTEGER_FORMAT "lld" -typedef long long json_int_t; -#else -#define JSON_INTEGER_FORMAT "ld" -typedef long json_int_t; -#endif /* JSON_INTEGER_IS_LONG_LONG */ - -#define json_typeof(json) ((json)->type) -#define json_is_object(json) (json && json_typeof(json) == JSON_OBJECT) -#define json_is_array(json) (json && json_typeof(json) == JSON_ARRAY) -#define json_is_string(json) (json && json_typeof(json) == JSON_STRING) -#define json_is_integer(json) (json && json_typeof(json) == JSON_INTEGER) -#define json_is_real(json) (json && json_typeof(json) == JSON_REAL) -#define json_is_number(json) (json_is_integer(json) || json_is_real(json)) -#define json_is_true(json) (json && json_typeof(json) == JSON_TRUE) -#define json_is_false(json) (json && json_typeof(json) == JSON_FALSE) -#define json_is_boolean(json) (json_is_true(json) || json_is_false(json)) -#define json_is_null(json) (json && json_typeof(json) == JSON_NULL) - -/* construction, destruction, reference counting */ - -json_t *json_object(void); -json_t *json_array(void); -json_t *json_string(const char *value); -json_t *json_string_nocheck(const char *value); -json_t *json_integer(json_int_t value); -json_t *json_real(double value); -json_t *json_true(void); -json_t *json_false(void); -json_t *json_null(void); - -static JSON_INLINE -json_t *json_incref(json_t *json) -{ - if(json && json->refcount != (size_t)-1) - ++json->refcount; - return json; -} - -/* do not call json_delete directly */ -void json_delete(json_t *json); - -static JSON_INLINE -void json_decref(json_t *json) -{ - if(json && json->refcount != (size_t)-1 && --json->refcount == 0) - json_delete(json); -} - - -/* error reporting */ - -#define JSON_ERROR_TEXT_LENGTH 160 -#define JSON_ERROR_SOURCE_LENGTH 80 - -typedef struct { - int line; - int column; - int position; - char source[JSON_ERROR_SOURCE_LENGTH]; - char text[JSON_ERROR_TEXT_LENGTH]; -} json_error_t; - - -/* getters, setters, manipulation */ - -size_t json_object_size(const json_t *object); -json_t *json_object_get(const json_t *object, const char *key); -int json_object_set_new(json_t *object, const char *key, json_t *value); -int json_object_set_new_nocheck(json_t *object, const char *key, json_t *value); -int json_object_del(json_t *object, const char *key); -int json_object_clear(json_t *object); -int json_object_update(json_t *object, json_t *other); -void *json_object_iter(json_t *object); -void *json_object_iter_at(json_t *object, const char *key); -void *json_object_iter_next(json_t *object, void *iter); -const char *json_object_iter_key(void *iter); -json_t *json_object_iter_value(void *iter); -int json_object_iter_set_new(json_t *object, void *iter, json_t *value); - -static JSON_INLINE -int json_object_set(json_t *object, const char *key, json_t *value) -{ - return json_object_set_new(object, key, json_incref(value)); -} - -static JSON_INLINE -int json_object_set_nocheck(json_t *object, const char *key, json_t *value) -{ - return json_object_set_new_nocheck(object, key, json_incref(value)); -} - -static JSON_INLINE -int json_object_iter_set(json_t *object, void *iter, json_t *value) -{ - return json_object_iter_set_new(object, iter, json_incref(value)); -} - -size_t json_array_size(const json_t *array); -json_t *json_array_get(const json_t *array, size_t index); -int json_array_set_new(json_t *array, size_t index, json_t *value); -int json_array_append_new(json_t *array, json_t *value); -int json_array_insert_new(json_t *array, size_t index, json_t *value); -int json_array_remove(json_t *array, size_t index); -int json_array_clear(json_t *array); -int json_array_extend(json_t *array, json_t *other); - -static JSON_INLINE -int json_array_set(json_t *array, size_t index, json_t *value) -{ - return json_array_set_new(array, index, json_incref(value)); -} - -static JSON_INLINE -int json_array_append(json_t *array, json_t *value) -{ - return json_array_append_new(array, json_incref(value)); -} - -static JSON_INLINE -int json_array_insert(json_t *array, size_t index, json_t *value) -{ - return json_array_insert_new(array, index, json_incref(value)); -} - -const char *json_string_value(const json_t *string); -json_int_t json_integer_value(const json_t *integer); -double json_real_value(const json_t *real); -double json_number_value(const json_t *json); - -int json_string_set(json_t *string, const char *value); -int json_string_set_nocheck(json_t *string, const char *value); -int json_integer_set(json_t *integer, json_int_t value); -int json_real_set(json_t *real, double value); - - -/* pack, unpack */ - -json_t *json_pack(const char *fmt, ...); -json_t *json_pack_ex(json_error_t *error, size_t flags, const char *fmt, ...); -json_t *json_vpack_ex(json_error_t *error, size_t flags, const char *fmt, va_list ap); - -#define JSON_VALIDATE_ONLY 0x1 -#define JSON_STRICT 0x2 - -int json_unpack(json_t *root, const char *fmt, ...); -int json_unpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, ...); -int json_vunpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, va_list ap); - - -/* equality */ - -int json_equal(json_t *value1, json_t *value2); - - -/* copying */ - -json_t *json_copy(json_t *value); -json_t *json_deep_copy(json_t *value); - - -/* decoding */ - -#define JSON_REJECT_DUPLICATES 0x1 -#define JSON_DISABLE_EOF_CHECK 0x2 - -json_t *json_loads(const char *input, size_t flags, json_error_t *error); -json_t *json_loadb(const char *buffer, size_t buflen, size_t flags, json_error_t *error); -json_t *json_loadf(FILE *input, size_t flags, json_error_t *error); -json_t *json_load_file(const char *path, size_t flags, json_error_t *error); - - -/* encoding */ - -#define JSON_INDENT(n) (n & 0x1F) -#define JSON_COMPACT 0x20 -#define JSON_ENSURE_ASCII 0x40 -#define JSON_SORT_KEYS 0x80 -#define JSON_PRESERVE_ORDER 0x100 -#define JSON_ENCODE_ANY 0x200 - -char *json_dumps(const json_t *json, size_t flags); -int json_dumpf(const json_t *json, FILE *output, size_t flags); -int json_dump_file(const json_t *json, const char *path, size_t flags); - - -/* custom memory allocation */ - -typedef void *(*json_malloc_t)(size_t); -typedef void (*json_free_t)(void *); - -void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn); - -#pragma GCC visibility pop - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/lang/c/jansson/src/jansson_config.h b/lang/c/jansson/src/jansson_config.h deleted file mode 100644 index b3bb72a4cf3..00000000000 --- a/lang/c/jansson/src/jansson_config.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2010-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - * - * - * This file specifies a part of the site-specific configuration for - * Jansson, namely those things that affect the public API in - * jansson.h. - * - * The configure script copies this file to jansson_config.h and - * replaces @var@ substitutions by values that fit your system. If you - * cannot run the configure script, you can do the value substitution - * by hand. - */ - -#ifndef JANSSON_CONFIG_H -#define JANSSON_CONFIG_H - -/* If your compiler supports the inline keyword in C, JSON_INLINE is - defined to `inline', otherwise empty. In C++, the inline is always - supported. */ -#ifdef __cplusplus -#define JSON_INLINE inline -#else -#define JSON_INLINE inline -#endif - -/* If your compiler supports the `long long` type, - JSON_INTEGER_IS_LONG_LONG is defined to 1, otherwise to 0. */ -#define JSON_INTEGER_IS_LONG_LONG 1 - -#endif diff --git a/lang/c/jansson/src/jansson_config.h.in b/lang/c/jansson/src/jansson_config.h.in deleted file mode 100644 index 7f519cd6455..00000000000 --- a/lang/c/jansson/src/jansson_config.h.in +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2010-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - * - * - * This file specifies a part of the site-specific configuration for - * Jansson, namely those things that affect the public API in - * jansson.h. - * - * The configure script copies this file to jansson_config.h and - * replaces @var@ substitutions by values that fit your system. If you - * cannot run the configure script, you can do the value substitution - * by hand. - */ - -#ifndef JANSSON_CONFIG_H -#define JANSSON_CONFIG_H - -/* If your compiler supports the inline keyword in C, JSON_INLINE is - defined to `inline', otherwise empty. In C++, the inline is always - supported. */ -#ifdef __cplusplus -#define JSON_INLINE inline -#else -#define JSON_INLINE @json_inline@ -#endif - -/* If your compiler supports the `long long` type, - JSON_INTEGER_IS_LONG_LONG is defined to 1, otherwise to 0. */ -#define JSON_INTEGER_IS_LONG_LONG @json_have_long_long@ - -#endif diff --git a/lang/c/jansson/src/jansson_private.h b/lang/c/jansson/src/jansson_private.h deleted file mode 100644 index 722220c4482..00000000000 --- a/lang/c/jansson/src/jansson_private.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#ifndef JANSSON_PRIVATE_H -#define JANSSON_PRIVATE_H -#ifdef __cplusplus -extern "C" { -#define CLOSE_EXTERN } -#else -#define CLOSE_EXTERN -#endif - -#include -#include "jansson.h" -#include "hashtable.h" - -#pragma GCC visibility push(hidden) - -#ifdef _WIN32 -#define snprintf _snprintf -#endif - -#define container_of(ptr_, type_, member_) \ - ((type_ *)((char *)ptr_ - offsetof(type_, member_))) - -/* On some platforms, max() may already be defined */ -#ifndef max -#define max(a, b) ((a) > (b) ? (a) : (b)) -#endif - -/* va_copy is a C99 feature. In C89 implementations, it's sometimes - available as __va_copy. If not, memcpy() should do the trick. */ -#ifndef va_copy -#ifdef __va_copy -#define va_copy __va_copy -#else -#define va_copy(a, b) memcpy(&(a), &(b), sizeof(va_list)) -#endif -#endif - -typedef struct { - json_t json; - hashtable_t hashtable; - size_t serial; - int visited; -} json_object_t; - -typedef struct { - json_t json; - size_t size; - size_t entries; - json_t **table; - int visited; -} json_array_t; - -typedef struct { - json_t json; - char *value; -} json_string_t; - -typedef struct { - json_t json; - double value; -} json_real_t; - -typedef struct { - json_t json; - json_int_t value; -} json_integer_t; - -#define json_to_object(json_) container_of(json_, json_object_t, json) -#define json_to_array(json_) container_of(json_, json_array_t, json) -#define json_to_string(json_) container_of(json_, json_string_t, json) -#define json_to_real(json_) container_of(json_, json_real_t, json) -#define json_to_integer(json_) container_of(json_, json_integer_t, json) - -size_t jsonp_hash_str(const void *ptr); -int jsonp_str_equal(const void *ptr1, const void *ptr2); - -typedef struct { - size_t serial; - char key[1]; -} object_key_t; - -const object_key_t *jsonp_object_iter_fullkey(void *iter); - -void jsonp_error_init(json_error_t *error, const char *source); -void jsonp_error_set_source(json_error_t *error, const char *source); -void jsonp_error_set(json_error_t *error, int line, int column, - size_t position, const char *msg, ...); -void jsonp_error_vset(json_error_t *error, int line, int column, - size_t position, const char *msg, va_list ap); - -/* Wrappers for custom memory functions */ -void* jsonp_malloc(size_t size); -void jsonp_free(void *ptr); -char *jsonp_strdup(const char *str); - -#pragma GCC visibility pop - -CLOSE_EXTERN -#endif diff --git a/lang/c/jansson/src/load.c b/lang/c/jansson/src/load.c deleted file mode 100644 index 338f3c11c02..00000000000 --- a/lang/c/jansson/src/load.c +++ /dev/null @@ -1,964 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#define _GNU_SOURCE -#include -#include -#include -#include -#include -#include -#include - -#include -#include "jansson_private.h" -#include "strbuffer.h" -#include "utf.h" - -#define STREAM_STATE_OK 0 -#define STREAM_STATE_EOF -1 -#define STREAM_STATE_ERROR -2 - -#define TOKEN_INVALID -1 -#define TOKEN_EOF 0 -#define TOKEN_STRING 256 -#define TOKEN_INTEGER 257 -#define TOKEN_REAL 258 -#define TOKEN_TRUE 259 -#define TOKEN_FALSE 260 -#define TOKEN_NULL 261 - -/* Read one byte from stream, convert to unsigned char, then int, and - return. return EOF on end of file. This corresponds to the - behaviour of fgetc(). */ -typedef int (*get_func)(void *data); - -typedef struct { - get_func get; - void *data; - char buffer[5]; - int buffer_pos; - int state; - int line; - int column, last_column; - size_t position; -} stream_t; - -typedef struct { - stream_t stream; - strbuffer_t saved_text; - int token; - union { - char *string; - json_int_t integer; - double real; - } value; -} lex_t; - -#define stream_to_lex(stream) container_of(stream, lex_t, stream) - - -/*** error reporting ***/ - -static void error_set(json_error_t *error, const lex_t *lex, - const char *msg, ...) -{ - va_list ap; - char msg_text[JSON_ERROR_TEXT_LENGTH]; - - int line = -1, col = -1; - size_t pos = 0; - const char *result = msg_text; - - if(!error) - return; - - va_start(ap, msg); - vsnprintf(msg_text, JSON_ERROR_TEXT_LENGTH, msg, ap); - va_end(ap); - - if(lex) - { - const char *saved_text = strbuffer_value(&lex->saved_text); - char msg_with_context[JSON_ERROR_TEXT_LENGTH]; - - line = lex->stream.line; - col = lex->stream.column; - pos = lex->stream.position; - - if(saved_text && saved_text[0]) - { - if(lex->saved_text.length <= 20) { - snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH, - "%s near '%s'", msg_text, saved_text); - result = msg_with_context; - } - } - else - { - if(lex->stream.state == STREAM_STATE_ERROR) { - /* No context for UTF-8 decoding errors */ - result = msg_text; - } - else { - snprintf(msg_with_context, JSON_ERROR_TEXT_LENGTH, - "%s near end of file", msg_text); - result = msg_with_context; - } - } - } - - jsonp_error_set(error, line, col, pos, "%s", result); -} - - -/*** lexical analyzer ***/ - -static void -stream_init(stream_t *stream, get_func get, void *data) -{ - stream->get = get; - stream->data = data; - stream->buffer[0] = '\0'; - stream->buffer_pos = 0; - - stream->state = STREAM_STATE_OK; - stream->line = 1; - stream->column = 0; - stream->position = 0; -} - -static int stream_get(stream_t *stream, json_error_t *error) -{ - int c; - - if(stream->state != STREAM_STATE_OK) - return stream->state; - - if(!stream->buffer[stream->buffer_pos]) - { - c = stream->get(stream->data); - if(c == EOF) { - stream->state = STREAM_STATE_EOF; - return STREAM_STATE_EOF; - } - - stream->buffer[0] = c; - stream->buffer_pos = 0; - - if(0x80 <= c && c <= 0xFF) - { - /* multi-byte UTF-8 sequence */ - int i, count; - - count = utf8_check_first(c); - if(!count) - goto out; - - assert(count >= 2); - - for(i = 1; i < count; i++) - stream->buffer[i] = stream->get(stream->data); - - if(!utf8_check_full(stream->buffer, count, NULL)) - goto out; - - stream->buffer[count] = '\0'; - } - else - stream->buffer[1] = '\0'; - } - - c = stream->buffer[stream->buffer_pos++]; - - stream->position++; - if(c == '\n') { - stream->line++; - stream->last_column = stream->column; - stream->column = 0; - } - else if(utf8_check_first(c)) { - /* track the Unicode character column, so increment only if - this is the first character of a UTF-8 sequence */ - stream->column++; - } - - return c; - -out: - stream->state = STREAM_STATE_ERROR; - error_set(error, stream_to_lex(stream), "unable to decode byte 0x%x", c); - return STREAM_STATE_ERROR; -} - -static void stream_unget(stream_t *stream, int c) -{ - if(c == STREAM_STATE_EOF || c == STREAM_STATE_ERROR) - return; - - stream->position--; - if(c == '\n') { - stream->line--; - stream->column = stream->last_column; - } - else if(utf8_check_first(c)) - stream->column--; - - assert(stream->buffer_pos > 0); - stream->buffer_pos--; - assert(stream->buffer[stream->buffer_pos] == c); -} - - -static int lex_get(lex_t *lex, json_error_t *error) -{ - return stream_get(&lex->stream, error); -} - -static void lex_save(lex_t *lex, int c) -{ - strbuffer_append_byte(&lex->saved_text, c); -} - -static int lex_get_save(lex_t *lex, json_error_t *error) -{ - int c = stream_get(&lex->stream, error); - if(c != STREAM_STATE_EOF && c != STREAM_STATE_ERROR) - lex_save(lex, c); - return c; -} - -static void lex_unget(lex_t *lex, int c) -{ - stream_unget(&lex->stream, c); -} - -static void lex_unget_unsave(lex_t *lex, int c) -{ - if(c != STREAM_STATE_EOF && c != STREAM_STATE_ERROR) { - char d; - stream_unget(&lex->stream, c); - d = strbuffer_pop(&lex->saved_text); - assert(c == d); - } -} - -static void lex_save_cached(lex_t *lex) -{ - while(lex->stream.buffer[lex->stream.buffer_pos] != '\0') - { - lex_save(lex, lex->stream.buffer[lex->stream.buffer_pos]); - lex->stream.buffer_pos++; - lex->stream.position++; - } -} - -/* assumes that str points to 'u' plus at least 4 valid hex digits */ -static int32_t decode_unicode_escape(const char *str) -{ - int i; - int32_t value = 0; - - assert(str[0] == 'u'); - - for(i = 1; i <= 4; i++) { - char c = str[i]; - value <<= 4; - if(isdigit(c)) - value += c - '0'; - else if(islower(c)) - value += c - 'a' + 10; - else if(isupper(c)) - value += c - 'A' + 10; - else - assert(0); - } - - return value; -} - -static void lex_scan_string(lex_t *lex, json_error_t *error) -{ - int c; - const char *p; - char *t; - int i; - - lex->value.string = NULL; - lex->token = TOKEN_INVALID; - - c = lex_get_save(lex, error); - - while(c != '"') { - if(c == STREAM_STATE_ERROR) - goto out; - - else if(c == STREAM_STATE_EOF) { - error_set(error, lex, "premature end of input"); - goto out; - } - - else if(0 <= c && c <= 0x1F) { - /* control character */ - lex_unget_unsave(lex, c); - if(c == '\n') - error_set(error, lex, "unexpected newline", c); - else - error_set(error, lex, "control character 0x%x", c); - goto out; - } - - else if(c == '\\') { - c = lex_get_save(lex, error); - if(c == 'u') { - c = lex_get_save(lex, error); - for(i = 0; i < 4; i++) { - if(!isxdigit(c)) { - error_set(error, lex, "invalid escape"); - goto out; - } - c = lex_get_save(lex, error); - } - } - else if(c == '"' || c == '\\' || c == '/' || c == 'b' || - c == 'f' || c == 'n' || c == 'r' || c == 't') - c = lex_get_save(lex, error); - else { - error_set(error, lex, "invalid escape"); - goto out; - } - } - else - c = lex_get_save(lex, error); - } - - /* the actual value is at most of the same length as the source - string, because: - - shortcut escapes (e.g. "\t") (length 2) are converted to 1 byte - - a single \uXXXX escape (length 6) is converted to at most 3 bytes - - two \uXXXX escapes (length 12) forming an UTF-16 surrogate pair - are converted to 4 bytes - */ - lex->value.string = (char *) jsonp_malloc(lex->saved_text.length + 1); - if(!lex->value.string) { - /* this is not very nice, since TOKEN_INVALID is returned */ - goto out; - } - - /* the target */ - t = lex->value.string; - - /* + 1 to skip the " */ - p = strbuffer_value(&lex->saved_text) + 1; - - while(*p != '"') { - if(*p == '\\') { - p++; - if(*p == 'u') { - char buffer[4]; - int length; - int32_t value; - - value = decode_unicode_escape(p); - p += 5; - - if(0xD800 <= value && value <= 0xDBFF) { - /* surrogate pair */ - if(*p == '\\' && *(p + 1) == 'u') { - int32_t value2 = decode_unicode_escape(++p); - p += 5; - - if(0xDC00 <= value2 && value2 <= 0xDFFF) { - /* valid second surrogate */ - value = - ((value - 0xD800) << 10) + - (value2 - 0xDC00) + - 0x10000; - } - else { - /* invalid second surrogate */ - error_set(error, lex, - "invalid Unicode '\\u%04X\\u%04X'", - value, value2); - goto out; - } - } - else { - /* no second surrogate */ - error_set(error, lex, "invalid Unicode '\\u%04X'", - value); - goto out; - } - } - else if(0xDC00 <= value && value <= 0xDFFF) { - error_set(error, lex, "invalid Unicode '\\u%04X'", value); - goto out; - } - else if(value == 0) - { - error_set(error, lex, "\\u0000 is not allowed"); - goto out; - } - - if(utf8_encode(value, buffer, &length)) - assert(0); - - memcpy(t, buffer, length); - t += length; - } - else { - switch(*p) { - case '"': case '\\': case '/': - *t = *p; break; - case 'b': *t = '\b'; break; - case 'f': *t = '\f'; break; - case 'n': *t = '\n'; break; - case 'r': *t = '\r'; break; - case 't': *t = '\t'; break; - default: assert(0); - } - t++; - p++; - } - } - else - *(t++) = *(p++); - } - *t = '\0'; - lex->token = TOKEN_STRING; - return; - -out: - jsonp_free(lex->value.string); -} - -#if JSON_INTEGER_IS_LONG_LONG -#ifdef _WIN32 -#define json_strtoint _strtoi64 -#else -#define json_strtoint strtoll -#endif -#else -#define json_strtoint strtol -#endif - -static int lex_scan_number(lex_t *lex, int c, json_error_t *error) -{ - const char *saved_text; - char *end; - double value; - - lex->token = TOKEN_INVALID; - - if(c == '-') - c = lex_get_save(lex, error); - - if(c == '0') { - c = lex_get_save(lex, error); - if(isdigit(c)) { - lex_unget_unsave(lex, c); - goto out; - } - } - else if(isdigit(c)) { - c = lex_get_save(lex, error); - while(isdigit(c)) - c = lex_get_save(lex, error); - } - else { - lex_unget_unsave(lex, c); - goto out; - } - - if(c != '.' && c != 'E' && c != 'e') { - json_int_t value; - - lex_unget_unsave(lex, c); - - saved_text = strbuffer_value(&lex->saved_text); - - errno = 0; - value = json_strtoint(saved_text, &end, 10); - if(errno == ERANGE) { - if(value < 0) - error_set(error, lex, "too big negative integer"); - else - error_set(error, lex, "too big integer"); - goto out; - } - - assert(end == saved_text + lex->saved_text.length); - - lex->token = TOKEN_INTEGER; - lex->value.integer = value; - return 0; - } - - if(c == '.') { - c = lex_get(lex, error); - if(!isdigit(c)) { - lex_unget(lex, c); - goto out; - } - lex_save(lex, c); - - c = lex_get_save(lex, error); - while(isdigit(c)) - c = lex_get_save(lex, error); - } - - if(c == 'E' || c == 'e') { - c = lex_get_save(lex, error); - if(c == '+' || c == '-') - c = lex_get_save(lex, error); - - if(!isdigit(c)) { - lex_unget_unsave(lex, c); - goto out; - } - - c = lex_get_save(lex, error); - while(isdigit(c)) - c = lex_get_save(lex, error); - } - - lex_unget_unsave(lex, c); - - saved_text = strbuffer_value(&lex->saved_text); - errno = 0; - value = strtod(saved_text, &end); - assert(end == saved_text + lex->saved_text.length); - - if(errno == ERANGE && value != 0) { - error_set(error, lex, "real number overflow"); - goto out; - } - - lex->token = TOKEN_REAL; - lex->value.real = value; - return 0; - -out: - return -1; -} - -static int lex_scan(lex_t *lex, json_error_t *error) -{ - int c; - - strbuffer_clear(&lex->saved_text); - - if(lex->token == TOKEN_STRING) { - jsonp_free(lex->value.string); - lex->value.string = NULL; - } - - c = lex_get(lex, error); - while(c == ' ' || c == '\t' || c == '\n' || c == '\r') - c = lex_get(lex, error); - - if(c == STREAM_STATE_EOF) { - lex->token = TOKEN_EOF; - goto out; - } - - if(c == STREAM_STATE_ERROR) { - lex->token = TOKEN_INVALID; - goto out; - } - - lex_save(lex, c); - - if(c == '{' || c == '}' || c == '[' || c == ']' || c == ':' || c == ',') - lex->token = c; - - else if(c == '"') - lex_scan_string(lex, error); - - else if(isdigit(c) || c == '-') { - if(lex_scan_number(lex, c, error)) - goto out; - } - - else if(isupper(c) || islower(c)) { - /* eat up the whole identifier for clearer error messages */ - const char *saved_text; - - c = lex_get_save(lex, error); - while(isupper(c) || islower(c)) - c = lex_get_save(lex, error); - lex_unget_unsave(lex, c); - - saved_text = strbuffer_value(&lex->saved_text); - - if(strcmp(saved_text, "true") == 0) - lex->token = TOKEN_TRUE; - else if(strcmp(saved_text, "false") == 0) - lex->token = TOKEN_FALSE; - else if(strcmp(saved_text, "null") == 0) - lex->token = TOKEN_NULL; - else - lex->token = TOKEN_INVALID; - } - - else { - /* save the rest of the input UTF-8 sequence to get an error - message of valid UTF-8 */ - lex_save_cached(lex); - lex->token = TOKEN_INVALID; - } - -out: - return lex->token; -} - -static char *lex_steal_string(lex_t *lex) -{ - char *result = NULL; - if(lex->token == TOKEN_STRING) - { - result = lex->value.string; - lex->value.string = NULL; - } - return result; -} - -static int lex_init(lex_t *lex, get_func get, void *data) -{ - stream_init(&lex->stream, get, data); - if(strbuffer_init(&lex->saved_text)) - return -1; - - lex->token = TOKEN_INVALID; - return 0; -} - -static void lex_close(lex_t *lex) -{ - if(lex->token == TOKEN_STRING) - jsonp_free(lex->value.string); - strbuffer_close(&lex->saved_text); -} - - -/*** parser ***/ - -static json_t *parse_value(lex_t *lex, size_t flags, json_error_t *error); - -static json_t *parse_object(lex_t *lex, size_t flags, json_error_t *error) -{ - json_t *object = json_object(); - if(!object) - return NULL; - - lex_scan(lex, error); - if(lex->token == '}') - return object; - - while(1) { - char *key; - json_t *value; - - if(lex->token != TOKEN_STRING) { - error_set(error, lex, "string or '}' expected"); - goto error; - } - - key = lex_steal_string(lex); - if(!key) - return NULL; - - if(flags & JSON_REJECT_DUPLICATES) { - if(json_object_get(object, key)) { - jsonp_free(key); - error_set(error, lex, "duplicate object key"); - goto error; - } - } - - lex_scan(lex, error); - if(lex->token != ':') { - jsonp_free(key); - error_set(error, lex, "':' expected"); - goto error; - } - - lex_scan(lex, error); - value = parse_value(lex, flags, error); - if(!value) { - jsonp_free(key); - goto error; - } - - if(json_object_set_nocheck(object, key, value)) { - jsonp_free(key); - json_decref(value); - goto error; - } - - json_decref(value); - jsonp_free(key); - - lex_scan(lex, error); - if(lex->token != ',') - break; - - lex_scan(lex, error); - } - - if(lex->token != '}') { - error_set(error, lex, "'}' expected"); - goto error; - } - - return object; - -error: - json_decref(object); - return NULL; -} - -static json_t *parse_array(lex_t *lex, size_t flags, json_error_t *error) -{ - json_t *array = json_array(); - if(!array) - return NULL; - - lex_scan(lex, error); - if(lex->token == ']') - return array; - - while(lex->token) { - json_t *elem = parse_value(lex, flags, error); - if(!elem) - goto error; - - if(json_array_append(array, elem)) { - json_decref(elem); - goto error; - } - json_decref(elem); - - lex_scan(lex, error); - if(lex->token != ',') - break; - - lex_scan(lex, error); - } - - if(lex->token != ']') { - error_set(error, lex, "']' expected"); - goto error; - } - - return array; - -error: - json_decref(array); - return NULL; -} - -static json_t *parse_value(lex_t *lex, size_t flags, json_error_t *error) -{ - json_t *json; - - switch(lex->token) { - case TOKEN_STRING: { - json = json_string_nocheck(lex->value.string); - break; - } - - case TOKEN_INTEGER: { - json = json_integer(lex->value.integer); - break; - } - - case TOKEN_REAL: { - json = json_real(lex->value.real); - break; - } - - case TOKEN_TRUE: - json = json_true(); - break; - - case TOKEN_FALSE: - json = json_false(); - break; - - case TOKEN_NULL: - json = json_null(); - break; - - case '{': - json = parse_object(lex, flags, error); - break; - - case '[': - json = parse_array(lex, flags, error); - break; - - case TOKEN_INVALID: - error_set(error, lex, "invalid token"); - return NULL; - - default: - error_set(error, lex, "unexpected token"); - return NULL; - } - - if(!json) - return NULL; - - return json; -} - -static json_t *parse_json(lex_t *lex, size_t flags, json_error_t *error) -{ - json_t *result; - - lex_scan(lex, error); - if(lex->token != '[' && lex->token != '{') { - error_set(error, lex, "'[' or '{' expected"); - return NULL; - } - - result = parse_value(lex, flags, error); - if(!result) - return NULL; - - if(!(flags & JSON_DISABLE_EOF_CHECK)) { - lex_scan(lex, error); - if(lex->token != TOKEN_EOF) { - error_set(error, lex, "end of file expected"); - json_decref(result); - result = NULL; - } - } - - return result; -} - -typedef struct -{ - const char *data; - int pos; -} string_data_t; - -static int string_get(void *data) -{ - char c; - string_data_t *stream = (string_data_t *)data; - c = stream->data[stream->pos]; - if(c == '\0') - return EOF; - else - { - stream->pos++; - return (unsigned char)c; - } -} - -json_t *json_loads(const char *string, size_t flags, json_error_t *error) -{ - lex_t lex; - json_t *result; - string_data_t stream_data; - - stream_data.data = string; - stream_data.pos = 0; - - if(lex_init(&lex, string_get, (void *)&stream_data)) - return NULL; - - jsonp_error_init(error, ""); - result = parse_json(&lex, flags, error); - - lex_close(&lex); - return result; -} - -typedef struct -{ - const char *data; - size_t len; - size_t pos; -} buffer_data_t; - -static int buffer_get(void *data) -{ - char c; - buffer_data_t *stream = (buffer_data_t *) data; - if(stream->pos >= stream->len) - return EOF; - - c = stream->data[stream->pos]; - stream->pos++; - return (unsigned char)c; -} - -json_t *json_loadb(const char *buffer, size_t buflen, size_t flags, json_error_t *error) -{ - lex_t lex; - json_t *result; - buffer_data_t stream_data; - - stream_data.data = buffer; - stream_data.pos = 0; - stream_data.len = buflen; - - if(lex_init(&lex, buffer_get, (void *)&stream_data)) - return NULL; - - jsonp_error_init(error, ""); - result = parse_json(&lex, flags, error); - - lex_close(&lex); - return result; -} - -json_t *json_loadf(FILE *input, size_t flags, json_error_t *error) -{ - lex_t lex; - const char *source; - json_t *result; - - if(lex_init(&lex, (get_func)fgetc, input)) - return NULL; - - if(input == stdin) - source = ""; - else - source = ""; - - jsonp_error_init(error, source); - result = parse_json(&lex, flags, error); - - lex_close(&lex); - return result; -} - -json_t *json_load_file(const char *path, size_t flags, json_error_t *error) -{ - json_t *result; - FILE *fp; - - jsonp_error_init(error, path); - - fp = fopen(path, "r"); - if(!fp) - { - error_set(error, NULL, "unable to open %s: %s", - path, strerror(errno)); - return NULL; - } - - result = json_loadf(fp, flags, error); - - fclose(fp); - return result; -} diff --git a/lang/c/jansson/src/memory.c b/lang/c/jansson/src/memory.c deleted file mode 100644 index 0ed3de6d8f5..00000000000 --- a/lang/c/jansson/src/memory.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * Copyright (c) 2011 Basile Starynkevitch - * - * Jansson is free software; you can redistribute it and/or modify it - * under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include - -#include -#include "jansson_private.h" - -/* memory function pointers */ -static json_malloc_t do_malloc = malloc; -static json_free_t do_free = free; - -void *jsonp_malloc(size_t size) -{ - if(!size) - return NULL; - - return (*do_malloc)(size); -} - -void jsonp_free(void *ptr) -{ - if(!ptr) - return; - - (*do_free)(ptr); -} - -char *jsonp_strdup(const char *str) -{ - char *new_str; - - new_str = (char *) jsonp_malloc(strlen(str) + 1); - if(!new_str) - return NULL; - - strcpy(new_str, str); - return new_str; -} - -void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn) -{ - do_malloc = malloc_fn; - do_free = free_fn; -} diff --git a/lang/c/jansson/src/pack_unpack.c b/lang/c/jansson/src/pack_unpack.c deleted file mode 100644 index 20d540bad4d..00000000000 --- a/lang/c/jansson/src/pack_unpack.c +++ /dev/null @@ -1,610 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * Copyright (c) 2011 Graeme Smecher - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include -#include "jansson_private.h" -#include "utf.h" - -typedef struct { - const char *start; - const char *fmt; - char token; - json_error_t *error; - size_t flags; - int line; - int column; -} scanner_t; - -static const char *type_names[] = { - "object", - "array", - "string", - "integer", - "real", - "true", - "false", - "null" -}; - -#define type_name(x) type_names[json_typeof(x)] - -static const char *unpack_value_starters = "{[siIbfFOon"; - - -static void scanner_init(scanner_t *s, json_error_t *error, - size_t flags, const char *fmt) -{ - s->error = error; - s->flags = flags; - s->fmt = s->start = fmt; - s->line = 1; - s->column = 0; -} - -static void next_token(scanner_t *s) -{ - const char *t = s->fmt; - s->column++; - - /* skip space and ignored chars */ - while(*t == ' ' || *t == '\t' || *t == '\n' || *t == ',' || *t == ':') { - if(*t == '\n') { - s->line++; - s->column = 1; - } - else - s->column++; - - t++; - } - - s->token = *t; - - t++; - s->fmt = t; -} - -static void set_error(scanner_t *s, const char *source, const char *fmt, ...) -{ - va_list ap; - size_t pos; - va_start(ap, fmt); - - pos = (size_t)(s->fmt - s->start); - jsonp_error_vset(s->error, s->line, s->column, pos, fmt, ap); - - jsonp_error_set_source(s->error, source); - - va_end(ap); -} - -static json_t *pack(scanner_t *s, va_list *ap); - -static json_t *pack_object(scanner_t *s, va_list *ap) -{ - json_t *object = json_object(); - next_token(s); - - while(s->token != '}') { - const char *key; - json_t *value; - - if(!s->token) { - set_error(s, "", "Unexpected end of format string"); - goto error; - } - - if(s->token != 's') { - set_error(s, "", "Expected format 's', got '%c'", s->token); - goto error; - } - - key = va_arg(*ap, const char *); - if(!key) { - set_error(s, "", "NULL object key"); - goto error; - } - - if(!utf8_check_string(key, -1)) { - set_error(s, "", "Invalid UTF-8 in object key"); - goto error; - } - - next_token(s); - - value = pack(s, ap); - if(!value) - goto error; - - if(json_object_set_new_nocheck(object, key, value)) { - set_error(s, "", "Unable to add key \"%s\"", key); - goto error; - } - - next_token(s); - } - - return object; - -error: - json_decref(object); - return NULL; -} - -static json_t *pack_array(scanner_t *s, va_list *ap) -{ - json_t *array = json_array(); - next_token(s); - - while(s->token != ']') { - json_t *value; - - if(!s->token) { - set_error(s, "", "Unexpected end of format string"); - goto error; - } - - value = pack(s, ap); - if(!value) - goto error; - - if(json_array_append_new(array, value)) { - set_error(s, "", "Unable to append to array"); - goto error; - } - - next_token(s); - } - return array; - -error: - json_decref(array); - return NULL; -} - -static json_t *pack(scanner_t *s, va_list *ap) -{ - switch(s->token) { - case '{': - return pack_object(s, ap); - - case '[': - return pack_array(s, ap); - - case 's': /* string */ - { - const char *str = va_arg(*ap, const char *); - if(!str) { - set_error(s, "", "NULL string argument"); - return NULL; - } - if(!utf8_check_string(str, -1)) { - set_error(s, "", "Invalid UTF-8 string"); - return NULL; - } - return json_string_nocheck(str); - } - - case 'n': /* null */ - return json_null(); - - case 'b': /* boolean */ - return va_arg(*ap, int) ? json_true() : json_false(); - - case 'i': /* integer from int */ - return json_integer(va_arg(*ap, int)); - - case 'I': /* integer from json_int_t */ - return json_integer(va_arg(*ap, json_int_t)); - - case 'f': /* real */ - return json_real(va_arg(*ap, double)); - - case 'O': /* a json_t object; increments refcount */ - return json_incref(va_arg(*ap, json_t *)); - - case 'o': /* a json_t object; doesn't increment refcount */ - return va_arg(*ap, json_t *); - - default: - set_error(s, "", "Unexpected format character '%c'", - s->token); - return NULL; - } -} - -static int unpack(scanner_t *s, json_t *root, va_list *ap); - -static int unpack_object(scanner_t *s, json_t *root, va_list *ap) -{ - int ret = -1; - int strict = 0; - - /* Use a set (emulated by a hashtable) to check that all object - keys are accessed. Checking that the correct number of keys - were accessed is not enough, as the same key can be unpacked - multiple times. - */ - hashtable_t key_set; - - if(hashtable_init(&key_set, jsonp_hash_str, jsonp_str_equal, NULL, NULL)) { - set_error(s, "", "Out of memory"); - return -1; - } - - if(!json_is_object(root)) { - set_error(s, "", "Expected object, got %s", - type_name(root)); - goto out; - } - next_token(s); - - while(s->token != '}') { - const char *key; - json_t *value; - - if(strict != 0) { - set_error(s, "", "Expected '}' after '%c', got '%c'", - (strict == 1 ? '!' : '*'), s->token); - goto out; - } - - if(!s->token) { - set_error(s, "", "Unexpected end of format string"); - goto out; - } - - if(s->token == '!' || s->token == '*') { - strict = (s->token == '!' ? 1 : -1); - next_token(s); - continue; - } - - if(s->token != 's') { - set_error(s, "", "Expected format 's', got '%c'", s->token); - goto out; - } - - key = va_arg(*ap, const char *); - if(!key) { - set_error(s, "", "NULL object key"); - goto out; - } - - next_token(s); - - value = json_object_get(root, key); - if(!value) { - set_error(s, "", "Object item not found: %s", key); - goto out; - } - - if(unpack(s, value, ap)) - goto out; - - hashtable_set(&key_set, (void *)key, NULL); - next_token(s); - } - - if(strict == 0 && (s->flags & JSON_STRICT)) - strict = 1; - - if(strict == 1 && key_set.size != json_object_size(root)) { - long diff = (long)json_object_size(root) - (long)key_set.size; - set_error(s, "", "%li object item(s) left unpacked", diff); - goto out; - } - - ret = 0; - -out: - hashtable_close(&key_set); - return ret; -} - -static int unpack_array(scanner_t *s, json_t *root, va_list *ap) -{ - size_t i = 0; - int strict = 0; - - if(!json_is_array(root)) { - set_error(s, "", "Expected array, got %s", type_name(root)); - return -1; - } - next_token(s); - - while(s->token != ']') { - json_t *value; - - if(strict != 0) { - set_error(s, "", "Expected ']' after '%c', got '%c'", - (strict == 1 ? '!' : '*'), - s->token); - return -1; - } - - if(!s->token) { - set_error(s, "", "Unexpected end of format string"); - return -1; - } - - if(s->token == '!' || s->token == '*') { - strict = (s->token == '!' ? 1 : -1); - next_token(s); - continue; - } - - if(!strchr(unpack_value_starters, s->token)) { - set_error(s, "", "Unexpected format character '%c'", - s->token); - return -1; - } - - value = json_array_get(root, i); - if(!value) { - set_error(s, "", "Array index %lu out of range", - (unsigned long)i); - return -1; - } - - if(unpack(s, value, ap)) - return -1; - - next_token(s); - i++; - } - - if(strict == 0 && (s->flags & JSON_STRICT)) - strict = 1; - - if(strict == 1 && i != json_array_size(root)) { - long diff = (long)json_array_size(root) - (long)i; - set_error(s, "", "%li array item(s) left unpacked", diff); - return -1; - } - - return 0; -} - -static int unpack(scanner_t *s, json_t *root, va_list *ap) -{ - switch(s->token) - { - case '{': - return unpack_object(s, root, ap); - - case '[': - return unpack_array(s, root, ap); - - case 's': - if(!json_is_string(root)) { - set_error(s, "", "Expected string, got %s", - type_name(root)); - return -1; - } - - if(!(s->flags & JSON_VALIDATE_ONLY)) { - const char **str; - - str = va_arg(*ap, const char **); - if(!str) { - set_error(s, "", "NULL string argument"); - return -1; - } - - *str = json_string_value(root); - } - return 0; - - case 'i': - if(!json_is_integer(root)) { - set_error(s, "", "Expected integer, got %s", - type_name(root)); - return -1; - } - - if(!(s->flags & JSON_VALIDATE_ONLY)) - *va_arg(*ap, int*) = json_integer_value(root); - - return 0; - - case 'I': - if(!json_is_integer(root)) { - set_error(s, "", "Expected integer, got %s", - type_name(root)); - return -1; - } - - if(!(s->flags & JSON_VALIDATE_ONLY)) - *va_arg(*ap, json_int_t*) = json_integer_value(root); - - return 0; - - case 'b': - if(!json_is_boolean(root)) { - set_error(s, "", "Expected true or false, got %s", - type_name(root)); - return -1; - } - - if(!(s->flags & JSON_VALIDATE_ONLY)) - *va_arg(*ap, int*) = json_is_true(root); - - return 0; - - case 'f': - if(!json_is_real(root)) { - set_error(s, "", "Expected real, got %s", - type_name(root)); - return -1; - } - - if(!(s->flags & JSON_VALIDATE_ONLY)) - *va_arg(*ap, double*) = json_real_value(root); - - return 0; - - case 'F': - if(!json_is_number(root)) { - set_error(s, "", "Expected real or integer, got %s", - type_name(root)); - return -1; - } - - if(!(s->flags & JSON_VALIDATE_ONLY)) - *va_arg(*ap, double*) = json_number_value(root); - - return 0; - - case 'O': - if(!(s->flags & JSON_VALIDATE_ONLY)) - json_incref(root); - /* Fall through */ - - case 'o': - if(!(s->flags & JSON_VALIDATE_ONLY)) - *va_arg(*ap, json_t**) = root; - - return 0; - - case 'n': - /* Never assign, just validate */ - if(!json_is_null(root)) { - set_error(s, "", "Expected null, got %s", - type_name(root)); - return -1; - } - return 0; - - default: - set_error(s, "", "Unexpected format character '%c'", - s->token); - return -1; - } -} - -json_t *json_vpack_ex(json_error_t *error, size_t flags, - const char *fmt, va_list ap) -{ - scanner_t s; - va_list ap_copy; - json_t *value; - - if(!fmt || !*fmt) { - jsonp_error_init(error, ""); - jsonp_error_set(error, -1, -1, 0, "NULL or empty format string"); - return NULL; - } - jsonp_error_init(error, NULL); - - scanner_init(&s, error, flags, fmt); - next_token(&s); - - va_copy(ap_copy, ap); - value = pack(&s, &ap_copy); - va_end(ap_copy); - - if(!value) - return NULL; - - next_token(&s); - if(s.token) { - json_decref(value); - set_error(&s, "", "Garbage after format string"); - return NULL; - } - - return value; -} - -json_t *json_pack_ex(json_error_t *error, size_t flags, const char *fmt, ...) -{ - json_t *value; - va_list ap; - - va_start(ap, fmt); - value = json_vpack_ex(error, flags, fmt, ap); - va_end(ap); - - return value; -} - -json_t *json_pack(const char *fmt, ...) -{ - json_t *value; - va_list ap; - - va_start(ap, fmt); - value = json_vpack_ex(NULL, 0, fmt, ap); - va_end(ap); - - return value; -} - -int json_vunpack_ex(json_t *root, json_error_t *error, size_t flags, - const char *fmt, va_list ap) -{ - scanner_t s; - va_list ap_copy; - - if(!root) { - jsonp_error_init(error, ""); - jsonp_error_set(error, -1, -1, 0, "NULL root value"); - return -1; - } - - if(!fmt || !*fmt) { - jsonp_error_init(error, ""); - jsonp_error_set(error, -1, -1, 0, "NULL or empty format string"); - return -1; - } - jsonp_error_init(error, NULL); - - scanner_init(&s, error, flags, fmt); - next_token(&s); - - va_copy(ap_copy, ap); - if(unpack(&s, root, &ap_copy)) { - va_end(ap_copy); - return -1; - } - va_end(ap_copy); - - next_token(&s); - if(s.token) { - set_error(&s, "", "Garbage after format string"); - return -1; - } - - return 0; -} - -int json_unpack_ex(json_t *root, json_error_t *error, size_t flags, const char *fmt, ...) -{ - int ret; - va_list ap; - - va_start(ap, fmt); - ret = json_vunpack_ex(root, error, flags, fmt, ap); - va_end(ap); - - return ret; -} - -int json_unpack(json_t *root, const char *fmt, ...) -{ - int ret; - va_list ap; - - va_start(ap, fmt); - ret = json_vunpack_ex(root, NULL, 0, fmt, ap); - va_end(ap); - - return ret; -} diff --git a/lang/c/jansson/src/strbuffer.c b/lang/c/jansson/src/strbuffer.c deleted file mode 100644 index ad009c7bd73..00000000000 --- a/lang/c/jansson/src/strbuffer.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#define _GNU_SOURCE -#include -#include -#include "jansson_private.h" -#include "strbuffer.h" - -#define STRBUFFER_MIN_SIZE 16 -#define STRBUFFER_FACTOR 2 - -int strbuffer_init(strbuffer_t *strbuff) -{ - strbuff->size = STRBUFFER_MIN_SIZE; - strbuff->length = 0; - - strbuff->value = (char *) jsonp_malloc(strbuff->size); - if(!strbuff->value) - return -1; - - /* initialize to empty */ - strbuff->value[0] = '\0'; - return 0; -} - -void strbuffer_close(strbuffer_t *strbuff) -{ - jsonp_free(strbuff->value); - strbuff->size = 0; - strbuff->length = 0; - strbuff->value = NULL; -} - -void strbuffer_clear(strbuffer_t *strbuff) -{ - strbuff->length = 0; - strbuff->value[0] = '\0'; -} - -const char *strbuffer_value(const strbuffer_t *strbuff) -{ - return strbuff->value; -} - -char *strbuffer_steal_value(strbuffer_t *strbuff) -{ - char *result = strbuff->value; - strbuffer_init(strbuff); - return result; -} - -int strbuffer_append(strbuffer_t *strbuff, const char *string) -{ - return strbuffer_append_bytes(strbuff, string, strlen(string)); -} - -int strbuffer_append_byte(strbuffer_t *strbuff, char byte) -{ - return strbuffer_append_bytes(strbuff, &byte, 1); -} - -int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, int size) -{ - if(strbuff->length + size >= strbuff->size) - { - size_t new_size; - char *new_value; - - new_size = max(strbuff->size * STRBUFFER_FACTOR, - strbuff->length + size + 1); - - new_value = (char *) jsonp_malloc(new_size); - if(!new_value) - return -1; - - memcpy(new_value, strbuff->value, strbuff->length); - - jsonp_free(strbuff->value); - strbuff->value = new_value; - strbuff->size = new_size; - } - - memcpy(strbuff->value + strbuff->length, data, size); - strbuff->length += size; - strbuff->value[strbuff->length] = '\0'; - - return 0; -} - -char strbuffer_pop(strbuffer_t *strbuff) -{ - if(strbuff->length > 0) { - char c = strbuff->value[--strbuff->length]; - strbuff->value[strbuff->length] = '\0'; - return c; - } - else - return '\0'; -} diff --git a/lang/c/jansson/src/strbuffer.h b/lang/c/jansson/src/strbuffer.h deleted file mode 100644 index 06a1522792b..00000000000 --- a/lang/c/jansson/src/strbuffer.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#ifndef STRBUFFER_H -#define STRBUFFER_H -#ifdef __cplusplus -extern "C" { -#define CLOSE_EXTERN } -#else -#define CLOSE_EXTERN -#endif - -#pragma GCC visibility push(hidden) - -typedef struct { - char *value; - int length; /* bytes used */ - int size; /* bytes allocated */ -} strbuffer_t; - -int strbuffer_init(strbuffer_t *strbuff); -void strbuffer_close(strbuffer_t *strbuff); - -void strbuffer_clear(strbuffer_t *strbuff); - -const char *strbuffer_value(const strbuffer_t *strbuff); -char *strbuffer_steal_value(strbuffer_t *strbuff); - -int strbuffer_append(strbuffer_t *strbuff, const char *string); -int strbuffer_append_byte(strbuffer_t *strbuff, char byte); -int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, int size); - -char strbuffer_pop(strbuffer_t *strbuff); - -#pragma GCC visibility pop - -CLOSE_EXTERN -#endif diff --git a/lang/c/jansson/src/utf.c b/lang/c/jansson/src/utf.c deleted file mode 100644 index f48c2e7b242..00000000000 --- a/lang/c/jansson/src/utf.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include "utf.h" - -int utf8_encode(int32_t codepoint, char *buffer, int *size) -{ - if(codepoint < 0) - return -1; - else if(codepoint < 0x80) - { - buffer[0] = (char)codepoint; - *size = 1; - } - else if(codepoint < 0x800) - { - buffer[0] = 0xC0 + ((codepoint & 0x7C0) >> 6); - buffer[1] = 0x80 + ((codepoint & 0x03F)); - *size = 2; - } - else if(codepoint < 0x10000) - { - buffer[0] = 0xE0 + ((codepoint & 0xF000) >> 12); - buffer[1] = 0x80 + ((codepoint & 0x0FC0) >> 6); - buffer[2] = 0x80 + ((codepoint & 0x003F)); - *size = 3; - } - else if(codepoint <= 0x10FFFF) - { - buffer[0] = 0xF0 + ((codepoint & 0x1C0000) >> 18); - buffer[1] = 0x80 + ((codepoint & 0x03F000) >> 12); - buffer[2] = 0x80 + ((codepoint & 0x000FC0) >> 6); - buffer[3] = 0x80 + ((codepoint & 0x00003F)); - *size = 4; - } - else - return -1; - - return 0; -} - -int utf8_check_first(char byte) -{ - unsigned char u = (unsigned char)byte; - - if(u < 0x80) - return 1; - - if(0x80 <= u && u <= 0xBF) { - /* second, third or fourth byte of a multi-byte - sequence, i.e. a "continuation byte" */ - return 0; - } - else if(u == 0xC0 || u == 0xC1) { - /* overlong encoding of an ASCII byte */ - return 0; - } - else if(0xC2 <= u && u <= 0xDF) { - /* 2-byte sequence */ - return 2; - } - - else if(0xE0 <= u && u <= 0xEF) { - /* 3-byte sequence */ - return 3; - } - else if(0xF0 <= u && u <= 0xF4) { - /* 4-byte sequence */ - return 4; - } - else { /* u >= 0xF5 */ - /* Restricted (start of 4-, 5- or 6-byte sequence) or invalid - UTF-8 */ - return 0; - } -} - -int utf8_check_full(const char *buffer, int size, int32_t *codepoint) -{ - int i; - int32_t value = 0; - unsigned char u = (unsigned char)buffer[0]; - - if(size == 2) - { - value = u & 0x1F; - } - else if(size == 3) - { - value = u & 0xF; - } - else if(size == 4) - { - value = u & 0x7; - } - else - return 0; - - for(i = 1; i < size; i++) - { - u = (unsigned char)buffer[i]; - - if(u < 0x80 || u > 0xBF) { - /* not a continuation byte */ - return 0; - } - - value = (value << 6) + (u & 0x3F); - } - - if(value > 0x10FFFF) { - /* not in Unicode range */ - return 0; - } - - else if(0xD800 <= value && value <= 0xDFFF) { - /* invalid code point (UTF-16 surrogate halves) */ - return 0; - } - - else if((size == 2 && value < 0x80) || - (size == 3 && value < 0x800) || - (size == 4 && value < 0x10000)) { - /* overlong encoding */ - return 0; - } - - if(codepoint) - *codepoint = value; - - return 1; -} - -const char *utf8_iterate(const char *buffer, int32_t *codepoint) -{ - int count; - int32_t value; - - if(!*buffer) - return buffer; - - count = utf8_check_first(buffer[0]); - if(count <= 0) - return NULL; - - if(count == 1) - value = (unsigned char)buffer[0]; - else - { - if(!utf8_check_full(buffer, count, &value)) - return NULL; - } - - if(codepoint) - *codepoint = value; - - return buffer + count; -} - -int utf8_check_string(const char *string, int length) -{ - int i; - - if(length == -1) - length = strlen(string); - - for(i = 0; i < length; i++) - { - int count = utf8_check_first(string[i]); - if(count == 0) - return 0; - else if(count > 1) - { - if(i + count > length) - return 0; - - if(!utf8_check_full(&string[i], count, NULL)) - return 0; - - i += count - 1; - } - } - - return 1; -} diff --git a/lang/c/jansson/src/utf.h b/lang/c/jansson/src/utf.h deleted file mode 100644 index 838597810b8..00000000000 --- a/lang/c/jansson/src/utf.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#ifndef UTF_H -#define UTF_H -#ifdef __cplusplus -extern "C" { -#define CLOSE_EXTERN } -#else -#define CLOSE_EXTERN -#endif - -#ifdef HAVE_CONFIG_H -#include - -#ifdef HAVE_INTTYPES_H -/* inttypes.h includes stdint.h in a standard environment, so there's -no need to include stdint.h separately. If inttypes.h doesn't define -int32_t, it's defined in config.h. */ -#include -#endif /* HAVE_INTTYPES_H */ - -#else /* !HAVE_CONFIG_H */ -#ifdef _WIN32 -typedef int int32_t; -#else /* !_WIN32 */ -/* Assume a standard environment */ -#include -#endif /* _WIN32 */ - -#endif /* HAVE_CONFIG_H */ - -#pragma GCC visibility push(hidden) - -int utf8_encode(int32_t codepoint, char *buffer, int *size); - -int utf8_check_first(char byte); -int utf8_check_full(const char *buffer, int size, int32_t *codepoint); -const char *utf8_iterate(const char *buffer, int32_t *codepoint); - -int utf8_check_string(const char *string, int length); - -#pragma GCC visibility pop - -CLOSE_EXTERN -#endif diff --git a/lang/c/jansson/src/value.c b/lang/c/jansson/src/value.c deleted file mode 100644 index daffbbdd415..00000000000 --- a/lang/c/jansson/src/value.c +++ /dev/null @@ -1,983 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#define _GNU_SOURCE - -#include -#include -#include - -#include -#include "hashtable.h" -#include "jansson_private.h" -#include "utf.h" - - -static JSON_INLINE void json_init(json_t *json, json_type type) -{ - json->type = type; - json->refcount = 1; -} - - -/*** object ***/ - -/* From http://www.cse.yorku.ca/~oz/hash.html */ -size_t jsonp_hash_str(const void *ptr) -{ - const char *str = (const char *)ptr; - - size_t hash = 5381; - size_t c; - - while((c = (size_t)*str)) - { - hash = ((hash << 5) + hash) + c; - str++; - } - - return hash; -} - -int jsonp_str_equal(const void *ptr1, const void *ptr2) -{ - return strcmp((const char *)ptr1, (const char *)ptr2) == 0; -} - -/* This macro just returns a pointer that's a few bytes backwards from - string. This makes it possible to pass a pointer to object_key_t - when only the string inside it is used, without actually creating - an object_key_t instance. */ -#define string_to_key(string) container_of(string, object_key_t, key) - -static size_t hash_key(const void *ptr) -{ - return jsonp_hash_str(((const object_key_t *)ptr)->key); -} - -static int key_equal(const void *ptr1, const void *ptr2) -{ - return jsonp_str_equal(((const object_key_t *)ptr1)->key, - ((const object_key_t *)ptr2)->key); -} - -static void value_decref(void *value) -{ - json_decref((json_t *)value); -} - -json_t *json_object(void) -{ - json_object_t *object = (json_object_t *) jsonp_malloc(sizeof(json_object_t)); - if(!object) - return NULL; - json_init(&object->json, JSON_OBJECT); - - if(hashtable_init(&object->hashtable, - hash_key, key_equal, - jsonp_free, value_decref)) - { - jsonp_free(object); - return NULL; - } - - object->serial = 0; - object->visited = 0; - - return &object->json; -} - -static void json_delete_object(json_object_t *object) -{ - hashtable_close(&object->hashtable); - jsonp_free(object); -} - -size_t json_object_size(const json_t *json) -{ - json_object_t *object; - - if(!json_is_object(json)) - return 0; - - object = json_to_object(json); - return object->hashtable.size; -} - -json_t *json_object_get(const json_t *json, const char *key) -{ - json_object_t *object; - - if(!json_is_object(json)) - return NULL; - - object = json_to_object(json); - return (json_t *) hashtable_get(&object->hashtable, string_to_key(key)); -} - -int json_object_set_new_nocheck(json_t *json, const char *key, json_t *value) -{ - json_object_t *object; - object_key_t *k; - - if(!key || !value) - return -1; - - if(!json_is_object(json) || json == value) - { - json_decref(value); - return -1; - } - object = json_to_object(json); - - /* offsetof(...) returns the size of object_key_t without the - last, flexible member. This way, the correct amount is - allocated. */ - k = (object_key_t *) jsonp_malloc(offsetof(object_key_t, key) + strlen(key) + 1); - if(!k) - { - json_decref(value); - return -1; - } - - k->serial = object->serial++; - strcpy(k->key, key); - - if(hashtable_set(&object->hashtable, k, value)) - { - json_decref(value); - return -1; - } - - return 0; -} - -int json_object_set_new(json_t *json, const char *key, json_t *value) -{ - if(!key || !utf8_check_string(key, -1)) - { - json_decref(value); - return -1; - } - - return json_object_set_new_nocheck(json, key, value); -} - -int json_object_del(json_t *json, const char *key) -{ - json_object_t *object; - - if(!json_is_object(json)) - return -1; - - object = json_to_object(json); - return hashtable_del(&object->hashtable, string_to_key(key)); -} - -int json_object_clear(json_t *json) -{ - json_object_t *object; - - if(!json_is_object(json)) - return -1; - - object = json_to_object(json); - hashtable_clear(&object->hashtable); - - return 0; -} - -int json_object_update(json_t *object, json_t *other) -{ - void *iter; - - if(!json_is_object(object) || !json_is_object(other)) - return -1; - - iter = json_object_iter(other); - while(iter) { - const char *key; - json_t *value; - - key = json_object_iter_key(iter); - value = json_object_iter_value(iter); - - if(json_object_set_nocheck(object, key, value)) - return -1; - - iter = json_object_iter_next(other, iter); - } - - return 0; -} - -void *json_object_iter(json_t *json) -{ - json_object_t *object; - - if(!json_is_object(json)) - return NULL; - - object = json_to_object(json); - return hashtable_iter(&object->hashtable); -} - -void *json_object_iter_at(json_t *json, const char *key) -{ - json_object_t *object; - - if(!key || !json_is_object(json)) - return NULL; - - object = json_to_object(json); - return hashtable_iter_at(&object->hashtable, string_to_key(key)); -} - -void *json_object_iter_next(json_t *json, void *iter) -{ - json_object_t *object; - - if(!json_is_object(json) || iter == NULL) - return NULL; - - object = json_to_object(json); - return hashtable_iter_next(&object->hashtable, iter); -} - -const object_key_t *jsonp_object_iter_fullkey(void *iter) -{ - if(!iter) - return NULL; - - return (const object_key_t *) hashtable_iter_key(iter); -} - -const char *json_object_iter_key(void *iter) -{ - if(!iter) - return NULL; - - return jsonp_object_iter_fullkey(iter)->key; -} - -json_t *json_object_iter_value(void *iter) -{ - if(!iter) - return NULL; - - return (json_t *)hashtable_iter_value(iter); -} - -int json_object_iter_set_new(json_t *json, void *iter, json_t *value) -{ - json_object_t *object; - - if(!json_is_object(json) || !iter || !value) - return -1; - - object = json_to_object(json); - hashtable_iter_set(&object->hashtable, iter, value); - - return 0; -} - -static int json_object_equal(json_t *object1, json_t *object2) -{ - void *iter; - - if(json_object_size(object1) != json_object_size(object2)) - return 0; - - iter = json_object_iter(object1); - while(iter) - { - const char *key; - json_t *value1, *value2; - - key = json_object_iter_key(iter); - value1 = json_object_iter_value(iter); - value2 = json_object_get(object2, key); - - if(!json_equal(value1, value2)) - return 0; - - iter = json_object_iter_next(object1, iter); - } - - return 1; -} - -static json_t *json_object_copy(json_t *object) -{ - json_t *result; - void *iter; - - result = json_object(); - if(!result) - return NULL; - - iter = json_object_iter(object); - while(iter) - { - const char *key; - json_t *value; - - key = json_object_iter_key(iter); - value = json_object_iter_value(iter); - json_object_set_nocheck(result, key, value); - - iter = json_object_iter_next(object, iter); - } - - return result; -} - -static json_t *json_object_deep_copy(json_t *object) -{ - json_t *result; - void *iter; - - result = json_object(); - if(!result) - return NULL; - - iter = json_object_iter(object); - while(iter) - { - const char *key; - json_t *value; - - key = json_object_iter_key(iter); - value = json_object_iter_value(iter); - json_object_set_new_nocheck(result, key, json_deep_copy(value)); - - iter = json_object_iter_next(object, iter); - } - - return result; -} - - -/*** array ***/ - -json_t *json_array(void) -{ - json_array_t *array = (json_array_t *) jsonp_malloc(sizeof(json_array_t)); - if(!array) - return NULL; - json_init(&array->json, JSON_ARRAY); - - array->entries = 0; - array->size = 8; - - array->table = (json_t **) jsonp_malloc(array->size * sizeof(json_t *)); - if(!array->table) { - jsonp_free(array); - return NULL; - } - - array->visited = 0; - - return &array->json; -} - -static void json_delete_array(json_array_t *array) -{ - size_t i; - - for(i = 0; i < array->entries; i++) - json_decref(array->table[i]); - - jsonp_free(array->table); - jsonp_free(array); -} - -size_t json_array_size(const json_t *json) -{ - if(!json_is_array(json)) - return 0; - - return json_to_array(json)->entries; -} - -json_t *json_array_get(const json_t *json, size_t index) -{ - json_array_t *array; - if(!json_is_array(json)) - return NULL; - array = json_to_array(json); - - if(index >= array->entries) - return NULL; - - return array->table[index]; -} - -int json_array_set_new(json_t *json, size_t index, json_t *value) -{ - json_array_t *array; - - if(!value) - return -1; - - if(!json_is_array(json) || json == value) - { - json_decref(value); - return -1; - } - array = json_to_array(json); - - if(index >= array->entries) - { - json_decref(value); - return -1; - } - - json_decref(array->table[index]); - array->table[index] = value; - - return 0; -} - -static void array_move(json_array_t *array, size_t dest, - size_t src, size_t count) -{ - memmove(&array->table[dest], &array->table[src], count * sizeof(json_t *)); -} - -static void array_copy(json_t **dest, size_t dpos, - json_t **src, size_t spos, - size_t count) -{ - memcpy(&dest[dpos], &src[spos], count * sizeof(json_t *)); -} - -static json_t **json_array_grow(json_array_t *array, - size_t amount, - int copy) -{ - size_t new_size; - json_t **old_table, **new_table; - - if(array->entries + amount <= array->size) - return array->table; - - old_table = array->table; - - new_size = max(array->size + amount, array->size * 2); - new_table = (json_t **) jsonp_malloc(new_size * sizeof(json_t *)); - if(!new_table) - return NULL; - - array->size = new_size; - array->table = new_table; - - if(copy) { - array_copy(array->table, 0, old_table, 0, array->entries); - jsonp_free(old_table); - return array->table; - } - - return old_table; -} - -int json_array_append_new(json_t *json, json_t *value) -{ - json_array_t *array; - - if(!value) - return -1; - - if(!json_is_array(json) || json == value) - { - json_decref(value); - return -1; - } - array = json_to_array(json); - - if(!json_array_grow(array, 1, 1)) { - json_decref(value); - return -1; - } - - array->table[array->entries] = value; - array->entries++; - - return 0; -} - -int json_array_insert_new(json_t *json, size_t index, json_t *value) -{ - json_array_t *array; - json_t **old_table; - - if(!value) - return -1; - - if(!json_is_array(json) || json == value) { - json_decref(value); - return -1; - } - array = json_to_array(json); - - if(index > array->entries) { - json_decref(value); - return -1; - } - - old_table = json_array_grow(array, 1, 0); - if(!old_table) { - json_decref(value); - return -1; - } - - if(old_table != array->table) { - array_copy(array->table, 0, old_table, 0, index); - array_copy(array->table, index + 1, old_table, index, - array->entries - index); - jsonp_free(old_table); - } - else - array_move(array, index + 1, index, array->entries - index); - - array->table[index] = value; - array->entries++; - - return 0; -} - -int json_array_remove(json_t *json, size_t index) -{ - json_array_t *array; - - if(!json_is_array(json)) - return -1; - array = json_to_array(json); - - if(index >= array->entries) - return -1; - - json_decref(array->table[index]); - - array_move(array, index, index + 1, array->entries - index); - array->entries--; - - return 0; -} - -int json_array_clear(json_t *json) -{ - json_array_t *array; - size_t i; - - if(!json_is_array(json)) - return -1; - array = json_to_array(json); - - for(i = 0; i < array->entries; i++) - json_decref(array->table[i]); - - array->entries = 0; - return 0; -} - -int json_array_extend(json_t *json, json_t *other_json) -{ - json_array_t *array, *other; - size_t i; - - if(!json_is_array(json) || !json_is_array(other_json)) - return -1; - array = json_to_array(json); - other = json_to_array(other_json); - - if(!json_array_grow(array, other->entries, 1)) - return -1; - - for(i = 0; i < other->entries; i++) - json_incref(other->table[i]); - - array_copy(array->table, array->entries, other->table, 0, other->entries); - - array->entries += other->entries; - return 0; -} - -static int json_array_equal(json_t *array1, json_t *array2) -{ - size_t i, size; - - size = json_array_size(array1); - if(size != json_array_size(array2)) - return 0; - - for(i = 0; i < size; i++) - { - json_t *value1, *value2; - - value1 = json_array_get(array1, i); - value2 = json_array_get(array2, i); - - if(!json_equal(value1, value2)) - return 0; - } - - return 1; -} - -static json_t *json_array_copy(json_t *array) -{ - json_t *result; - size_t i; - - result = json_array(); - if(!result) - return NULL; - - for(i = 0; i < json_array_size(array); i++) - json_array_append(result, json_array_get(array, i)); - - return result; -} - -static json_t *json_array_deep_copy(json_t *array) -{ - json_t *result; - size_t i; - - result = json_array(); - if(!result) - return NULL; - - for(i = 0; i < json_array_size(array); i++) - json_array_append_new(result, json_deep_copy(json_array_get(array, i))); - - return result; -} - -/*** string ***/ - -json_t *json_string_nocheck(const char *value) -{ - json_string_t *string; - - if(!value) - return NULL; - - string = (json_string_t *) jsonp_malloc(sizeof(json_string_t)); - if(!string) - return NULL; - json_init(&string->json, JSON_STRING); - - string->value = jsonp_strdup(value); - if(!string->value) { - jsonp_free(string); - return NULL; - } - - return &string->json; -} - -json_t *json_string(const char *value) -{ - if(!value || !utf8_check_string(value, -1)) - return NULL; - - return json_string_nocheck(value); -} - -const char *json_string_value(const json_t *json) -{ - if(!json_is_string(json)) - return NULL; - - return json_to_string(json)->value; -} - -int json_string_set_nocheck(json_t *json, const char *value) -{ - char *dup; - json_string_t *string; - - dup = jsonp_strdup(value); - if(!dup) - return -1; - - string = json_to_string(json); - jsonp_free(string->value); - string->value = dup; - - return 0; -} - -int json_string_set(json_t *json, const char *value) -{ - if(!value || !utf8_check_string(value, -1)) - return -1; - - return json_string_set_nocheck(json, value); -} - -static void json_delete_string(json_string_t *string) -{ - jsonp_free(string->value); - jsonp_free(string); -} - -static int json_string_equal(json_t *string1, json_t *string2) -{ - return strcmp(json_string_value(string1), json_string_value(string2)) == 0; -} - -static json_t *json_string_copy(json_t *string) -{ - return json_string_nocheck(json_string_value(string)); -} - - -/*** integer ***/ - -json_t *json_integer(json_int_t value) -{ - json_integer_t *integer = (json_integer_t *) jsonp_malloc(sizeof(json_integer_t)); - if(!integer) - return NULL; - json_init(&integer->json, JSON_INTEGER); - - integer->value = value; - return &integer->json; -} - -json_int_t json_integer_value(const json_t *json) -{ - if(!json_is_integer(json)) - return 0; - - return json_to_integer(json)->value; -} - -int json_integer_set(json_t *json, json_int_t value) -{ - if(!json_is_integer(json)) - return -1; - - json_to_integer(json)->value = value; - - return 0; -} - -static void json_delete_integer(json_integer_t *integer) -{ - jsonp_free(integer); -} - -static int json_integer_equal(json_t *integer1, json_t *integer2) -{ - return json_integer_value(integer1) == json_integer_value(integer2); -} - -static json_t *json_integer_copy(json_t *integer) -{ - return json_integer(json_integer_value(integer)); -} - - -/*** real ***/ - -json_t *json_real(double value) -{ - json_real_t *real = (json_real_t *) jsonp_malloc(sizeof(json_real_t)); - if(!real) - return NULL; - json_init(&real->json, JSON_REAL); - - real->value = value; - return &real->json; -} - -double json_real_value(const json_t *json) -{ - if(!json_is_real(json)) - return 0; - - return json_to_real(json)->value; -} - -int json_real_set(json_t *json, double value) -{ - if(!json_is_real(json)) - return 0; - - json_to_real(json)->value = value; - - return 0; -} - -static void json_delete_real(json_real_t *real) -{ - jsonp_free(real); -} - -static int json_real_equal(json_t *real1, json_t *real2) -{ - return json_real_value(real1) == json_real_value(real2); -} - -static json_t *json_real_copy(json_t *real) -{ - return json_real(json_real_value(real)); -} - - -/*** number ***/ - -double json_number_value(const json_t *json) -{ - if(json_is_integer(json)) - return (double) json_integer_value(json); - else if(json_is_real(json)) - return json_real_value(json); - else - return 0.0; -} - - -/*** simple values ***/ - -json_t *json_true(void) -{ - static json_t the_true = {JSON_TRUE, (size_t)-1}; - return &the_true; -} - - -json_t *json_false(void) -{ - static json_t the_false = {JSON_FALSE, (size_t)-1}; - return &the_false; -} - - -json_t *json_null(void) -{ - static json_t the_null = {JSON_NULL, (size_t)-1}; - return &the_null; -} - - -/*** deletion ***/ - -void json_delete(json_t *json) -{ - if(json_is_object(json)) - json_delete_object(json_to_object(json)); - - else if(json_is_array(json)) - json_delete_array(json_to_array(json)); - - else if(json_is_string(json)) - json_delete_string(json_to_string(json)); - - else if(json_is_integer(json)) - json_delete_integer(json_to_integer(json)); - - else if(json_is_real(json)) - json_delete_real(json_to_real(json)); - - /* json_delete is not called for true, false or null */ -} - - -/*** equality ***/ - -int json_equal(json_t *json1, json_t *json2) -{ - if(!json1 || !json2) - return 0; - - if(json_typeof(json1) != json_typeof(json2)) - return 0; - - /* this covers true, false and null as they are singletons */ - if(json1 == json2) - return 1; - - if(json_is_object(json1)) - return json_object_equal(json1, json2); - - if(json_is_array(json1)) - return json_array_equal(json1, json2); - - if(json_is_string(json1)) - return json_string_equal(json1, json2); - - if(json_is_integer(json1)) - return json_integer_equal(json1, json2); - - if(json_is_real(json1)) - return json_real_equal(json1, json2); - - return 0; -} - - -/*** copying ***/ - -json_t *json_copy(json_t *json) -{ - if(!json) - return NULL; - - if(json_is_object(json)) - return json_object_copy(json); - - if(json_is_array(json)) - return json_array_copy(json); - - if(json_is_string(json)) - return json_string_copy(json); - - if(json_is_integer(json)) - return json_integer_copy(json); - - if(json_is_real(json)) - return json_real_copy(json); - - if(json_is_true(json) || json_is_false(json) || json_is_null(json)) - return json; - - return NULL; -} - -json_t *json_deep_copy(json_t *json) -{ - if(!json) - return NULL; - - if(json_is_object(json)) - return json_object_deep_copy(json); - - if(json_is_array(json)) - return json_array_deep_copy(json); - - /* for the rest of the types, deep copying doesn't differ from - shallow copying */ - - if(json_is_string(json)) - return json_string_copy(json); - - if(json_is_integer(json)) - return json_integer_copy(json); - - if(json_is_real(json)) - return json_real_copy(json); - - if(json_is_true(json) || json_is_false(json) || json_is_null(json)) - return json; - - return NULL; -} diff --git a/lang/c/jansson/test/.gitignore b/lang/c/jansson/test/.gitignore deleted file mode 100644 index 0de6db62b2c..00000000000 --- a/lang/c/jansson/test/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -bin/json_process -suites/api/test_array -suites/api/test_copy -suites/api/test_dump -suites/api/test_equal -suites/api/test_load -suites/api/test_loadb -suites/api/test_memory_funcs -suites/api/test_number -suites/api/test_object -suites/api/test_pack -suites/api/test_simple -suites/api/test_unpack diff --git a/lang/c/jansson/test/Makefile.am b/lang/c/jansson/test/Makefile.am deleted file mode 100644 index 86d1614e06a..00000000000 --- a/lang/c/jansson/test/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -SUBDIRS = bin suites -EXTRA_DIST = scripts run-suites - -TESTS = run-suites -TESTS_ENVIRONMENT = \ - top_srcdir=$(top_srcdir) \ - top_builddir=$(top_builddir) - -clean-local: - rm -rf logs diff --git a/lang/c/jansson/test/Makefile.in b/lang/c/jansson/test/Makefile.in deleted file mode 100644 index 822a1ec52ad..00000000000 --- a/lang/c/jansson/test/Makefile.in +++ /dev/null @@ -1,569 +0,0 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = test -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -json_have_long_long = @json_have_long_long@ -json_inline = @json_inline@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -SUBDIRS = bin suites -EXTRA_DIST = scripts run-suites -TESTS = run-suites -TESTS_ENVIRONMENT = \ - top_srcdir=$(top_srcdir) \ - top_builddir=$(top_builddir) - -all: all-recursive - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign test/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -check-TESTS: $(TESTS) - @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \ - srcdir=$(srcdir); export srcdir; \ - list=' $(TESTS) '; \ - if test -n "$$list"; then \ - for tst in $$list; do \ - if test -f ./$$tst; then dir=./; \ - elif test -f $$tst; then dir=; \ - else dir="$(srcdir)/"; fi; \ - if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *$$ws$$tst$$ws*) \ - xpass=`expr $$xpass + 1`; \ - failed=`expr $$failed + 1`; \ - echo "XPASS: $$tst"; \ - ;; \ - *) \ - echo "PASS: $$tst"; \ - ;; \ - esac; \ - elif test $$? -ne 77; then \ - all=`expr $$all + 1`; \ - case " $(XFAIL_TESTS) " in \ - *$$ws$$tst$$ws*) \ - xfail=`expr $$xfail + 1`; \ - echo "XFAIL: $$tst"; \ - ;; \ - *) \ - failed=`expr $$failed + 1`; \ - echo "FAIL: $$tst"; \ - ;; \ - esac; \ - else \ - skip=`expr $$skip + 1`; \ - echo "SKIP: $$tst"; \ - fi; \ - done; \ - if test "$$failed" -eq 0; then \ - if test "$$xfail" -eq 0; then \ - banner="All $$all tests passed"; \ - else \ - banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ - fi; \ - else \ - if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all tests failed"; \ - else \ - banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ - fi; \ - fi; \ - dashes="$$banner"; \ - skipped=""; \ - if test "$$skip" -ne 0; then \ - skipped="($$skip tests were not run)"; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$skipped"; \ - fi; \ - report=""; \ - if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ - report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ - dashes="$$report"; \ - fi; \ - dashes=`echo "$$dashes" | sed s/./=/g`; \ - echo "$$dashes"; \ - echo "$$banner"; \ - test -z "$$skipped" || echo "$$skipped"; \ - test -z "$$report" || echo "$$report"; \ - echo "$$dashes"; \ - test "$$failed" -eq 0; \ - else :; fi - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool clean-local mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-exec-am: - -install-html: install-html-recursive - -install-info: install-info-recursive - -install-man: - -install-pdf: install-pdf-recursive - -install-ps: install-ps-recursive - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ - install-strip - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am check check-TESTS check-am clean clean-generic \ - clean-libtool clean-local ctags ctags-recursive distclean \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am - - -clean-local: - rm -rf logs -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lang/c/jansson/test/bin/Makefile.am b/lang/c/jansson/test/bin/Makefile.am deleted file mode 100644 index 346db5d4e56..00000000000 --- a/lang/c/jansson/test/bin/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -check_PROGRAMS = json_process - -AM_CPPFLAGS = -I$(top_srcdir)/src -AM_CFLAGS = -Wall -Werror -LDFLAGS = -static # for speed and Valgrind -LDADD = $(top_builddir)/src/libjansson.la diff --git a/lang/c/jansson/test/bin/Makefile.in b/lang/c/jansson/test/bin/Makefile.in deleted file mode 100644 index 736e2c845c7..00000000000 --- a/lang/c/jansson/test/bin/Makefile.in +++ /dev/null @@ -1,439 +0,0 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -check_PROGRAMS = json_process$(EXEEXT) -subdir = test/bin -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -json_process_SOURCES = json_process.c -json_process_OBJECTS = json_process.$(OBJEXT) -json_process_LDADD = $(LDADD) -json_process_DEPENDENCIES = $(top_builddir)/src/libjansson.la -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = json_process.c -DIST_SOURCES = json_process.c -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = -static # for speed and Valgrind -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -json_have_long_long = @json_have_long_long@ -json_inline = @json_inline@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -AM_CPPFLAGS = -I$(top_srcdir)/src -AM_CFLAGS = -Wall -Werror -LDADD = $(top_builddir)/src/libjansson.la -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/bin/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign test/bin/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -json_process$(EXEEXT): $(json_process_OBJECTS) $(json_process_DEPENDENCIES) - @rm -f json_process$(EXEEXT) - $(LINK) $(json_process_OBJECTS) $(json_process_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json_process.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-exec-am: - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean \ - clean-checkPROGRAMS clean-generic clean-libtool ctags \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lang/c/jansson/test/bin/json_process.c b/lang/c/jansson/test/bin/json_process.c deleted file mode 100644 index 1ed0c578f1c..00000000000 --- a/lang/c/jansson/test/bin/json_process.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include -#include -#include -#include - -static int getenv_int(const char *name) -{ - char *value, *end; - long result; - - value = getenv(name); - if(!value) - return 0; - - result = strtol(value, &end, 10); - if(*end != '\0') - return 0; - - return (int)result; -} - -/* Return a pointer to the first non-whitespace character of str. - Modifies str so that all trailing whitespace characters are - replaced by '\0'. */ -static const char *strip(char *str) -{ - size_t length; - char *result = str; - while(*result && isspace(*result)) - result++; - - length = strlen(result); - if(length == 0) - return result; - - while(isspace(result[length - 1])) - result[--length] = '\0'; - - return result; -} - -int main(int argc, char *argv[]) -{ - int indent = 0; - size_t flags = 0; - - json_t *json; - json_error_t error; - - if(argc != 1) { - fprintf(stderr, "usage: %s\n", argv[0]); - return 2; - } - - indent = getenv_int("JSON_INDENT"); - if(indent < 0 || indent > 255) { - fprintf(stderr, "invalid value for JSON_INDENT: %d\n", indent); - return 2; - } - - if(indent > 0) - flags |= JSON_INDENT(indent); - - if(getenv_int("JSON_COMPACT") > 0) - flags |= JSON_COMPACT; - - if(getenv_int("JSON_ENSURE_ASCII")) - flags |= JSON_ENSURE_ASCII; - - if(getenv_int("JSON_PRESERVE_ORDER")) - flags |= JSON_PRESERVE_ORDER; - - if(getenv_int("JSON_SORT_KEYS")) - flags |= JSON_SORT_KEYS; - - if(getenv_int("STRIP")) { - /* Load to memory, strip leading and trailing whitespace */ - size_t size = 0, used = 0; - char *buffer = NULL; - - while(1) { - int count; - - size = (size == 0 ? 128 : size * 2); - buffer = realloc(buffer, size); - if(!buffer) { - fprintf(stderr, "Unable to allocate %d bytes\n", (int)size); - return 1; - } - - count = fread(buffer + used, 1, size - used, stdin); - if(count < size - used) { - buffer[used + count] = '\0'; - break; - } - used += count; - } - - json = json_loads(strip(buffer), 0, &error); - free(buffer); - } - else - json = json_loadf(stdin, 0, &error); - - if(!json) { - fprintf(stderr, "%d %d %d\n%s\n", - error.line, error.column, error.position, - error.text); - return 1; - } - - json_dumpf(json, stdout, flags); - json_decref(json); - - return 0; -} diff --git a/lang/c/jansson/test/run-suites b/lang/c/jansson/test/run-suites deleted file mode 100755 index ea354240ed2..00000000000 --- a/lang/c/jansson/test/run-suites +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -while [ -n "$1" ]; do - suite=$1 - if [ -x $top_srcdir/test/suites/$suite/run ]; then - SUITES="$SUITES $suite" - else - echo "No such suite: $suite" - exit 1 - fi - shift -done - -if [ -z "$SUITES" ]; then - suitedirs=$top_srcdir/test/suites/* - for suitedir in $suitedirs; do - if [ -d $suitedir ]; then - SUITES="$SUITES `basename $suitedir`" - fi - done -fi - -[ -z "$STOP" ] && STOP=0 - -export suites_srcdir=$top_srcdir/test/suites -export suites_builddir=suites -export scriptdir=$top_srcdir/test/scripts -export logdir=logs -export bindir=bin - -passed=0 -failed=0 -for suite in $SUITES; do - echo "Suite: $suite" - if $suites_srcdir/$suite/run $suite; then - passed=$(($passed+1)) - else - failed=$(($failed+1)) - [ $STOP -eq 1 ] && break - fi -done - -if [ $failed -gt 0 ]; then - echo "$failed of $((passed+failed)) test suites failed" - exit 1 -else - echo "$passed test suites passed" - rm -rf $logdir -fi diff --git a/lang/c/jansson/test/scripts/run-tests.sh b/lang/c/jansson/test/scripts/run-tests.sh deleted file mode 100644 index adf34d457cf..00000000000 --- a/lang/c/jansson/test/scripts/run-tests.sh +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright (c) 2009-2011 Petri Lehtinen -# -# Jansson is free software; you can redistribute it and/or modify -# it under the terms of the MIT license. See LICENSE for details. - -json_process=$bindir/json_process - -suite_name=$1 -suite_srcdir=$suites_srcdir/$suite_name -suite_builddir=$suites_builddir/$suite_name -suite_log=$logdir/$suite_name - - -[ -z "$VERBOSE" ] && VERBOSE=0 -[ -z "$STOP" ] && STOP=0 - -. $scriptdir/valgrind.sh - -rm -rf $suite_log -mkdir -p $suite_log - -for test_path in $suite_srcdir/*; do - test_name=$(basename $test_path) - test_builddir=$suite_builddir/$test_name - test_log=$suite_log/$test_name - - [ "$test_name" = "run" ] && continue - is_test || continue - - rm -rf $test_log - mkdir -p $test_log - if [ $VERBOSE -eq 1 ]; then - printf '%s... ' "$test_name" - fi - - run_test - case $? in - 0) - # Success - if [ $VERBOSE -eq 1 ]; then - printf 'ok\n' - else - printf '.' - fi - rm -rf $test_log - ;; - - 77) - # Skip - if [ $VERBOSE -eq 1 ]; then - printf 'skipped\n' - else - printf 'S' - fi - rm -rf $test_log - ;; - - *) - # Failure - if [ $VERBOSE -eq 1 ]; then - printf 'FAILED\n' - else - printf 'F' - fi - - [ $STOP -eq 1 ] && break - ;; - esac -done - -if [ $VERBOSE -eq 0 ]; then - printf '\n' -fi - -if [ -n "$(ls -A $suite_log)" ]; then - for test_log in $suite_log/*; do - test_name=$(basename $test_log) - test_path=$suite_srcdir/$test_name - echo "=================================================================" - echo "$suite_name/$test_name" - echo "=================================================================" - show_error - echo - done - echo "=================================================================" - exit 1 -else - rm -rf $suite_log -fi diff --git a/lang/c/jansson/test/scripts/valgrind.sh b/lang/c/jansson/test/scripts/valgrind.sh deleted file mode 100644 index 0eb39f4657a..00000000000 --- a/lang/c/jansson/test/scripts/valgrind.sh +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (c) 2009-2011 Petri Lehtinen -# -# Jansson is free software; you can redistribute it and/or modify -# it under the terms of the MIT license. See LICENSE for details. - -[ -z "$VALGRIND" ] && VALGRIND=0 - -VALGRIND_CMDLINE="valgrind --leak-check=full --show-reachable=yes --track-origins=yes -q" - -if [ $VALGRIND -eq 1 ]; then - test_runner="$VALGRIND_CMDLINE" - json_process="$VALGRIND_CMDLINE $json_process" -else - test_runner="" -fi - -valgrind_check() { - if [ $VALGRIND -eq 1 ]; then - # Check for Valgrind error output. The valgrind option - # --error-exitcode is not enough because Valgrind doesn't - # think unfreed allocs are errors. - if grep -E -q '^==[0-9]+== ' $1; then - touch $test_log/valgrind_error - return 1 - fi - fi -} - -valgrind_show_error() { - if [ $VALGRIND -eq 1 -a -f $test_log/valgrind_error ]; then - echo "valgrind detected an error" - return 0 - fi - return 1 -} diff --git a/lang/c/jansson/test/suites/Makefile.am b/lang/c/jansson/test/suites/Makefile.am deleted file mode 100644 index a53eb07f13c..00000000000 --- a/lang/c/jansson/test/suites/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -SUBDIRS = api -EXTRA_DIST = invalid invalid-unicode valid diff --git a/lang/c/jansson/test/suites/Makefile.in b/lang/c/jansson/test/suites/Makefile.in deleted file mode 100644 index 220087db947..00000000000 --- a/lang/c/jansson/test/suites/Makefile.in +++ /dev/null @@ -1,487 +0,0 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -subdir = test/suites -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-dvi-recursive install-exec-recursive \ - install-html-recursive install-info-recursive \ - install-pdf-recursive install-ps-recursive install-recursive \ - installcheck-recursive installdirs-recursive pdf-recursive \ - ps-recursive uninstall-recursive -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -json_have_long_long = @json_have_long_long@ -json_inline = @json_inline@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -SUBDIRS = api -EXTRA_DIST = invalid invalid-unicode valid -all: all-recursive - -.SUFFIXES: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/suites/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign test/suites/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -$(RECURSIVE_CLEAN_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: - -install-dvi: install-dvi-recursive - -install-exec-am: - -install-html: install-html-recursive - -install-info: install-info-recursive - -install-man: - -install-pdf: install-pdf-recursive - -install-ps: install-ps-recursive - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: - -.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ - install-strip - -.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ - all all-am check check-am clean clean-generic clean-libtool \ - ctags ctags-recursive distclean distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ - uninstall uninstall-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lang/c/jansson/test/suites/api/Makefile.am b/lang/c/jansson/test/suites/api/Makefile.am deleted file mode 100644 index 58c31c63fb8..00000000000 --- a/lang/c/jansson/test/suites/api/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ -EXTRA_DIST = run - -check_PROGRAMS = \ - test_array \ - test_copy \ - test_dump \ - test_equal \ - test_load \ - test_loadb \ - test_memory_funcs \ - test_number \ - test_object \ - test_pack \ - test_simple \ - test_unpack - -test_array_SOURCES = test_array.c util.h -test_copy_SOURCES = test_copy.c util.h -test_dump_SOURCES = test_dump.c util.h -test_load_SOURCES = test_load.c util.h -test_loadb_SOURCES = test_loadb.c util.h -test_memory_funcs_SOURCES = test_memory_funcs.c util.h -test_number_SOURCES = test_number.c util.h -test_object_SOURCES = test_object.c util.h -test_pack_SOURCES = test_pack.c util.h -test_simple_SOURCES = test_simple.c util.h -test_unpack_SOURCES = test_unpack.c util.h - -AM_CPPFLAGS = -I$(top_srcdir)/src -AM_CFLAGS = -Wall -Werror -LDFLAGS = -static # for speed and Valgrind -LDADD = $(top_builddir)/src/libjansson.la diff --git a/lang/c/jansson/test/suites/api/Makefile.in b/lang/c/jansson/test/suites/api/Makefile.in deleted file mode 100644 index b84690bd6e7..00000000000 --- a/lang/c/jansson/test/suites/api/Makefile.in +++ /dev/null @@ -1,553 +0,0 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -check_PROGRAMS = test_array$(EXEEXT) test_copy$(EXEEXT) \ - test_dump$(EXEEXT) test_equal$(EXEEXT) test_load$(EXEEXT) \ - test_loadb$(EXEEXT) test_memory_funcs$(EXEEXT) \ - test_number$(EXEEXT) test_object$(EXEEXT) test_pack$(EXEEXT) \ - test_simple$(EXEEXT) test_unpack$(EXEEXT) -subdir = test/suites/api -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -am_test_array_OBJECTS = test_array.$(OBJEXT) -test_array_OBJECTS = $(am_test_array_OBJECTS) -test_array_LDADD = $(LDADD) -test_array_DEPENDENCIES = $(top_builddir)/src/libjansson.la -am_test_copy_OBJECTS = test_copy.$(OBJEXT) -test_copy_OBJECTS = $(am_test_copy_OBJECTS) -test_copy_LDADD = $(LDADD) -test_copy_DEPENDENCIES = $(top_builddir)/src/libjansson.la -am_test_dump_OBJECTS = test_dump.$(OBJEXT) -test_dump_OBJECTS = $(am_test_dump_OBJECTS) -test_dump_LDADD = $(LDADD) -test_dump_DEPENDENCIES = $(top_builddir)/src/libjansson.la -test_equal_SOURCES = test_equal.c -test_equal_OBJECTS = test_equal.$(OBJEXT) -test_equal_LDADD = $(LDADD) -test_equal_DEPENDENCIES = $(top_builddir)/src/libjansson.la -am_test_load_OBJECTS = test_load.$(OBJEXT) -test_load_OBJECTS = $(am_test_load_OBJECTS) -test_load_LDADD = $(LDADD) -test_load_DEPENDENCIES = $(top_builddir)/src/libjansson.la -am_test_loadb_OBJECTS = test_loadb.$(OBJEXT) -test_loadb_OBJECTS = $(am_test_loadb_OBJECTS) -test_loadb_LDADD = $(LDADD) -test_loadb_DEPENDENCIES = $(top_builddir)/src/libjansson.la -am_test_memory_funcs_OBJECTS = test_memory_funcs.$(OBJEXT) -test_memory_funcs_OBJECTS = $(am_test_memory_funcs_OBJECTS) -test_memory_funcs_LDADD = $(LDADD) -test_memory_funcs_DEPENDENCIES = $(top_builddir)/src/libjansson.la -am_test_number_OBJECTS = test_number.$(OBJEXT) -test_number_OBJECTS = $(am_test_number_OBJECTS) -test_number_LDADD = $(LDADD) -test_number_DEPENDENCIES = $(top_builddir)/src/libjansson.la -am_test_object_OBJECTS = test_object.$(OBJEXT) -test_object_OBJECTS = $(am_test_object_OBJECTS) -test_object_LDADD = $(LDADD) -test_object_DEPENDENCIES = $(top_builddir)/src/libjansson.la -am_test_pack_OBJECTS = test_pack.$(OBJEXT) -test_pack_OBJECTS = $(am_test_pack_OBJECTS) -test_pack_LDADD = $(LDADD) -test_pack_DEPENDENCIES = $(top_builddir)/src/libjansson.la -am_test_simple_OBJECTS = test_simple.$(OBJEXT) -test_simple_OBJECTS = $(am_test_simple_OBJECTS) -test_simple_LDADD = $(LDADD) -test_simple_DEPENDENCIES = $(top_builddir)/src/libjansson.la -am_test_unpack_OBJECTS = test_unpack.$(OBJEXT) -test_unpack_OBJECTS = $(am_test_unpack_OBJECTS) -test_unpack_LDADD = $(LDADD) -test_unpack_DEPENDENCIES = $(top_builddir)/src/libjansson.la -DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = $(test_array_SOURCES) $(test_copy_SOURCES) \ - $(test_dump_SOURCES) test_equal.c $(test_load_SOURCES) \ - $(test_loadb_SOURCES) $(test_memory_funcs_SOURCES) \ - $(test_number_SOURCES) $(test_object_SOURCES) \ - $(test_pack_SOURCES) $(test_simple_SOURCES) \ - $(test_unpack_SOURCES) -DIST_SOURCES = $(test_array_SOURCES) $(test_copy_SOURCES) \ - $(test_dump_SOURCES) test_equal.c $(test_load_SOURCES) \ - $(test_loadb_SOURCES) $(test_memory_funcs_SOURCES) \ - $(test_number_SOURCES) $(test_object_SOURCES) \ - $(test_pack_SOURCES) $(test_simple_SOURCES) \ - $(test_unpack_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = -static # for speed and Valgrind -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -json_have_long_long = @json_have_long_long@ -json_inline = @json_inline@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -EXTRA_DIST = run -test_array_SOURCES = test_array.c util.h -test_copy_SOURCES = test_copy.c util.h -test_dump_SOURCES = test_dump.c util.h -test_load_SOURCES = test_load.c util.h -test_loadb_SOURCES = test_loadb.c util.h -test_memory_funcs_SOURCES = test_memory_funcs.c util.h -test_number_SOURCES = test_number.c util.h -test_object_SOURCES = test_object.c util.h -test_pack_SOURCES = test_pack.c util.h -test_simple_SOURCES = test_simple.c util.h -test_unpack_SOURCES = test_unpack.c util.h -AM_CPPFLAGS = -I$(top_srcdir)/src -AM_CFLAGS = -Wall -Werror -LDADD = $(top_builddir)/src/libjansson.la -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/suites/api/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --foreign test/suites/api/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -test_array$(EXEEXT): $(test_array_OBJECTS) $(test_array_DEPENDENCIES) - @rm -f test_array$(EXEEXT) - $(LINK) $(test_array_OBJECTS) $(test_array_LDADD) $(LIBS) -test_copy$(EXEEXT): $(test_copy_OBJECTS) $(test_copy_DEPENDENCIES) - @rm -f test_copy$(EXEEXT) - $(LINK) $(test_copy_OBJECTS) $(test_copy_LDADD) $(LIBS) -test_dump$(EXEEXT): $(test_dump_OBJECTS) $(test_dump_DEPENDENCIES) - @rm -f test_dump$(EXEEXT) - $(LINK) $(test_dump_OBJECTS) $(test_dump_LDADD) $(LIBS) -test_equal$(EXEEXT): $(test_equal_OBJECTS) $(test_equal_DEPENDENCIES) - @rm -f test_equal$(EXEEXT) - $(LINK) $(test_equal_OBJECTS) $(test_equal_LDADD) $(LIBS) -test_load$(EXEEXT): $(test_load_OBJECTS) $(test_load_DEPENDENCIES) - @rm -f test_load$(EXEEXT) - $(LINK) $(test_load_OBJECTS) $(test_load_LDADD) $(LIBS) -test_loadb$(EXEEXT): $(test_loadb_OBJECTS) $(test_loadb_DEPENDENCIES) - @rm -f test_loadb$(EXEEXT) - $(LINK) $(test_loadb_OBJECTS) $(test_loadb_LDADD) $(LIBS) -test_memory_funcs$(EXEEXT): $(test_memory_funcs_OBJECTS) $(test_memory_funcs_DEPENDENCIES) - @rm -f test_memory_funcs$(EXEEXT) - $(LINK) $(test_memory_funcs_OBJECTS) $(test_memory_funcs_LDADD) $(LIBS) -test_number$(EXEEXT): $(test_number_OBJECTS) $(test_number_DEPENDENCIES) - @rm -f test_number$(EXEEXT) - $(LINK) $(test_number_OBJECTS) $(test_number_LDADD) $(LIBS) -test_object$(EXEEXT): $(test_object_OBJECTS) $(test_object_DEPENDENCIES) - @rm -f test_object$(EXEEXT) - $(LINK) $(test_object_OBJECTS) $(test_object_LDADD) $(LIBS) -test_pack$(EXEEXT): $(test_pack_OBJECTS) $(test_pack_DEPENDENCIES) - @rm -f test_pack$(EXEEXT) - $(LINK) $(test_pack_OBJECTS) $(test_pack_LDADD) $(LIBS) -test_simple$(EXEEXT): $(test_simple_OBJECTS) $(test_simple_DEPENDENCIES) - @rm -f test_simple$(EXEEXT) - $(LINK) $(test_simple_OBJECTS) $(test_simple_LDADD) $(LIBS) -test_unpack$(EXEEXT): $(test_unpack_OBJECTS) $(test_unpack_DEPENDENCIES) - @rm -f test_unpack$(EXEEXT) - $(LINK) $(test_unpack_OBJECTS) $(test_unpack_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_array.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_copy.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_dump.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_equal.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_load.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_loadb.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_memory_funcs.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_number.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_object.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_pack.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_simple.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_unpack.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-exec-am: - -install-html: install-html-am - -install-info: install-info-am - -install-man: - -install-pdf: install-pdf-am - -install-ps: install-ps-am - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean \ - clean-checkPROGRAMS clean-generic clean-libtool ctags \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/lang/c/jansson/test/suites/api/run b/lang/c/jansson/test/suites/api/run deleted file mode 100755 index f1aed9b971b..00000000000 --- a/lang/c/jansson/test/suites/api/run +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2009-2011 Petri Lehtinen -# -# Jansson is free software; you can redistribute it and/or modify -# it under the terms of the MIT license. See LICENSE for details. - -is_test() { - case "$test_name" in - *.c|check-exports) - return 0 - ;; - *) - return 1 - ;; - esac -} - -run_test() { - if [ "$test_name" = "check-exports" ]; then - test_log=$test_log $test_path >$test_log/stdout 2>$test_log/stderr - else - $test_runner $suite_builddir/${test_name%.c} \ - >$test_log/stdout \ - 2>$test_log/stderr \ - || return 1 - valgrind_check $test_log/stderr || return 1 - fi -} - -show_error() { - valgrind_show_error && return - cat $test_log/stderr -} - -. $top_srcdir/test/scripts/run-tests.sh diff --git a/lang/c/jansson/test/suites/api/test_array.c b/lang/c/jansson/test/suites/api/test_array.c deleted file mode 100644 index 18b46526636..00000000000 --- a/lang/c/jansson/test/suites/api/test_array.c +++ /dev/null @@ -1,400 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include "util.h" - -static void test_misc(void) -{ - json_t *array, *five, *seven, *value; - int i; - - array = json_array(); - five = json_integer(5); - seven = json_integer(7); - - if(!array) - fail("unable to create array"); - if(!five || !seven) - fail("unable to create integer"); - - if(json_array_size(array) != 0) - fail("empty array has nonzero size"); - - if(!json_array_append(array, NULL)) - fail("able to append NULL"); - - if(json_array_append(array, five)) - fail("unable to append"); - - if(json_array_size(array) != 1) - fail("wrong array size"); - - value = json_array_get(array, 0); - if(!value) - fail("unable to get item"); - if(value != five) - fail("got wrong value"); - - if(json_array_append(array, seven)) - fail("unable to append value"); - - if(json_array_size(array) != 2) - fail("wrong array size"); - - value = json_array_get(array, 1); - if(!value) - fail("unable to get item"); - if(value != seven) - fail("got wrong value"); - - if(json_array_set(array, 0, seven)) - fail("unable to set value"); - - if(!json_array_set(array, 0, NULL)) - fail("able to set NULL"); - - if(json_array_size(array) != 2) - fail("wrong array size"); - - value = json_array_get(array, 0); - if(!value) - fail("unable to get item"); - if(value != seven) - fail("got wrong value"); - - if(json_array_get(array, 2) != NULL) - fail("able to get value out of bounds"); - - if(!json_array_set(array, 2, seven)) - fail("able to set value out of bounds"); - - for(i = 2; i < 30; i++) { - if(json_array_append(array, seven)) - fail("unable to append value"); - - if(json_array_size(array) != i + 1) - fail("wrong array size"); - } - - for(i = 0; i < 30; i++) { - value = json_array_get(array, i); - if(!value) - fail("unable to get item"); - if(value != seven) - fail("got wrong value"); - } - - if(json_array_set_new(array, 15, json_integer(123))) - fail("unable to set new value"); - - value = json_array_get(array, 15); - if(!json_is_integer(value) || json_integer_value(value) != 123) - fail("json_array_set_new works incorrectly"); - - if(!json_array_set_new(array, 15, NULL)) - fail("able to set_new NULL value"); - - if(json_array_append_new(array, json_integer(321))) - fail("unable to append new value"); - - value = json_array_get(array, json_array_size(array) - 1); - if(!json_is_integer(value) || json_integer_value(value) != 321) - fail("json_array_append_new works incorrectly"); - - if(!json_array_append_new(array, NULL)) - fail("able to append_new NULL value"); - - json_decref(five); - json_decref(seven); - json_decref(array); -} - -static void test_insert(void) -{ - json_t *array, *five, *seven, *eleven, *value; - int i; - - array = json_array(); - five = json_integer(5); - seven = json_integer(7); - eleven = json_integer(11); - - if(!array) - fail("unable to create array"); - if(!five || !seven || !eleven) - fail("unable to create integer"); - - - if(!json_array_insert(array, 1, five)) - fail("able to insert value out of bounds"); - - - if(json_array_insert(array, 0, five)) - fail("unable to insert value in an empty array"); - - if(json_array_get(array, 0) != five) - fail("json_array_insert works incorrectly"); - - if(json_array_size(array) != 1) - fail("array size is invalid after insertion"); - - - if(json_array_insert(array, 1, seven)) - fail("unable to insert value at the end of an array"); - - if(json_array_get(array, 0) != five) - fail("json_array_insert works incorrectly"); - - if(json_array_get(array, 1) != seven) - fail("json_array_insert works incorrectly"); - - if(json_array_size(array) != 2) - fail("array size is invalid after insertion"); - - - if(json_array_insert(array, 1, eleven)) - fail("unable to insert value in the middle of an array"); - - if(json_array_get(array, 0) != five) - fail("json_array_insert works incorrectly"); - - if(json_array_get(array, 1) != eleven) - fail("json_array_insert works incorrectly"); - - if(json_array_get(array, 2) != seven) - fail("json_array_insert works incorrectly"); - - if(json_array_size(array) != 3) - fail("array size is invalid after insertion"); - - - if(json_array_insert_new(array, 2, json_integer(123))) - fail("unable to insert value in the middle of an array"); - - value = json_array_get(array, 2); - if(!json_is_integer(value) || json_integer_value(value) != 123) - fail("json_array_insert_new works incorrectly"); - - if(json_array_size(array) != 4) - fail("array size is invalid after insertion"); - - - for(i = 0; i < 20; i++) { - if(json_array_insert(array, 0, seven)) - fail("unable to insert value at the begining of an array"); - } - - for(i = 0; i < 20; i++) { - if(json_array_get(array, i) != seven) - fail("json_aray_insert works incorrectly"); - } - - if(json_array_size(array) != 24) - fail("array size is invalid after loop insertion"); - - json_decref(five); - json_decref(seven); - json_decref(eleven); - json_decref(array); -} - -static void test_remove(void) -{ - json_t *array, *five, *seven; - - array = json_array(); - five = json_integer(5); - seven = json_integer(7); - - if(!array) - fail("unable to create array"); - if(!five) - fail("unable to create integer"); - if(!seven) - fail("unable to create integer"); - - - if(!json_array_remove(array, 0)) - fail("able to remove an unexisting index"); - - - if(json_array_append(array, five)) - fail("unable to append"); - - if(!json_array_remove(array, 1)) - fail("able to remove an unexisting index"); - - if(json_array_remove(array, 0)) - fail("unable to remove"); - - if(json_array_size(array) != 0) - fail("array size is invalid after removing"); - - - if(json_array_append(array, five) || - json_array_append(array, seven) || - json_array_append(array, five) || - json_array_append(array, seven)) - fail("unable to append"); - - if(json_array_remove(array, 2)) - fail("unable to remove"); - - if(json_array_size(array) != 3) - fail("array size is invalid after removing"); - - if(json_array_get(array, 0) != five || - json_array_get(array, 1) != seven || - json_array_get(array, 2) != seven) - fail("remove works incorrectly"); - - json_decref(five); - json_decref(seven); - json_decref(array); -} - -static void test_clear(void) -{ - json_t *array, *five, *seven; - int i; - - array = json_array(); - five = json_integer(5); - seven = json_integer(7); - - if(!array) - fail("unable to create array"); - if(!five || !seven) - fail("unable to create integer"); - - for(i = 0; i < 10; i++) { - if(json_array_append(array, five)) - fail("unable to append"); - } - for(i = 0; i < 10; i++) { - if(json_array_append(array, seven)) - fail("unable to append"); - } - - if(json_array_size(array) != 20) - fail("array size is invalid after appending"); - - if(json_array_clear(array)) - fail("unable to clear"); - - if(json_array_size(array) != 0) - fail("array size is invalid after clearing"); - - json_decref(five); - json_decref(seven); - json_decref(array); -} - -static void test_extend(void) -{ - json_t *array1, *array2, *five, *seven; - int i; - - array1 = json_array(); - array2 = json_array(); - five = json_integer(5); - seven = json_integer(7); - - if(!array1 || !array2) - fail("unable to create array"); - if(!five || !seven) - fail("unable to create integer"); - - for(i = 0; i < 10; i++) { - if(json_array_append(array1, five)) - fail("unable to append"); - } - for(i = 0; i < 10; i++) { - if(json_array_append(array2, seven)) - fail("unable to append"); - } - - if(json_array_size(array1) != 10 || json_array_size(array2) != 10) - fail("array size is invalid after appending"); - - if(json_array_extend(array1, array2)) - fail("unable to extend"); - - for(i = 0; i < 10; i++) { - if(json_array_get(array1, i) != five) - fail("invalid array contents after extending"); - } - for(i = 10; i < 20; i++) { - if(json_array_get(array1, i) != seven) - fail("invalid array contents after extending"); - } - - json_decref(five); - json_decref(seven); - json_decref(array1); - json_decref(array2); -} - -static void test_circular() -{ - json_t *array1, *array2; - - /* the simple cases are checked */ - - array1 = json_array(); - if(!array1) - fail("unable to create array"); - - if(json_array_append(array1, array1) == 0) - fail("able to append self"); - - if(json_array_insert(array1, 0, array1) == 0) - fail("able to insert self"); - - if(json_array_append_new(array1, json_true())) - fail("failed to append true"); - - if(json_array_set(array1, 0, array1) == 0) - fail("able to set self"); - - json_decref(array1); - - - /* create circular references */ - - array1 = json_array(); - array2 = json_array(); - if(!array1 || !array2) - fail("unable to create array"); - - if(json_array_append(array1, array2) || - json_array_append(array2, array1)) - fail("unable to append"); - - /* circularity is detected when dumping */ - if(json_dumps(array1, 0) != NULL) - fail("able to dump circulars"); - - /* decref twice to deal with the circular references */ - json_decref(array1); - json_decref(array2); - json_decref(array1); -} - - -int main() -{ - test_misc(); - test_insert(); - test_remove(); - test_clear(); - test_extend(); - test_circular(); - - return 0; -} diff --git a/lang/c/jansson/test/suites/api/test_copy.c b/lang/c/jansson/test/suites/api/test_copy.c deleted file mode 100644 index 6310f69a6a6..00000000000 --- a/lang/c/jansson/test/suites/api/test_copy.c +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include -#include "util.h" - -static void test_copy_simple(void) -{ - json_t *value, *copy; - - if(json_copy(NULL)) - fail("copying NULL doesn't return NULL"); - - /* true */ - value = json_true(); - copy = json_copy(value); - if(value != copy) - fail("copying true failed"); - json_decref(value); - json_decref(copy); - - /* false */ - value = json_false(); - copy = json_copy(value); - if(value != copy) - fail("copying false failed"); - json_decref(value); - json_decref(copy); - - /* null */ - value = json_null(); - copy = json_copy(value); - if(value != copy) - fail("copying null failed"); - json_decref(value); - json_decref(copy); - - /* string */ - value = json_string("foo"); - if(!value) - fail("unable to create a string"); - copy = json_copy(value); - if(!copy) - fail("unable to copy a string"); - if(copy == value) - fail("copying a string doesn't copy"); - if(!json_equal(copy, value)) - fail("copying a string produces an inequal copy"); - if(value->refcount != 1 || copy->refcount != 1) - fail("invalid refcounts"); - json_decref(value); - json_decref(copy); - - /* integer */ - value = json_integer(543); - if(!value) - fail("unable to create an integer"); - copy = json_copy(value); - if(!copy) - fail("unable to copy an integer"); - if(copy == value) - fail("copying an integer doesn't copy"); - if(!json_equal(copy, value)) - fail("copying an integer produces an inequal copy"); - if(value->refcount != 1 || copy->refcount != 1) - fail("invalid refcounts"); - json_decref(value); - json_decref(copy); - - /* real */ - value = json_real(123e9); - if(!value) - fail("unable to create a real"); - copy = json_copy(value); - if(!copy) - fail("unable to copy a real"); - if(copy == value) - fail("copying a real doesn't copy"); - if(!json_equal(copy, value)) - fail("copying a real produces an inequal copy"); - if(value->refcount != 1 || copy->refcount != 1) - fail("invalid refcounts"); - json_decref(value); - json_decref(copy); -} - -static void test_deep_copy_simple(void) -{ - json_t *value, *copy; - - if(json_deep_copy(NULL)) - fail("deep copying NULL doesn't return NULL"); - - /* true */ - value = json_true(); - copy = json_deep_copy(value); - if(value != copy) - fail("deep copying true failed"); - json_decref(value); - json_decref(copy); - - /* false */ - value = json_false(); - copy = json_deep_copy(value); - if(value != copy) - fail("deep copying false failed"); - json_decref(value); - json_decref(copy); - - /* null */ - value = json_null(); - copy = json_deep_copy(value); - if(value != copy) - fail("deep copying null failed"); - json_decref(value); - json_decref(copy); - - /* string */ - value = json_string("foo"); - if(!value) - fail("unable to create a string"); - copy = json_deep_copy(value); - if(!copy) - fail("unable to deep copy a string"); - if(copy == value) - fail("deep copying a string doesn't copy"); - if(!json_equal(copy, value)) - fail("deep copying a string produces an inequal copy"); - if(value->refcount != 1 || copy->refcount != 1) - fail("invalid refcounts"); - json_decref(value); - json_decref(copy); - - /* integer */ - value = json_integer(543); - if(!value) - fail("unable to create an integer"); - copy = json_deep_copy(value); - if(!copy) - fail("unable to deep copy an integer"); - if(copy == value) - fail("deep copying an integer doesn't copy"); - if(!json_equal(copy, value)) - fail("deep copying an integer produces an inequal copy"); - if(value->refcount != 1 || copy->refcount != 1) - fail("invalid refcounts"); - json_decref(value); - json_decref(copy); - - /* real */ - value = json_real(123e9); - if(!value) - fail("unable to create a real"); - copy = json_deep_copy(value); - if(!copy) - fail("unable to deep copy a real"); - if(copy == value) - fail("deep copying a real doesn't copy"); - if(!json_equal(copy, value)) - fail("deep copying a real produces an inequal copy"); - if(value->refcount != 1 || copy->refcount != 1) - fail("invalid refcounts"); - json_decref(value); - json_decref(copy); -} - -static void test_copy_array(void) -{ - const char *json_array_text = "[1, \"foo\", 3.141592, {\"foo\": \"bar\"}]"; - - json_t *array, *copy; - size_t i; - - array = json_loads(json_array_text, 0, NULL); - if(!array) - fail("unable to parse an array"); - - copy = json_copy(array); - if(!copy) - fail("unable to copy an array"); - if(copy == array) - fail("copying an array doesn't copy"); - if(!json_equal(copy, array)) - fail("copying an array produces an inequal copy"); - - for(i = 0; i < json_array_size(copy); i++) - { - if(json_array_get(array, i) != json_array_get(copy, i)) - fail("copying an array modifies its elements"); - } - - json_decref(array); - json_decref(copy); -} - -static void test_deep_copy_array(void) -{ - const char *json_array_text = "[1, \"foo\", 3.141592, {\"foo\": \"bar\"}]"; - - json_t *array, *copy; - size_t i; - - array = json_loads(json_array_text, 0, NULL); - if(!array) - fail("unable to parse an array"); - - copy = json_deep_copy(array); - if(!copy) - fail("unable to deep copy an array"); - if(copy == array) - fail("deep copying an array doesn't copy"); - if(!json_equal(copy, array)) - fail("deep copying an array produces an inequal copy"); - - for(i = 0; i < json_array_size(copy); i++) - { - if(json_array_get(array, i) == json_array_get(copy, i)) - fail("deep copying an array doesn't copy its elements"); - } - - json_decref(array); - json_decref(copy); -} - -static void test_copy_object(void) -{ - const char *json_object_text = - "{\"foo\": \"bar\", \"a\": 1, \"b\": 3.141592, \"c\": [1,2,3,4]}"; - - json_t *object, *copy; - void *iter; - - object = json_loads(json_object_text, 0, NULL); - if(!object) - fail("unable to parse an object"); - - copy = json_copy(object); - if(!copy) - fail("unable to copy an object"); - if(copy == object) - fail("copying an object doesn't copy"); - if(!json_equal(copy, object)) - fail("copying an object produces an inequal copy"); - - iter = json_object_iter(object); - while(iter) - { - const char *key; - json_t *value1, *value2; - - key = json_object_iter_key(iter); - value1 = json_object_iter_value(iter); - value2 = json_object_get(copy, key); - - if(value1 != value2) - fail("deep copying an object modifies its items"); - - iter = json_object_iter_next(object, iter); - } - - json_decref(object); - json_decref(copy); -} - -static void test_deep_copy_object(void) -{ - const char *json_object_text = - "{\"foo\": \"bar\", \"a\": 1, \"b\": 3.141592, \"c\": [1,2,3,4]}"; - - json_t *object, *copy; - void *iter; - - object = json_loads(json_object_text, 0, NULL); - if(!object) - fail("unable to parse an object"); - - copy = json_deep_copy(object); - if(!copy) - fail("unable to deep copy an object"); - if(copy == object) - fail("deep copying an object doesn't copy"); - if(!json_equal(copy, object)) - fail("deep copying an object produces an inequal copy"); - - iter = json_object_iter(object); - while(iter) - { - const char *key; - json_t *value1, *value2; - - key = json_object_iter_key(iter); - value1 = json_object_iter_value(iter); - value2 = json_object_get(copy, key); - - if(value1 == value2) - fail("deep copying an object doesn't copy its items"); - - iter = json_object_iter_next(object, iter); - } - - json_decref(object); - json_decref(copy); -} - -int main() -{ - test_copy_simple(); - test_deep_copy_simple(); - test_copy_array(); - test_deep_copy_array(); - test_copy_object(); - test_deep_copy_object(); - return 0; -} diff --git a/lang/c/jansson/test/suites/api/test_dump.c b/lang/c/jansson/test/suites/api/test_dump.c deleted file mode 100644 index 17d588bb105..00000000000 --- a/lang/c/jansson/test/suites/api/test_dump.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include -#include "util.h" - -static void encode_twice() -{ - /* Encode an empty object/array, add an item, encode again */ - - json_t *json; - char *result; - - json = json_object(); - result = json_dumps(json, 0); - if(!result || strcmp(result, "{}")) - fail("json_dumps failed"); - free(result); - - json_object_set_new(json, "foo", json_integer(5)); - result = json_dumps(json, 0); - if(!result || strcmp(result, "{\"foo\": 5}")) - fail("json_dumps failed"); - free(result); - - json_decref(json); - - json = json_array(); - result = json_dumps(json, 0); - if(!result || strcmp(result, "[]")) - fail("json_dumps failed"); - free(result); - - json_array_append_new(json, json_integer(5)); - result = json_dumps(json, 0); - if(!result || strcmp(result, "[5]")) - fail("json_dumps failed"); - free(result); - - json_decref(json); -} - -static void circular_references() -{ - /* Construct a JSON object/array with a circular reference: - - object: {"a": {"b": {"c": }}} - array: [[[]]] - - Encode it, remove the circular reference and encode again. - */ - - json_t *json; - char *result; - - json = json_object(); - json_object_set_new(json, "a", json_object()); - json_object_set_new(json_object_get(json, "a"), "b", json_object()); - json_object_set(json_object_get(json_object_get(json, "a"), "b"), "c", - json_object_get(json, "a")); - - if(json_dumps(json, 0)) - fail("json_dumps encoded a circular reference!"); - - json_object_del(json_object_get(json_object_get(json, "a"), "b"), "c"); - - result = json_dumps(json, 0); - if(!result || strcmp(result, "{\"a\": {\"b\": {}}}")) - fail("json_dumps failed!"); - free(result); - - json_decref(json); - - json = json_array(); - json_array_append_new(json, json_array()); - json_array_append_new(json_array_get(json, 0), json_array()); - json_array_append(json_array_get(json_array_get(json, 0), 0), - json_array_get(json, 0)); - - if(json_dumps(json, 0)) - fail("json_dumps encoded a circular reference!"); - - json_array_remove(json_array_get(json_array_get(json, 0), 0), 0); - - result = json_dumps(json, 0); - if(!result || strcmp(result, "[[[]]]")) - fail("json_dumps failed!"); - free(result); - - json_decref(json); -} - -static void encode_other_than_array_or_object() -{ - /* Encoding anything other than array or object should only - * succeed if the JSON_ENCODE_ANY flag is used */ - - json_t *json; - FILE *fp = NULL; - char *result; - - json = json_string("foo"); - if(json_dumps(json, 0) != NULL) - fail("json_dumps encoded a string!"); - if(json_dumpf(json, fp, 0) == 0) - fail("json_dumpf encoded a string!"); - - result = json_dumps(json, JSON_ENCODE_ANY); - if(!result || strcmp(result, "\"foo\"") != 0) - fail("json_dumps failed to encode a string with JSON_ENCODE_ANY"); - - free(result); - json_decref(json); - - json = json_integer(42); - if(json_dumps(json, 0) != NULL) - fail("json_dumps encoded an integer!"); - if(json_dumpf(json, fp, 0) == 0) - fail("json_dumpf encoded an integer!"); - - result = json_dumps(json, JSON_ENCODE_ANY); - if(!result || strcmp(result, "42") != 0) - fail("json_dumps failed to encode an integer with JSON_ENCODE_ANY"); - - free(result); - json_decref(json); - - -} - -int main() -{ - encode_twice(); - circular_references(); - encode_other_than_array_or_object(); - return 0; -} diff --git a/lang/c/jansson/test/suites/api/test_equal.c b/lang/c/jansson/test/suites/api/test_equal.c deleted file mode 100644 index ba7ab43af10..00000000000 --- a/lang/c/jansson/test/suites/api/test_equal.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include "util.h" - -static void test_equal_simple() -{ - json_t *value1, *value2; - - if(json_equal(NULL, NULL)) - fail("json_equal fails for two NULLs"); - - value1 = json_true(); - if(json_equal(value1, NULL) || json_equal(NULL, value1)) - fail("json_equal fails for NULL"); - - /* this covers true, false and null as they are singletons */ - if(!json_equal(value1, value1)) - fail("identical objects are not equal"); - json_decref(value1); - - /* integer */ - value1 = json_integer(1); - value2 = json_integer(1); - if(!value1 || !value2) - fail("unable to create integers"); - if(!json_equal(value1, value2)) - fail("json_equal fails for two equal integers"); - json_decref(value2); - - value2 = json_integer(2); - if(!value2) - fail("unable to create an integer"); - if(json_equal(value1, value2)) - fail("json_equal fails for two inequal integers"); - - json_decref(value1); - json_decref(value2); - - /* real */ - value1 = json_real(1.2); - value2 = json_real(1.2); - if(!value1 || !value2) - fail("unable to create reals"); - if(!json_equal(value1, value2)) - fail("json_equal fails for two equal reals"); - json_decref(value2); - - value2 = json_real(3.141592); - if(!value2) - fail("unable to create an real"); - if(json_equal(value1, value2)) - fail("json_equal fails for two inequal reals"); - - json_decref(value1); - json_decref(value2); - - /* string */ - value1 = json_string("foo"); - value2 = json_string("foo"); - if(!value1 || !value2) - fail("unable to create strings"); - if(!json_equal(value1, value2)) - fail("json_equal fails for two equal strings"); - json_decref(value2); - - value2 = json_string("bar"); - if(!value2) - fail("unable to create an string"); - if(json_equal(value1, value2)) - fail("json_equal fails for two inequal strings"); - - json_decref(value1); - json_decref(value2); -} - -static void test_equal_array() -{ - json_t *array1, *array2; - - array1 = json_array(); - array2 = json_array(); - if(!array1 || !array2) - fail("unable to create arrays"); - - if(!json_equal(array1, array2)) - fail("json_equal fails for two empty arrays"); - - json_array_append_new(array1, json_integer(1)); - json_array_append_new(array2, json_integer(1)); - json_array_append_new(array1, json_string("foo")); - json_array_append_new(array2, json_string("foo")); - json_array_append_new(array1, json_integer(2)); - json_array_append_new(array2, json_integer(2)); - if(!json_equal(array1, array2)) - fail("json_equal fails for two equal arrays"); - - json_array_remove(array2, 2); - if(json_equal(array1, array2)) - fail("json_equal fails for two inequal arrays"); - - json_array_append_new(array2, json_integer(3)); - if(json_equal(array1, array2)) - fail("json_equal fails for two inequal arrays"); - - json_decref(array1); - json_decref(array2); -} - -static void test_equal_object() -{ - json_t *object1, *object2; - - object1 = json_object(); - object2 = json_object(); - if(!object1 || !object2) - fail("unable to create objects"); - - if(!json_equal(object1, object2)) - fail("json_equal fails for two empty objects"); - - json_object_set_new(object1, "a", json_integer(1)); - json_object_set_new(object2, "a", json_integer(1)); - json_object_set_new(object1, "b", json_string("foo")); - json_object_set_new(object2, "b", json_string("foo")); - json_object_set_new(object1, "c", json_integer(2)); - json_object_set_new(object2, "c", json_integer(2)); - if(!json_equal(object1, object2)) - fail("json_equal fails for two equal objects"); - - json_object_del(object2, "c"); - if(json_equal(object1, object2)) - fail("json_equal fails for two inequal objects"); - - json_object_set_new(object2, "c", json_integer(3)); - if(json_equal(object1, object2)) - fail("json_equal fails for two inequal objects"); - - json_object_del(object2, "c"); - json_object_set_new(object2, "d", json_integer(2)); - if(json_equal(object1, object2)) - fail("json_equal fails for two inequal objects"); - - json_decref(object1); - json_decref(object2); -} - -static void test_equal_complex() -{ - json_t *value1, *value2; - - const char *complex_json = -"{" -" \"integer\": 1, " -" \"real\": 3.141592, " -" \"string\": \"foobar\", " -" \"true\": true, " -" \"object\": {" -" \"array-in-object\": [1,true,\"foo\",{}]," -" \"object-in-object\": {\"foo\": \"bar\"}" -" }," -" \"array\": [\"foo\", false, null, 1.234]" -"}"; - - value1 = json_loads(complex_json, 0, NULL); - value2 = json_loads(complex_json, 0, NULL); - if(!value1 || !value2) - fail("unable to parse JSON"); - if(!json_equal(value1, value2)) - fail("json_equal fails for two inequal strings"); - - json_decref(value1); - json_decref(value2); - - /* TODO: There's no negative test case here */ -} - -int main() -{ - test_equal_simple(); - test_equal_array(); - test_equal_object(); - test_equal_complex(); - return 0; -} diff --git a/lang/c/jansson/test/suites/api/test_load.c b/lang/c/jansson/test/suites/api/test_load.c deleted file mode 100644 index 2a60eb32d8a..00000000000 --- a/lang/c/jansson/test/suites/api/test_load.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include -#include "util.h" - -static void file_not_found() -{ - json_t *json; - json_error_t error; - - json = json_load_file("/path/to/nonexistent/file.json", 0, &error); - if(json) - fail("json_load_file returned non-NULL for a nonexistent file"); - if(error.line != -1) - fail("json_load_file returned an invalid line number"); - if(strcmp(error.text, "unable to open /path/to/nonexistent/file.json: No such file or directory") != 0) - fail("json_load_file returned an invalid error message"); -} - -static void reject_duplicates() -{ - json_error_t error; - - if(json_loads("{\"foo\": 1, \"foo\": 2}", JSON_REJECT_DUPLICATES, &error)) - fail("json_loads did not detect a duplicate key"); - check_error("duplicate object key near '\"foo\"'", "", 1, 16, 16); -} - -static void disable_eof_check() -{ - json_error_t error; - json_t *json; - - const char *text = "{\"foo\": 1} garbage"; - - if(json_loads(text, 0, &error)) - fail("json_loads did not detect garbage after JSON text"); - check_error("end of file expected near 'garbage'", "", 1, 18, 18); - - json = json_loads(text, JSON_DISABLE_EOF_CHECK, &error); - if(!json) - fail("json_loads failed with JSON_DISABLE_EOF_CHECK"); - - json_decref(json); -} - -int main() -{ - file_not_found(); - reject_duplicates(); - disable_eof_check(); - - return 0; -} diff --git a/lang/c/jansson/test/suites/api/test_loadb.c b/lang/c/jansson/test/suites/api/test_loadb.c deleted file mode 100644 index 27ea5755f8a..00000000000 --- a/lang/c/jansson/test/suites/api/test_loadb.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include -#include "util.h" - -int main() -{ - json_t *json; - json_error_t error; - const char str[] = "[\"A\", {\"B\": \"C\"}, 1, 2, 3]garbage"; - size_t len = strlen(str) - strlen("garbage"); - - json = json_loadb(str, len, 0, &error); - if(!json) { - fail("json_loadb failed on a valid JSON buffer"); - } - json_decref(json); - - json = json_loadb(str, len - 1, 0, &error); - if (json) { - json_decref(json); - fail("json_loadb should have failed on an incomplete buffer, but it didn't"); - } - if(error.line != 1) { - fail("json_loadb returned an invalid line number on fail"); - } - if(strcmp(error.text, "']' expected near end of file") != 0) { - fail("json_loadb returned an invalid error message for an unclosed top-level array"); - } - - return 0; -} diff --git a/lang/c/jansson/test/suites/api/test_memory_funcs.c b/lang/c/jansson/test/suites/api/test_memory_funcs.c deleted file mode 100644 index 1a6681f3f68..00000000000 --- a/lang/c/jansson/test/suites/api/test_memory_funcs.c +++ /dev/null @@ -1,84 +0,0 @@ -#include -#include - -#include "util.h" - -static int malloc_called = 0; -static int free_called = 0; - -/* helper */ -static void create_and_free_complex_object() -{ - json_t *obj; - - obj = json_pack("{s:i,s:n,s:b,s:b,s:{s:s},s:[i,i,i]", - "foo", 42, - "bar", - "baz", 1, - "qux", 0, - "alice", "bar", "baz", - "bob", 9, 8, 7); - - json_decref(obj); -} - -static void *my_malloc(size_t size) -{ - malloc_called += 1; - return malloc(size); -} - -static void my_free(void *ptr) -{ - free_called += 1; - free(ptr); -} - -static void test_simple() -{ - json_set_alloc_funcs(my_malloc, my_free); - create_and_free_complex_object(); - - if(malloc_called != 27 || free_called != 27) - fail("Custom allocation failed"); -} - - -/* - Test the secure memory functions code given in the API reference - documentation, but by using plain memset instead of - guaranteed_memset(). -*/ - -static void *secure_malloc(size_t size) -{ - /* Store the memory area size in the beginning of the block */ - void *ptr = malloc(size + 8); - *((size_t *)ptr) = size; - return ptr + 8; -} - -static void secure_free(void *ptr) -{ - size_t size; - - ptr -= 8; - size = *((size_t *)ptr); - - /*guaranteed_*/memset(ptr, 0, size); - free(ptr); -} - -static void test_secure_funcs(void) -{ - json_set_alloc_funcs(secure_malloc, secure_free); - create_and_free_complex_object(); -} - -int main() -{ - test_simple(); - test_secure_funcs(); - - return 0; -} diff --git a/lang/c/jansson/test/suites/api/test_number.c b/lang/c/jansson/test/suites/api/test_number.c deleted file mode 100644 index ff0741e559c..00000000000 --- a/lang/c/jansson/test/suites/api/test_number.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include "util.h" - -int main() -{ - json_t *integer, *real; - int i; - double d; - - integer = json_integer(5); - real = json_real(100.1); - - if(!integer) - fail("unable to create integer"); - if(!real) - fail("unable to create real"); - - i = json_integer_value(integer); - if(i != 5) - fail("wrong integer value"); - - d = json_real_value(real); - if(d != 100.1) - fail("wrong real value"); - - d = json_number_value(integer); - if(d != 5.0) - fail("wrong number value"); - d = json_number_value(real); - if(d != 100.1) - fail("wrong number value"); - - json_decref(integer); - json_decref(real); - - return 0; -} diff --git a/lang/c/jansson/test/suites/api/test_object.c b/lang/c/jansson/test/suites/api/test_object.c deleted file mode 100644 index 0499f766696..00000000000 --- a/lang/c/jansson/test/suites/api/test_object.c +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include -#include "util.h" - -static void test_clear() -{ - json_t *object, *ten; - - object = json_object(); - ten = json_integer(10); - - if(!object) - fail("unable to create object"); - if(!ten) - fail("unable to create integer"); - - if(json_object_set(object, "a", ten) || - json_object_set(object, "b", ten) || - json_object_set(object, "c", ten) || - json_object_set(object, "d", ten) || - json_object_set(object, "e", ten)) - fail("unable to set value"); - - if(json_object_size(object) != 5) - fail("invalid size"); - - json_object_clear(object); - - if(json_object_size(object) != 0) - fail("invalid size after clear"); - - json_decref(ten); - json_decref(object); -} - -static void test_update() -{ - json_t *object, *other, *nine, *ten; - - object = json_object(); - other = json_object(); - - nine = json_integer(9); - ten = json_integer(10); - - if(!object || !other) - fail("unable to create object"); - if(!nine || !ten) - fail("unable to create integer"); - - - /* update an empty object with an empty object */ - - if(json_object_update(object, other)) - fail("unable to update an emtpy object with an empty object"); - - if(json_object_size(object) != 0) - fail("invalid size after update"); - - if(json_object_size(other) != 0) - fail("invalid size for updater after update"); - - - /* update an empty object with a nonempty object */ - - if(json_object_set(other, "a", ten) || - json_object_set(other, "b", ten) || - json_object_set(other, "c", ten) || - json_object_set(other, "d", ten) || - json_object_set(other, "e", ten)) - fail("unable to set value"); - - if(json_object_update(object, other)) - fail("unable to update an empty object"); - - if(json_object_size(object) != 5) - fail("invalid size after update"); - - if(json_object_get(object, "a") != ten || - json_object_get(object, "b") != ten || - json_object_get(object, "c") != ten || - json_object_get(object, "d") != ten || - json_object_get(object, "e") != ten) - fail("update works incorrectly"); - - - /* perform the same update again */ - - if(json_object_update(object, other)) - fail("unable to update an empty object"); - - if(json_object_size(object) != 5) - fail("invalid size after update"); - - if(json_object_get(object, "a") != ten || - json_object_get(object, "b") != ten || - json_object_get(object, "c") != ten || - json_object_get(object, "d") != ten || - json_object_get(object, "e") != ten) - fail("update works incorrectly"); - - - /* update a nonempty object with a nonempty object with both old - and new keys */ - - if(json_object_clear(other)) - fail("clear failed"); - - if(json_object_set(other, "a", nine) || - json_object_set(other, "b", nine) || - json_object_set(other, "f", nine) || - json_object_set(other, "g", nine) || - json_object_set(other, "h", nine)) - fail("unable to set value"); - - if(json_object_update(object, other)) - fail("unable to update a nonempty object"); - - if(json_object_size(object) != 8) - fail("invalid size after update"); - - if(json_object_get(object, "a") != nine || - json_object_get(object, "b") != nine || - json_object_get(object, "f") != nine || - json_object_get(object, "g") != nine || - json_object_get(object, "h") != nine) - fail("update works incorrectly"); - - json_decref(nine); - json_decref(ten); - json_decref(other); - json_decref(object); -} - -static void test_circular() -{ - json_t *object1, *object2; - - object1 = json_object(); - object2 = json_object(); - if(!object1 || !object2) - fail("unable to create object"); - - /* the simple case is checked */ - if(json_object_set(object1, "a", object1) == 0) - fail("able to set self"); - - /* create circular references */ - if(json_object_set(object1, "a", object2) || - json_object_set(object2, "a", object1)) - fail("unable to set value"); - - /* circularity is detected when dumping */ - if(json_dumps(object1, 0) != NULL) - fail("able to dump circulars"); - - /* decref twice to deal with the circular references */ - json_decref(object1); - json_decref(object2); - json_decref(object1); -} - -static void test_set_nocheck() -{ - json_t *object, *string; - - object = json_object(); - string = json_string("bar"); - - if(!object) - fail("unable to create object"); - if(!string) - fail("unable to create string"); - - if(json_object_set_nocheck(object, "foo", string)) - fail("json_object_set_nocheck failed"); - if(json_object_get(object, "foo") != string) - fail("json_object_get after json_object_set_nocheck failed"); - - /* invalid UTF-8 in key */ - if(json_object_set_nocheck(object, "a\xefz", string)) - fail("json_object_set_nocheck failed for invalid UTF-8"); - if(json_object_get(object, "a\xefz") != string) - fail("json_object_get after json_object_set_nocheck failed"); - - if(json_object_set_new_nocheck(object, "bax", json_integer(123))) - fail("json_object_set_new_nocheck failed"); - if(json_integer_value(json_object_get(object, "bax")) != 123) - fail("json_object_get after json_object_set_new_nocheck failed"); - - /* invalid UTF-8 in key */ - if(json_object_set_new_nocheck(object, "asdf\xfe", json_integer(321))) - fail("json_object_set_new_nocheck failed for invalid UTF-8"); - if(json_integer_value(json_object_get(object, "asdf\xfe")) != 321) - fail("json_object_get after json_object_set_new_nocheck failed"); - - json_decref(string); - json_decref(object); -} - -static void test_iterators() -{ - json_t *object, *foo, *bar, *baz; - void *iter; - - if(json_object_iter(NULL)) - fail("able to iterate over NULL"); - - if(json_object_iter_next(NULL, NULL)) - fail("able to increment an iterator on a NULL object"); - - object = json_object(); - foo = json_string("foo"); - bar = json_string("bar"); - baz = json_string("baz"); - if(!object || !foo || !bar || !bar) - fail("unable to create values"); - - if(json_object_iter_next(object, NULL)) - fail("able to increment a NULL iterator"); - - if(json_object_set(object, "a", foo) || - json_object_set(object, "b", bar) || - json_object_set(object, "c", baz)) - fail("unable to populate object"); - - iter = json_object_iter(object); - if(!iter) - fail("unable to get iterator"); - if(strcmp(json_object_iter_key(iter), "a")) - fail("iterating failed: wrong key"); - if(json_object_iter_value(iter) != foo) - fail("iterating failed: wrong value"); - - iter = json_object_iter_next(object, iter); - if(!iter) - fail("unable to increment iterator"); - if(strcmp(json_object_iter_key(iter), "b")) - fail("iterating failed: wrong key"); - if(json_object_iter_value(iter) != bar) - fail("iterating failed: wrong value"); - - iter = json_object_iter_next(object, iter); - if(!iter) - fail("unable to increment iterator"); - if(strcmp(json_object_iter_key(iter), "c")) - fail("iterating failed: wrong key"); - if(json_object_iter_value(iter) != baz) - fail("iterating failed: wrong value"); - - if(json_object_iter_next(object, iter) != NULL) - fail("able to iterate over the end"); - - if(json_object_iter_at(object, "foo")) - fail("json_object_iter_at() succeeds for non-existent key"); - - iter = json_object_iter_at(object, "b"); - if(!iter) - fail("json_object_iter_at() fails for an existing key"); - - if(strcmp(json_object_iter_key(iter), "b")) - fail("iterating failed: wrong key"); - if(json_object_iter_value(iter) != bar) - fail("iterating failed: wrong value"); - - iter = json_object_iter_next(object, iter); - if(!iter) - fail("unable to increment iterator"); - if(strcmp(json_object_iter_key(iter), "c")) - fail("iterating failed: wrong key"); - if(json_object_iter_value(iter) != baz) - fail("iterating failed: wrong value"); - - if(json_object_iter_set(object, iter, bar)) - fail("unable to set value at iterator"); - - if(strcmp(json_object_iter_key(iter), "c")) - fail("json_object_iter_key() fails after json_object_iter_set()"); - if(json_object_iter_value(iter) != bar) - fail("json_object_iter_value() fails after json_object_iter_set()"); - if(json_object_get(object, "c") != bar) - fail("json_object_get() fails after json_object_iter_set()"); - - json_decref(object); - json_decref(foo); - json_decref(bar); - json_decref(baz); -} - -static void test_misc() -{ - json_t *object, *string, *other_string, *value; - - object = json_object(); - string = json_string("test"); - other_string = json_string("other"); - - if(!object) - fail("unable to create object"); - if(!string || !other_string) - fail("unable to create string"); - - if(json_object_get(object, "a")) - fail("value for nonexisting key"); - - if(json_object_set(object, "a", string)) - fail("unable to set value"); - - if(!json_object_set(object, NULL, string)) - fail("able to set NULL key"); - - if(!json_object_set(object, "a", NULL)) - fail("able to set NULL value"); - - /* invalid UTF-8 in key */ - if(!json_object_set(object, "a\xefz", string)) - fail("able to set invalid unicode key"); - - value = json_object_get(object, "a"); - if(!value) - fail("no value for existing key"); - if(value != string) - fail("got different value than what was added"); - - /* "a", "lp" and "px" collide in a five-bucket hashtable */ - if(json_object_set(object, "b", string) || - json_object_set(object, "lp", string) || - json_object_set(object, "px", string)) - fail("unable to set value"); - - value = json_object_get(object, "a"); - if(!value) - fail("no value for existing key"); - if(value != string) - fail("got different value than what was added"); - - if(json_object_set(object, "a", other_string)) - fail("unable to replace an existing key"); - - value = json_object_get(object, "a"); - if(!value) - fail("no value for existing key"); - if(value != other_string) - fail("got different value than what was set"); - - if(!json_object_del(object, "nonexisting")) - fail("able to delete a nonexisting key"); - - if(json_object_del(object, "px")) - fail("unable to delete an existing key"); - - if(json_object_del(object, "a")) - fail("unable to delete an existing key"); - - if(json_object_del(object, "lp")) - fail("unable to delete an existing key"); - - - /* add many keys to initiate rehashing */ - - if(json_object_set(object, "a", string)) - fail("unable to set value"); - - if(json_object_set(object, "lp", string)) - fail("unable to set value"); - - if(json_object_set(object, "px", string)) - fail("unable to set value"); - - if(json_object_set(object, "c", string)) - fail("unable to set value"); - - if(json_object_set(object, "d", string)) - fail("unable to set value"); - - if(json_object_set(object, "e", string)) - fail("unable to set value"); - - - if(json_object_set_new(object, "foo", json_integer(123))) - fail("unable to set new value"); - - value = json_object_get(object, "foo"); - if(!json_is_integer(value) || json_integer_value(value) != 123) - fail("json_object_set_new works incorrectly"); - - if(!json_object_set_new(object, NULL, json_integer(432))) - fail("able to set_new NULL key"); - - if(!json_object_set_new(object, "foo", NULL)) - fail("able to set_new NULL value"); - - json_decref(string); - json_decref(other_string); - json_decref(object); -} - -static void test_preserve_order() -{ - json_t *object; - char *result; - - const char *expected = "{\"foobar\": 1, \"bazquux\": 6, \"lorem ipsum\": 3, \"sit amet\": 5, \"helicopter\": 7}"; - - object = json_object(); - - json_object_set_new(object, "foobar", json_integer(1)); - json_object_set_new(object, "bazquux", json_integer(2)); - json_object_set_new(object, "lorem ipsum", json_integer(3)); - json_object_set_new(object, "dolor", json_integer(4)); - json_object_set_new(object, "sit amet", json_integer(5)); - - /* changing a value should preserve the order */ - json_object_set_new(object, "bazquux", json_integer(6)); - - /* deletion shouldn't change the order of others */ - json_object_del(object, "dolor"); - - /* add a new item just to make sure */ - json_object_set_new(object, "helicopter", json_integer(7)); - - result = json_dumps(object, JSON_PRESERVE_ORDER); - - if(strcmp(expected, result) != 0) { - fprintf(stderr, "%s != %s", expected, result); - fail("JSON_PRESERVE_ORDER doesn't work"); - } - - free(result); - json_decref(object); -} - -int main() -{ - test_misc(); - test_clear(); - test_update(); - test_circular(); - test_set_nocheck(); - test_iterators(); - test_preserve_order(); - - return 0; -} diff --git a/lang/c/jansson/test/suites/api/test_pack.c b/lang/c/jansson/test/suites/api/test_pack.c deleted file mode 100644 index ccab051b539..00000000000 --- a/lang/c/jansson/test/suites/api/test_pack.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * Copyright (c) 2010-2011 Graeme Smecher - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include -#include -#include "util.h" - -int main() -{ - json_t *value; - int i; - json_error_t error; - - /* - * Simple, valid json_pack cases - */ - - /* true */ - value = json_pack("b", 1); - if(!json_is_true(value)) - fail("json_pack boolean failed"); - if(value->refcount != (ssize_t)-1) - fail("json_pack boolean refcount failed"); - json_decref(value); - - /* false */ - value = json_pack("b", 0); - if(!json_is_false(value)) - fail("json_pack boolean failed"); - if(value->refcount != (ssize_t)-1) - fail("json_pack boolean refcount failed"); - json_decref(value); - - /* null */ - value = json_pack("n"); - if(!json_is_null(value)) - fail("json_pack null failed"); - if(value->refcount != (ssize_t)-1) - fail("json_pack null refcount failed"); - json_decref(value); - - /* integer */ - value = json_pack("i", 1); - if(!json_is_integer(value) || json_integer_value(value) != 1) - fail("json_pack integer failed"); - if(value->refcount != (ssize_t)1) - fail("json_pack integer refcount failed"); - json_decref(value); - - /* integer from json_int_t */ - value = json_pack("I", (json_int_t)555555); - if(!json_is_integer(value) || json_integer_value(value) != 555555) - fail("json_pack json_int_t failed"); - if(value->refcount != (ssize_t)1) - fail("json_pack integer refcount failed"); - json_decref(value); - - /* real */ - value = json_pack("f", 1.0); - if(!json_is_real(value) || json_real_value(value) != 1.0) - fail("json_pack real failed"); - if(value->refcount != (ssize_t)1) - fail("json_pack real refcount failed"); - json_decref(value); - - /* string */ - value = json_pack("s", "test"); - if(!json_is_string(value) || strcmp("test", json_string_value(value))) - fail("json_pack string failed"); - if(value->refcount != (ssize_t)1) - fail("json_pack string refcount failed"); - json_decref(value); - - /* empty object */ - value = json_pack("{}", 1.0); - if(!json_is_object(value) || json_object_size(value) != 0) - fail("json_pack empty object failed"); - if(value->refcount != (ssize_t)1) - fail("json_pack empty object refcount failed"); - json_decref(value); - - /* empty list */ - value = json_pack("[]", 1.0); - if(!json_is_array(value) || json_array_size(value) != 0) - fail("json_pack empty list failed"); - if(value->refcount != (ssize_t)1) - fail("json_pack empty list failed"); - json_decref(value); - - /* non-incref'd object */ - value = json_pack("o", json_integer(1)); - if(!json_is_integer(value) || json_integer_value(value) != 1) - fail("json_pack object failed"); - if(value->refcount != (ssize_t)1) - fail("json_pack integer refcount failed"); - json_decref(value); - - /* incref'd object */ - value = json_pack("O", json_integer(1)); - if(!json_is_integer(value) || json_integer_value(value) != 1) - fail("json_pack object failed"); - if(value->refcount != (ssize_t)2) - fail("json_pack integer refcount failed"); - json_decref(value); - json_decref(value); - - /* simple object */ - value = json_pack("{s:[]}", "foo"); - if(!json_is_object(value) || json_object_size(value) != 1) - fail("json_pack array failed"); - if(!json_is_array(json_object_get(value, "foo"))) - fail("json_pack array failed"); - if(json_object_get(value, "foo")->refcount != (ssize_t)1) - fail("json_pack object refcount failed"); - json_decref(value); - - /* simple array */ - value = json_pack("[i,i,i]", 0, 1, 2); - if(!json_is_array(value) || json_array_size(value) != 3) - fail("json_pack object failed"); - for(i=0; i<3; i++) - { - if(!json_is_integer(json_array_get(value, i)) || - json_integer_value(json_array_get(value, i)) != i) - - fail("json_pack integer array failed"); - } - json_decref(value); - - /* Whitespace; regular string */ - value = json_pack(" s ", "test"); - if(!json_is_string(value) || strcmp("test", json_string_value(value))) - fail("json_pack string (with whitespace) failed"); - json_decref(value); - - /* Whitespace; empty array */ - value = json_pack("[ ]"); - if(!json_is_array(value) || json_array_size(value) != 0) - fail("json_pack empty array (with whitespace) failed"); - json_decref(value); - - /* Whitespace; array */ - value = json_pack("[ i , i, i ] ", 1, 2, 3); - if(!json_is_array(value) || json_array_size(value) != 3) - fail("json_pack array (with whitespace) failed"); - json_decref(value); - - /* - * Invalid cases - */ - - /* newline in format string */ - if(json_pack_ex(&error, 0, "{\n\n1")) - fail("json_pack failed to catch invalid format '1'"); - check_error("Expected format 's', got '1'", "", 3, 1, 4); - - /* mismatched open/close array/object */ - if(json_pack_ex(&error, 0, "[}")) - fail("json_pack failed to catch mismatched '}'"); - check_error("Unexpected format character '}'", "", 1, 2, 2); - - if(json_pack_ex(&error, 0, "{]")) - fail("json_pack failed to catch mismatched ']'"); - check_error("Expected format 's', got ']'", "", 1, 2, 2); - - /* missing close array */ - if(json_pack_ex(&error, 0, "[")) - fail("json_pack failed to catch missing ']'"); - check_error("Unexpected end of format string", "", 1, 2, 2); - - /* missing close object */ - if(json_pack_ex(&error, 0, "{")) - fail("json_pack failed to catch missing '}'"); - check_error("Unexpected end of format string", "", 1, 2, 2); - - /* garbage after format string */ - if(json_pack_ex(&error, 0, "[i]a", 42)) - fail("json_pack failed to catch garbage after format string"); - check_error("Garbage after format string", "", 1, 4, 4); - - if(json_pack_ex(&error, 0, "ia", 42)) - fail("json_pack failed to catch garbage after format string"); - check_error("Garbage after format string", "", 1, 2, 2); - - /* NULL string */ - if(json_pack_ex(&error, 0, "s", NULL)) - fail("json_pack failed to catch null argument string"); - check_error("NULL string argument", "", 1, 1, 1); - - /* NULL format */ - if(json_pack_ex(&error, 0, NULL)) - fail("json_pack failed to catch NULL format string"); - check_error("NULL or empty format string", "", -1, -1, 0); - - /* NULL key */ - if(json_pack_ex(&error, 0, "{s:i}", NULL, 1)) - fail("json_pack failed to catch NULL key"); - check_error("NULL object key", "", 1, 2, 2); - - /* More complicated checks for row/columns */ - if(json_pack_ex(&error, 0, "{ {}: s }", "foo")) - fail("json_pack failed to catch object as key"); - check_error("Expected format 's', got '{'", "", 1, 3, 3); - - /* Complex object */ - if(json_pack_ex(&error, 0, "{ s: {}, s:[ii{} }", "foo", "bar", 12, 13)) - fail("json_pack failed to catch missing ]"); - check_error("Unexpected format character '}'", "", 1, 19, 19); - - /* Complex array */ - if(json_pack_ex(&error, 0, "[[[[[ [[[[[ [[[[ }]]]] ]]]] ]]]]]")) - fail("json_pack failed to catch extra }"); - check_error("Unexpected format character '}'", "", 1, 21, 21); - - /* Invalid UTF-8 in object key */ - if(json_pack_ex(&error, 0, "{s:i}", "\xff\xff", 42)) - fail("json_pack failed to catch invalid UTF-8 in an object key"); - check_error("Invalid UTF-8 in object key", "", 1, 2, 2); - - /* Invalid UTF-8 in a string */ - if(json_pack_ex(&error, 0, "{s:s}", "foo", "\xff\xff")) - fail("json_pack failed to catch invalid UTF-8 in a string"); - check_error("Invalid UTF-8 string", "", 1, 4, 4); - - return 0; -} diff --git a/lang/c/jansson/test/suites/api/test_simple.c b/lang/c/jansson/test/suites/api/test_simple.c deleted file mode 100644 index 8c713299658..00000000000 --- a/lang/c/jansson/test/suites/api/test_simple.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include -#include "util.h" - -/* Call the simple functions not covered by other tests of the public API */ -int main() -{ - json_t *value; - - value = json_integer(1); - if(json_typeof(value) != JSON_INTEGER) - fail("json_typeof failed"); - - if(json_is_object(value)) - fail("json_is_object failed"); - - if(json_is_array(value)) - fail("json_is_array failed"); - - if(json_is_string(value)) - fail("json_is_string failed"); - - if(!json_is_integer(value)) - fail("json_is_integer failed"); - - if(json_is_real(value)) - fail("json_is_real failed"); - - if(!json_is_number(value)) - fail("json_is_number failed"); - - if(json_is_true(value)) - fail("json_is_true failed"); - - if(json_is_false(value)) - fail("json_is_false failed"); - - if(json_is_boolean(value)) - fail("json_is_boolean failed"); - - if(json_is_null(value)) - fail("json_is_null failed"); - - json_decref(value); - - - value = json_string("foo"); - if(!value) - fail("json_string failed"); - if(strcmp(json_string_value(value), "foo")) - fail("invalid string value"); - - if(json_string_set(value, "bar")) - fail("json_string_set failed"); - if(strcmp(json_string_value(value), "bar")) - fail("invalid string value"); - - json_decref(value); - - value = json_string(NULL); - if(value) - fail("json_string(NULL) failed"); - - /* invalid UTF-8 */ - value = json_string("a\xefz"); - if(value) - fail("json_string() failed"); - - value = json_string_nocheck("foo"); - if(!value) - fail("json_string_nocheck failed"); - if(strcmp(json_string_value(value), "foo")) - fail("invalid string value"); - - if(json_string_set_nocheck(value, "bar")) - fail("json_string_set_nocheck failed"); - if(strcmp(json_string_value(value), "bar")) - fail("invalid string value"); - - json_decref(value); - - /* invalid UTF-8 */ - value = json_string_nocheck("qu\xff"); - if(!value) - fail("json_string_nocheck failed"); - if(strcmp(json_string_value(value), "qu\xff")) - fail("invalid string value"); - - if(json_string_set_nocheck(value, "\xfd\xfe\xff")) - fail("json_string_set_nocheck failed"); - if(strcmp(json_string_value(value), "\xfd\xfe\xff")) - fail("invalid string value"); - - json_decref(value); - - - value = json_integer(123); - if(!value) - fail("json_integer failed"); - if(json_integer_value(value) != 123) - fail("invalid integer value"); - if(json_number_value(value) != 123.0) - fail("invalid number value"); - - if(json_integer_set(value, 321)) - fail("json_integer_set failed"); - if(json_integer_value(value) != 321) - fail("invalid integer value"); - if(json_number_value(value) != 321.0) - fail("invalid number value"); - - json_decref(value); - - value = json_real(123.123); - if(!value) - fail("json_real failed"); - if(json_real_value(value) != 123.123) - fail("invalid integer value"); - if(json_number_value(value) != 123.123) - fail("invalid number value"); - - if(json_real_set(value, 321.321)) - fail("json_real_set failed"); - if(json_real_value(value) != 321.321) - fail("invalid real value"); - if(json_number_value(value) != 321.321) - fail("invalid number value"); - - json_decref(value); - - value = json_true(); - if(!value) - fail("json_true failed"); - json_decref(value); - - value = json_false(); - if(!value) - fail("json_false failed"); - json_decref(value); - - value = json_null(); - if(!value) - fail("json_null failed"); - json_decref(value); - - /* Test reference counting on singletons (true, false, null) */ - value = json_true(); - if(value->refcount != (size_t)-1) - fail("refcounting true works incorrectly"); - json_decref(value); - if(value->refcount != (size_t)-1) - fail("refcounting true works incorrectly"); - json_incref(value); - if(value->refcount != (size_t)-1) - fail("refcounting true works incorrectly"); - - value = json_false(); - if(value->refcount != (size_t)-1) - fail("refcounting false works incorrectly"); - json_decref(value); - if(value->refcount != (size_t)-1) - fail("refcounting false works incorrectly"); - json_incref(value); - if(value->refcount != (size_t)-1) - fail("refcounting false works incorrectly"); - - value = json_null(); - if(value->refcount != (size_t)-1) - fail("refcounting null works incorrectly"); - json_decref(value); - if(value->refcount != (size_t)-1) - fail("refcounting null works incorrectly"); - json_incref(value); - if(value->refcount != (size_t)-1) - fail("refcounting null works incorrectly"); - - return 0; -} diff --git a/lang/c/jansson/test/suites/api/test_unpack.c b/lang/c/jansson/test/suites/api/test_unpack.c deleted file mode 100644 index 94261048717..00000000000 --- a/lang/c/jansson/test/suites/api/test_unpack.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * Copyright (c) 2010-2011 Graeme Smecher - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#include -#include -#include -#include "util.h" - -int main() -{ - json_t *j, *j2; - int i1, i2, i3; - json_int_t I1; - int rv; - double f; - char *s; - - json_error_t error; - - /* - * Simple, valid json_pack cases - */ - - /* true */ - rv = json_unpack(json_true(), "b", &i1); - if(rv || !i1) - fail("json_unpack boolean failed"); - - /* false */ - rv = json_unpack(json_false(), "b", &i1); - if(rv || i1) - fail("json_unpack boolean failed"); - - /* null */ - if(json_unpack(json_null(), "n")) - fail("json_unpack null failed"); - - /* integer */ - j = json_integer(42); - rv = json_unpack(j, "i", &i1); - if(rv || i1 != 42) - fail("json_unpack integer failed"); - json_decref(j); - - /* json_int_t */ - j = json_integer(5555555); - rv = json_unpack(j, "I", &I1); - if(rv || I1 != 5555555) - fail("json_unpack json_int_t failed"); - json_decref(j); - - /* real */ - j = json_real(1.7); - rv = json_unpack(j, "f", &f); - if(rv || f != 1.7) - fail("json_unpack real failed"); - json_decref(j); - - /* number */ - j = json_integer(12345); - rv = json_unpack(j, "F", &f); - if(rv || f != 12345.0) - fail("json_unpack (real or) integer failed"); - json_decref(j); - - j = json_real(1.7); - rv = json_unpack(j, "F", &f); - if(rv || f != 1.7) - fail("json_unpack real (or integer) failed"); - json_decref(j); - - /* string */ - j = json_string("foo"); - rv = json_unpack(j, "s", &s); - if(rv || strcmp(s, "foo")) - fail("json_unpack string failed"); - json_decref(j); - - /* empty object */ - j = json_object(); - if(json_unpack(j, "{}")) - fail("json_unpack empty object failed"); - json_decref(j); - - /* empty list */ - j = json_array(); - if(json_unpack(j, "[]")) - fail("json_unpack empty list failed"); - json_decref(j); - - /* non-incref'd object */ - j = json_object(); - rv = json_unpack(j, "o", &j2); - if(j2 != j || j->refcount != 1) - fail("json_unpack object failed"); - json_decref(j); - - /* incref'd object */ - j = json_object(); - rv = json_unpack(j, "O", &j2); - if(j2 != j || j->refcount != 2) - fail("json_unpack object failed"); - json_decref(j); - json_decref(j); - - /* simple object */ - j = json_pack("{s:i}", "foo", 42); - rv = json_unpack(j, "{s:i}", "foo", &i1); - if(rv || i1 != 42) - fail("json_unpack simple object failed"); - json_decref(j); - - /* simple array */ - j = json_pack("[iii]", 1, 2, 3); - rv = json_unpack(j, "[i,i,i]", &i1, &i2, &i3); - if(rv || i1 != 1 || i2 != 2 || i3 != 3) - fail("json_unpack simple array failed"); - json_decref(j); - - /* object with many items & strict checking */ - j = json_pack("{s:i, s:i, s:i}", "a", 1, "b", 2, "c", 3); - rv = json_unpack(j, "{s:i, s:i, s:i}", "a", &i1, "b", &i2, "c", &i3); - if(rv || i1 != 1 || i2 != 2 || i3 != 3) - fail("json_unpack object with many items failed"); - json_decref(j); - - /* - * Invalid cases - */ - - j = json_integer(42); - if(!json_unpack_ex(j, &error, 0, "z")) - fail("json_unpack succeeded with invalid format character"); - check_error("Unexpected format character 'z'", "", 1, 1, 1); - - if(!json_unpack_ex(NULL, &error, 0, "[i]")) - fail("json_unpack succeeded with NULL root"); - check_error("NULL root value", "", -1, -1, 0); - json_decref(j); - - /* mismatched open/close array/object */ - j = json_pack("[]"); - if(!json_unpack_ex(j, &error, 0, "[}")) - fail("json_unpack failed to catch mismatched ']'"); - check_error("Unexpected format character '}'", "", 1, 2, 2); - json_decref(j); - - j = json_pack("{}"); - if(!json_unpack_ex(j, &error, 0, "{]")) - fail("json_unpack failed to catch mismatched '}'"); - check_error("Expected format 's', got ']'", "", 1, 2, 2); - json_decref(j); - - /* missing close array */ - j = json_pack("[]"); - if(!json_unpack_ex(j, &error, 0, "[")) - fail("json_unpack failed to catch missing ']'"); - check_error("Unexpected end of format string", "", 1, 2, 2); - json_decref(j); - - /* missing close object */ - j = json_pack("{}"); - if(!json_unpack_ex(j, &error, 0, "{")) - fail("json_unpack failed to catch missing '}'"); - check_error("Unexpected end of format string", "", 1, 2, 2); - json_decref(j); - - /* garbage after format string */ - j = json_pack("[i]", 42); - if(!json_unpack_ex(j, &error, 0, "[i]a", &i1)) - fail("json_unpack failed to catch garbage after format string"); - check_error("Garbage after format string", "", 1, 4, 4); - json_decref(j); - - j = json_integer(12345); - if(!json_unpack_ex(j, &error, 0, "ia", &i1)) - fail("json_unpack failed to catch garbage after format string"); - check_error("Garbage after format string", "", 1, 2, 2); - json_decref(j); - - /* NULL format string */ - j = json_pack("[]"); - if(!json_unpack_ex(j, &error, 0, NULL)) - fail("json_unpack failed to catch null format string"); - check_error("NULL or empty format string", "", -1, -1, 0); - json_decref(j); - - /* NULL string pointer */ - j = json_string("foobie"); - if(!json_unpack_ex(j, &error, 0, "s", NULL)) - fail("json_unpack failed to catch null string pointer"); - check_error("NULL string argument", "", 1, 1, 1); - json_decref(j); - - /* invalid types */ - j = json_integer(42); - j2 = json_string("foo"); - if(!json_unpack_ex(j, &error, 0, "s")) - fail("json_unpack failed to catch invalid type"); - check_error("Expected string, got integer", "", 1, 1, 1); - - if(!json_unpack_ex(j, &error, 0, "n")) - fail("json_unpack failed to catch invalid type"); - check_error("Expected null, got integer", "", 1, 1, 1); - - if(!json_unpack_ex(j, &error, 0, "b")) - fail("json_unpack failed to catch invalid type"); - check_error("Expected true or false, got integer", "", 1, 1, 1); - - if(!json_unpack_ex(j2, &error, 0, "i")) - fail("json_unpack failed to catch invalid type"); - check_error("Expected integer, got string", "", 1, 1, 1); - - if(!json_unpack_ex(j2, &error, 0, "I")) - fail("json_unpack failed to catch invalid type"); - check_error("Expected integer, got string", "", 1, 1, 1); - - if(!json_unpack_ex(j, &error, 0, "f")) - fail("json_unpack failed to catch invalid type"); - check_error("Expected real, got integer", "", 1, 1, 1); - - if(!json_unpack_ex(j2, &error, 0, "F")) - fail("json_unpack failed to catch invalid type"); - check_error("Expected real or integer, got string", "", 1, 1, 1); - - if(!json_unpack_ex(j, &error, 0, "[i]")) - fail("json_unpack failed to catch invalid type"); - check_error("Expected array, got integer", "", 1, 1, 1); - - if(!json_unpack_ex(j, &error, 0, "{si}", "foo")) - fail("json_unpack failed to catch invalid type"); - check_error("Expected object, got integer", "", 1, 1, 1); - - json_decref(j); - json_decref(j2); - - /* Array index out of range */ - j = json_pack("[i]", 1); - if(!json_unpack_ex(j, &error, 0, "[ii]", &i1, &i2)) - fail("json_unpack failed to catch index out of array bounds"); - check_error("Array index 1 out of range", "", 1, 3, 3); - json_decref(j); - - /* NULL object key */ - j = json_pack("{si}", "foo", 42); - if(!json_unpack_ex(j, &error, 0, "{si}", NULL, &i1)) - fail("json_unpack failed to catch null string pointer"); - check_error("NULL object key", "", 1, 2, 2); - json_decref(j); - - /* Object key not found */ - j = json_pack("{si}", "foo", 42); - if(!json_unpack_ex(j, &error, 0, "{si}", "baz", &i1)) - fail("json_unpack failed to catch null string pointer"); - check_error("Object item not found: baz", "", 1, 3, 3); - json_decref(j); - - /* - * Strict validation - */ - - j = json_pack("[iii]", 1, 2, 3); - rv = json_unpack(j, "[iii!]", &i1, &i2, &i3); - if(rv || i1 != 1 || i2 != 2 || i3 != 3) - fail("json_unpack array with strict validation failed"); - json_decref(j); - - j = json_pack("[iii]", 1, 2, 3); - if(!json_unpack_ex(j, &error, 0, "[ii!]", &i1, &i2)) - fail("json_unpack array with strict validation failed"); - check_error("1 array item(s) left unpacked", "", 1, 5, 5); - json_decref(j); - - /* Like above, but with JSON_STRICT instead of '!' format */ - j = json_pack("[iii]", 1, 2, 3); - if(!json_unpack_ex(j, &error, JSON_STRICT, "[ii]", &i1, &i2)) - fail("json_unpack array with strict validation failed"); - check_error("1 array item(s) left unpacked", "", 1, 4, 4); - json_decref(j); - - j = json_pack("{s:s, s:i}", "foo", "bar", "baz", 42); - rv = json_unpack(j, "{sssi!}", "foo", &s, "baz", &i1); - if(rv || strcmp(s, "bar") != 0 || i1 != 42) - fail("json_unpack object with strict validation failed"); - json_decref(j); - - /* Unpack the same item twice */ - j = json_pack("{s:s, s:i}", "foo", "bar", "baz", 42); - if(!json_unpack_ex(j, &error, 0, "{s:s,s:s!}", "foo", &s, "foo", &s)) - fail("json_unpack object with strict validation failed"); - check_error("1 object item(s) left unpacked", "", 1, 10, 10); - json_decref(j); - - j = json_pack("[i,{s:i,s:n},[i,i]]", 1, "foo", 2, "bar", 3, 4); - if(json_unpack_ex(j, NULL, JSON_STRICT | JSON_VALIDATE_ONLY, - "[i{sisn}[ii]]", "foo", "bar")) - fail("json_unpack complex value with strict validation failed"); - json_decref(j); - - /* ! and * must be last */ - j = json_pack("[ii]", 1, 2); - if(!json_unpack_ex(j, &error, 0, "[i!i]", &i1, &i2)) - fail("json_unpack failed to catch ! in the middle of an array"); - check_error("Expected ']' after '!', got 'i'", "", 1, 4, 4); - - if(!json_unpack_ex(j, &error, 0, "[i*i]", &i1, &i2)) - fail("json_unpack failed to catch * in the middle of an array"); - check_error("Expected ']' after '*', got 'i'", "", 1, 4, 4); - json_decref(j); - - j = json_pack("{sssi}", "foo", "bar", "baz", 42); - if(!json_unpack_ex(j, &error, 0, "{ss!si}", "foo", &s, "baz", &i1)) - fail("json_unpack failed to catch ! in the middle of an object"); - check_error("Expected '}' after '!', got 's'", "", 1, 5, 5); - - if(!json_unpack_ex(j, &error, 0, "{ss*si}", "foo", &s, "baz", &i1)) - fail("json_unpack failed to catch ! in the middle of an object"); - check_error("Expected '}' after '*', got 's'", "", 1, 5, 5); - json_decref(j); - - /* Error in nested object */ - j = json_pack("{s{snsn}}", "foo", "bar", "baz"); - if(!json_unpack_ex(j, &error, 0, "{s{sn!}}", "foo", "bar")) - fail("json_unpack nested object with strict validation failed"); - check_error("1 object item(s) left unpacked", "", 1, 7, 7); - json_decref(j); - - /* Error in nested array */ - j = json_pack("[[ii]]", 1, 2); - if(!json_unpack_ex(j, &error, 0, "[[i!]]", &i1)) - fail("json_unpack nested array with strict validation failed"); - check_error("1 array item(s) left unpacked", "", 1, 5, 5); - json_decref(j); - - return 0; -} diff --git a/lang/c/jansson/test/suites/api/util.h b/lang/c/jansson/test/suites/api/util.h deleted file mode 100644 index 83be721c3c1..00000000000 --- a/lang/c/jansson/test/suites/api/util.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2009-2011 Petri Lehtinen - * - * Jansson is free software; you can redistribute it and/or modify - * it under the terms of the MIT license. See LICENSE for details. - */ - -#ifndef UTIL_H -#define UTIL_H - -#include -#include -#include - -#define failhdr fprintf(stderr, "%s:%s:%d: ", __FILE__, __FUNCTION__, __LINE__) - -#define fail(msg) \ - do { \ - failhdr; \ - fprintf(stderr, "%s\n", msg); \ - exit(1); \ - } while(0) - -/* Assumes json_error_t error */ -#define check_error(text_, source_, line_, column_, position_) \ - do { \ - if(strcmp(error.text, text_) != 0) { \ - failhdr; \ - fprintf(stderr, "text: \"%s\" != \"%s\"\n", error.text, text_); \ - exit(1); \ - } \ - if(strcmp(error.source, source_) != 0) { \ - failhdr; \ - \ - fprintf(stderr, "source: \"%s\" != \"%s\"\n", error.source, source_); \ - exit(1); \ - } \ - if(error.line != line_) { \ - failhdr; \ - fprintf(stderr, "line: %d != %d\n", error.line, line_); \ - exit(1); \ - } \ - if(error.column != column_) { \ - failhdr; \ - fprintf(stderr, "column: %d != %d\n", error.column, column_); \ - exit(1); \ - } \ - if(error.position != position_) { \ - failhdr; \ - fprintf(stderr, "position: %d != %d\n", error.position, position_); \ - exit(1); \ - } \ - } while(0) - -#endif diff --git a/lang/c/jansson/test/suites/invalid-unicode/encoded-surrogate-half/error b/lang/c/jansson/test/suites/invalid-unicode/encoded-surrogate-half/error deleted file mode 100644 index 762d2c4b175..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/encoded-surrogate-half/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -unable to decode byte 0xed near '"' diff --git a/lang/c/jansson/test/suites/invalid-unicode/encoded-surrogate-half/input b/lang/c/jansson/test/suites/invalid-unicode/encoded-surrogate-half/input deleted file mode 100644 index 515dd933ce2..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/encoded-surrogate-half/input +++ /dev/null @@ -1 +0,0 @@ -[" <-- encoded surrogate half"] diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-after-backslash/error b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-after-backslash/error deleted file mode 100644 index b16dc171ee4..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-after-backslash/error +++ /dev/null @@ -1,2 +0,0 @@ -1 3 3 -unable to decode byte 0xe5 near '"\' diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-after-backslash/input b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-after-backslash/input deleted file mode 100644 index 57c8beef64e..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-after-backslash/input +++ /dev/null @@ -1 +0,0 @@ -["\"] diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-array/error b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-array/error deleted file mode 100644 index be15386df06..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-array/error +++ /dev/null @@ -1,2 +0,0 @@ -1 1 1 -unable to decode byte 0xe5 diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-array/input b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-array/input deleted file mode 100644 index ebefcd6f877..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-array/input +++ /dev/null @@ -1 +0,0 @@ -[] diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/error b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/error deleted file mode 100644 index 01b4476392f..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/error +++ /dev/null @@ -1,2 +0,0 @@ -1 4 4 -unable to decode byte 0xe5 near '123' diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/input b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/input deleted file mode 100644 index e512f9ae089..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-bigger-int/input +++ /dev/null @@ -1 +0,0 @@ -[123] diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-escape/error b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-escape/error deleted file mode 100644 index c13583dd85b..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-escape/error +++ /dev/null @@ -1,2 +0,0 @@ -1 4 4 -unable to decode byte 0xe5 near '"\u' diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-escape/input b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-escape/input deleted file mode 100644 index 2b271b82f3f..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-escape/input +++ /dev/null @@ -1 +0,0 @@ -["\u"] diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-exponent/error b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-exponent/error deleted file mode 100644 index c7b20b7a2a3..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-exponent/error +++ /dev/null @@ -1,2 +0,0 @@ -1 4 4 -unable to decode byte 0xe5 near '1e1' diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-exponent/input b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-exponent/input deleted file mode 100644 index d8e83c59543..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-exponent/input +++ /dev/null @@ -1 +0,0 @@ -[1e1] diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-identifier/error b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-identifier/error deleted file mode 100644 index 33dfc23242e..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-identifier/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -unable to decode byte 0xe5 near 'a' diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-identifier/input b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-identifier/input deleted file mode 100644 index ef038514a98..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-identifier/input +++ /dev/null @@ -1 +0,0 @@ -[a] diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-int/error b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-int/error deleted file mode 100644 index 8f08970c128..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-int/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -unable to decode byte 0xe5 near '0' diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-int/input b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-int/input deleted file mode 100644 index 371226e4cd9..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-int/input +++ /dev/null @@ -1 +0,0 @@ -[0] diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/error b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/error deleted file mode 100644 index b7660e327f2..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/error +++ /dev/null @@ -1,2 +0,0 @@ -1 3 3 -unable to decode byte 0xe5 near '1e' diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/input b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/input deleted file mode 100644 index 17fc29c90a3..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-real-after-e/input +++ /dev/null @@ -1 +0,0 @@ -[1e] diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-string/error b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-string/error deleted file mode 100644 index 0b7039a520a..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-string/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -unable to decode byte 0xe5 near '"' diff --git a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-string/input b/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-string/input deleted file mode 100644 index 00b79c0afae..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/invalid-utf-8-in-string/input +++ /dev/null @@ -1 +0,0 @@ -[" <-- invalid UTF-8"] diff --git a/lang/c/jansson/test/suites/invalid-unicode/lone-invalid-utf-8/error b/lang/c/jansson/test/suites/invalid-unicode/lone-invalid-utf-8/error deleted file mode 100644 index 8e9a5111928..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/lone-invalid-utf-8/error +++ /dev/null @@ -1,2 +0,0 @@ -1 0 0 -unable to decode byte 0xe5 diff --git a/lang/c/jansson/test/suites/invalid-unicode/lone-invalid-utf-8/input b/lang/c/jansson/test/suites/invalid-unicode/lone-invalid-utf-8/input deleted file mode 100644 index eb8079699b5..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/lone-invalid-utf-8/input +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lang/c/jansson/test/suites/invalid-unicode/lone-utf-8-continuation-byte/error b/lang/c/jansson/test/suites/invalid-unicode/lone-utf-8-continuation-byte/error deleted file mode 100644 index 86bbad3c80b..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/lone-utf-8-continuation-byte/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -unable to decode byte 0x81 near '"' diff --git a/lang/c/jansson/test/suites/invalid-unicode/lone-utf-8-continuation-byte/input b/lang/c/jansson/test/suites/invalid-unicode/lone-utf-8-continuation-byte/input deleted file mode 100644 index 62a26b6fb88..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/lone-utf-8-continuation-byte/input +++ /dev/null @@ -1 +0,0 @@ -[""] diff --git a/lang/c/jansson/test/suites/invalid-unicode/not-in-unicode-range/error b/lang/c/jansson/test/suites/invalid-unicode/not-in-unicode-range/error deleted file mode 100644 index d07ccb3e5e7..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/not-in-unicode-range/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -unable to decode byte 0xf4 near '"' diff --git a/lang/c/jansson/test/suites/invalid-unicode/not-in-unicode-range/input b/lang/c/jansson/test/suites/invalid-unicode/not-in-unicode-range/input deleted file mode 100644 index 1216186a782..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/not-in-unicode-range/input +++ /dev/null @@ -1 +0,0 @@ -[""] diff --git a/lang/c/jansson/test/suites/invalid-unicode/overlong-3-byte-encoding/error b/lang/c/jansson/test/suites/invalid-unicode/overlong-3-byte-encoding/error deleted file mode 100644 index 8a05abaed52..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/overlong-3-byte-encoding/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -unable to decode byte 0xe0 near '"' diff --git a/lang/c/jansson/test/suites/invalid-unicode/overlong-3-byte-encoding/input b/lang/c/jansson/test/suites/invalid-unicode/overlong-3-byte-encoding/input deleted file mode 100644 index 0bf909f7be5..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/overlong-3-byte-encoding/input +++ /dev/null @@ -1 +0,0 @@ -[" <-- overlong encoding"] diff --git a/lang/c/jansson/test/suites/invalid-unicode/overlong-4-byte-encoding/error b/lang/c/jansson/test/suites/invalid-unicode/overlong-4-byte-encoding/error deleted file mode 100644 index 7e19c5fe48a..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/overlong-4-byte-encoding/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -unable to decode byte 0xf0 near '"' diff --git a/lang/c/jansson/test/suites/invalid-unicode/overlong-4-byte-encoding/input b/lang/c/jansson/test/suites/invalid-unicode/overlong-4-byte-encoding/input deleted file mode 100644 index c6b6313509d..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/overlong-4-byte-encoding/input +++ /dev/null @@ -1 +0,0 @@ -[" <-- overlong encoding"] diff --git a/lang/c/jansson/test/suites/invalid-unicode/overlong-ascii-encoding/error b/lang/c/jansson/test/suites/invalid-unicode/overlong-ascii-encoding/error deleted file mode 100644 index 1d382edd7aa..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/overlong-ascii-encoding/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -unable to decode byte 0xc1 near '"' diff --git a/lang/c/jansson/test/suites/invalid-unicode/overlong-ascii-encoding/input b/lang/c/jansson/test/suites/invalid-unicode/overlong-ascii-encoding/input deleted file mode 100644 index ef6e10a3429..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/overlong-ascii-encoding/input +++ /dev/null @@ -1 +0,0 @@ -[""] diff --git a/lang/c/jansson/test/suites/invalid-unicode/restricted-utf-8/error b/lang/c/jansson/test/suites/invalid-unicode/restricted-utf-8/error deleted file mode 100644 index d018f5ff3d2..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/restricted-utf-8/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -unable to decode byte 0xfd near '"' diff --git a/lang/c/jansson/test/suites/invalid-unicode/restricted-utf-8/input b/lang/c/jansson/test/suites/invalid-unicode/restricted-utf-8/input deleted file mode 100644 index ba6017002c9..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/restricted-utf-8/input +++ /dev/null @@ -1 +0,0 @@ -[""] diff --git a/lang/c/jansson/test/suites/invalid-unicode/run b/lang/c/jansson/test/suites/invalid-unicode/run deleted file mode 100755 index 7cb3243af49..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/run +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2009-2011 Petri Lehtinen -# -# Jansson is free software; you can redistribute it and/or modify -# it under the terms of the MIT license. See LICENSE for details. - -is_test() { - test -d $test_path -} - -run_test() { - $json_process <$test_path/input >$test_log/stdout 2>$test_log/stderr - valgrind_check $test_log/stderr || return 1 - cmp -s $test_path/error $test_log/stderr -} - -show_error() { - valgrind_show_error && return - - echo "EXPECTED ERROR:" - nl -bn $test_path/error - echo "ACTUAL ERROR:" - nl -bn $test_log/stderr -} - -. $top_srcdir/test/scripts/run-tests.sh diff --git a/lang/c/jansson/test/suites/invalid-unicode/truncated-utf-8/error b/lang/c/jansson/test/suites/invalid-unicode/truncated-utf-8/error deleted file mode 100644 index 8a05abaed52..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/truncated-utf-8/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -unable to decode byte 0xe0 near '"' diff --git a/lang/c/jansson/test/suites/invalid-unicode/truncated-utf-8/input b/lang/c/jansson/test/suites/invalid-unicode/truncated-utf-8/input deleted file mode 100644 index bce9e18bf9e..00000000000 --- a/lang/c/jansson/test/suites/invalid-unicode/truncated-utf-8/input +++ /dev/null @@ -1 +0,0 @@ -[" <-- truncated UTF-8"] diff --git a/lang/c/jansson/test/suites/invalid/apostrophe/error b/lang/c/jansson/test/suites/invalid/apostrophe/error deleted file mode 100644 index 79bb2a0eb43..00000000000 --- a/lang/c/jansson/test/suites/invalid/apostrophe/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -invalid token near ''' diff --git a/lang/c/jansson/test/suites/invalid/apostrophe/input b/lang/c/jansson/test/suites/invalid/apostrophe/input deleted file mode 100644 index f2dd4d224d9..00000000000 --- a/lang/c/jansson/test/suites/invalid/apostrophe/input +++ /dev/null @@ -1 +0,0 @@ -[' diff --git a/lang/c/jansson/test/suites/invalid/ascii-unicode-identifier/error b/lang/c/jansson/test/suites/invalid/ascii-unicode-identifier/error deleted file mode 100644 index a4d81428053..00000000000 --- a/lang/c/jansson/test/suites/invalid/ascii-unicode-identifier/error +++ /dev/null @@ -1,2 +0,0 @@ -1 1 1 -'[' or '{' expected near 'a' diff --git a/lang/c/jansson/test/suites/invalid/ascii-unicode-identifier/input b/lang/c/jansson/test/suites/invalid/ascii-unicode-identifier/input deleted file mode 100644 index c2c0208eda8..00000000000 --- a/lang/c/jansson/test/suites/invalid/ascii-unicode-identifier/input +++ /dev/null @@ -1 +0,0 @@ -aå diff --git a/lang/c/jansson/test/suites/invalid/brace-comma/error b/lang/c/jansson/test/suites/invalid/brace-comma/error deleted file mode 100644 index ce046213cf4..00000000000 --- a/lang/c/jansson/test/suites/invalid/brace-comma/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -string or '}' expected near ',' diff --git a/lang/c/jansson/test/suites/invalid/brace-comma/input b/lang/c/jansson/test/suites/invalid/brace-comma/input deleted file mode 100644 index 74a6628d448..00000000000 --- a/lang/c/jansson/test/suites/invalid/brace-comma/input +++ /dev/null @@ -1 +0,0 @@ -{, diff --git a/lang/c/jansson/test/suites/invalid/bracket-comma/error b/lang/c/jansson/test/suites/invalid/bracket-comma/error deleted file mode 100644 index ce0a912bf2c..00000000000 --- a/lang/c/jansson/test/suites/invalid/bracket-comma/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -unexpected token near ',' diff --git a/lang/c/jansson/test/suites/invalid/bracket-comma/input b/lang/c/jansson/test/suites/invalid/bracket-comma/input deleted file mode 100644 index 5b911f11dc3..00000000000 --- a/lang/c/jansson/test/suites/invalid/bracket-comma/input +++ /dev/null @@ -1 +0,0 @@ -[, diff --git a/lang/c/jansson/test/suites/invalid/bracket-one-comma/error.normal b/lang/c/jansson/test/suites/invalid/bracket-one-comma/error.normal deleted file mode 100644 index 0248b114aa8..00000000000 --- a/lang/c/jansson/test/suites/invalid/bracket-one-comma/error.normal +++ /dev/null @@ -1,2 +0,0 @@ -2 0 4 -']' expected near end of file diff --git a/lang/c/jansson/test/suites/invalid/bracket-one-comma/error.strip b/lang/c/jansson/test/suites/invalid/bracket-one-comma/error.strip deleted file mode 100644 index f89b38fcbfb..00000000000 --- a/lang/c/jansson/test/suites/invalid/bracket-one-comma/error.strip +++ /dev/null @@ -1,2 +0,0 @@ -1 3 3 -']' expected near end of file diff --git a/lang/c/jansson/test/suites/invalid/bracket-one-comma/input b/lang/c/jansson/test/suites/invalid/bracket-one-comma/input deleted file mode 100644 index 874691b1ded..00000000000 --- a/lang/c/jansson/test/suites/invalid/bracket-one-comma/input +++ /dev/null @@ -1 +0,0 @@ -[1, diff --git a/lang/c/jansson/test/suites/invalid/empty/error b/lang/c/jansson/test/suites/invalid/empty/error deleted file mode 100644 index f45da6f8209..00000000000 --- a/lang/c/jansson/test/suites/invalid/empty/error +++ /dev/null @@ -1,2 +0,0 @@ -1 0 0 -'[' or '{' expected near end of file diff --git a/lang/c/jansson/test/suites/invalid/empty/input b/lang/c/jansson/test/suites/invalid/empty/input deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/lang/c/jansson/test/suites/invalid/escaped-null-byte-in-string/error b/lang/c/jansson/test/suites/invalid/escaped-null-byte-in-string/error deleted file mode 100644 index 9795f188541..00000000000 --- a/lang/c/jansson/test/suites/invalid/escaped-null-byte-in-string/error +++ /dev/null @@ -1,2 +0,0 @@ -1 33 33 -\u0000 is not allowed diff --git a/lang/c/jansson/test/suites/invalid/escaped-null-byte-in-string/input b/lang/c/jansson/test/suites/invalid/escaped-null-byte-in-string/input deleted file mode 100644 index 22ae82b2a56..00000000000 --- a/lang/c/jansson/test/suites/invalid/escaped-null-byte-in-string/input +++ /dev/null @@ -1 +0,0 @@ -["\u0000 (null byte not allowed)"] diff --git a/lang/c/jansson/test/suites/invalid/extra-comma-in-array/error b/lang/c/jansson/test/suites/invalid/extra-comma-in-array/error deleted file mode 100644 index cae86c2460e..00000000000 --- a/lang/c/jansson/test/suites/invalid/extra-comma-in-array/error +++ /dev/null @@ -1,2 +0,0 @@ -1 4 4 -unexpected token near ']' diff --git a/lang/c/jansson/test/suites/invalid/extra-comma-in-array/input b/lang/c/jansson/test/suites/invalid/extra-comma-in-array/input deleted file mode 100644 index e8b1a170fd0..00000000000 --- a/lang/c/jansson/test/suites/invalid/extra-comma-in-array/input +++ /dev/null @@ -1 +0,0 @@ -[1,] diff --git a/lang/c/jansson/test/suites/invalid/extra-comma-in-multiline-array/error b/lang/c/jansson/test/suites/invalid/extra-comma-in-multiline-array/error deleted file mode 100644 index 5baeea4472c..00000000000 --- a/lang/c/jansson/test/suites/invalid/extra-comma-in-multiline-array/error +++ /dev/null @@ -1,2 +0,0 @@ -6 1 17 -unexpected token near ']' diff --git a/lang/c/jansson/test/suites/invalid/extra-comma-in-multiline-array/input b/lang/c/jansson/test/suites/invalid/extra-comma-in-multiline-array/input deleted file mode 100644 index bcb2a752602..00000000000 --- a/lang/c/jansson/test/suites/invalid/extra-comma-in-multiline-array/input +++ /dev/null @@ -1,6 +0,0 @@ -[1, -2, -3, -4, -5, -] diff --git a/lang/c/jansson/test/suites/invalid/garbage-after-newline/error b/lang/c/jansson/test/suites/invalid/garbage-after-newline/error deleted file mode 100644 index 5d2dec37490..00000000000 --- a/lang/c/jansson/test/suites/invalid/garbage-after-newline/error +++ /dev/null @@ -1,2 +0,0 @@ -2 3 11 -end of file expected near 'foo' diff --git a/lang/c/jansson/test/suites/invalid/garbage-after-newline/input b/lang/c/jansson/test/suites/invalid/garbage-after-newline/input deleted file mode 100644 index 3614ac78fef..00000000000 --- a/lang/c/jansson/test/suites/invalid/garbage-after-newline/input +++ /dev/null @@ -1,2 +0,0 @@ -[1,2,3] -foo diff --git a/lang/c/jansson/test/suites/invalid/garbage-at-the-end/error b/lang/c/jansson/test/suites/invalid/garbage-at-the-end/error deleted file mode 100644 index cdd81757283..00000000000 --- a/lang/c/jansson/test/suites/invalid/garbage-at-the-end/error +++ /dev/null @@ -1,2 +0,0 @@ -1 10 10 -end of file expected near 'foo' diff --git a/lang/c/jansson/test/suites/invalid/garbage-at-the-end/input b/lang/c/jansson/test/suites/invalid/garbage-at-the-end/input deleted file mode 100644 index 55aee53d225..00000000000 --- a/lang/c/jansson/test/suites/invalid/garbage-at-the-end/input +++ /dev/null @@ -1 +0,0 @@ -[1,2,3]foo diff --git a/lang/c/jansson/test/suites/invalid/integer-starting-with-zero/error b/lang/c/jansson/test/suites/invalid/integer-starting-with-zero/error deleted file mode 100644 index 64e0536aa6b..00000000000 --- a/lang/c/jansson/test/suites/invalid/integer-starting-with-zero/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -invalid token near '0' diff --git a/lang/c/jansson/test/suites/invalid/integer-starting-with-zero/input b/lang/c/jansson/test/suites/invalid/integer-starting-with-zero/input deleted file mode 100644 index 12f67e2c26f..00000000000 --- a/lang/c/jansson/test/suites/invalid/integer-starting-with-zero/input +++ /dev/null @@ -1 +0,0 @@ -[012] diff --git a/lang/c/jansson/test/suites/invalid/invalid-escape/error b/lang/c/jansson/test/suites/invalid/invalid-escape/error deleted file mode 100644 index d9863f73b32..00000000000 --- a/lang/c/jansson/test/suites/invalid/invalid-escape/error +++ /dev/null @@ -1,2 +0,0 @@ -1 4 4 -invalid escape near '"\a' diff --git a/lang/c/jansson/test/suites/invalid/invalid-escape/input b/lang/c/jansson/test/suites/invalid/invalid-escape/input deleted file mode 100644 index 64c7b70d987..00000000000 --- a/lang/c/jansson/test/suites/invalid/invalid-escape/input +++ /dev/null @@ -1 +0,0 @@ -["\a <-- invalid escape"] diff --git a/lang/c/jansson/test/suites/invalid/invalid-identifier/error b/lang/c/jansson/test/suites/invalid/invalid-identifier/error deleted file mode 100644 index 496c6aba253..00000000000 --- a/lang/c/jansson/test/suites/invalid/invalid-identifier/error +++ /dev/null @@ -1,2 +0,0 @@ -1 5 5 -invalid token near 'troo' diff --git a/lang/c/jansson/test/suites/invalid/invalid-identifier/input b/lang/c/jansson/test/suites/invalid/invalid-identifier/input deleted file mode 100644 index 3d2860da187..00000000000 --- a/lang/c/jansson/test/suites/invalid/invalid-identifier/input +++ /dev/null @@ -1 +0,0 @@ -[troo diff --git a/lang/c/jansson/test/suites/invalid/invalid-negative-integer/error b/lang/c/jansson/test/suites/invalid/invalid-negative-integer/error deleted file mode 100644 index f2526c51e78..00000000000 --- a/lang/c/jansson/test/suites/invalid/invalid-negative-integer/error +++ /dev/null @@ -1,2 +0,0 @@ -1 8 8 -']' expected near 'foo' diff --git a/lang/c/jansson/test/suites/invalid/invalid-negative-integer/input b/lang/c/jansson/test/suites/invalid/invalid-negative-integer/input deleted file mode 100644 index 6196980ecca..00000000000 --- a/lang/c/jansson/test/suites/invalid/invalid-negative-integer/input +++ /dev/null @@ -1 +0,0 @@ -[-123foo] diff --git a/lang/c/jansson/test/suites/invalid/invalid-negative-real/error b/lang/c/jansson/test/suites/invalid/invalid-negative-real/error deleted file mode 100644 index 933158ae5af..00000000000 --- a/lang/c/jansson/test/suites/invalid/invalid-negative-real/error +++ /dev/null @@ -1,2 +0,0 @@ -1 12 12 -']' expected near 'foo' diff --git a/lang/c/jansson/test/suites/invalid/invalid-negative-real/input b/lang/c/jansson/test/suites/invalid/invalid-negative-real/input deleted file mode 100644 index 3c763d334e2..00000000000 --- a/lang/c/jansson/test/suites/invalid/invalid-negative-real/input +++ /dev/null @@ -1 +0,0 @@ -[-123.123foo] diff --git a/lang/c/jansson/test/suites/invalid/invalid-second-surrogate/error b/lang/c/jansson/test/suites/invalid/invalid-second-surrogate/error deleted file mode 100644 index e5a2359e666..00000000000 --- a/lang/c/jansson/test/suites/invalid/invalid-second-surrogate/error +++ /dev/null @@ -1,2 +0,0 @@ -1 62 62 -invalid Unicode '\uD888\u3210' diff --git a/lang/c/jansson/test/suites/invalid/invalid-second-surrogate/input b/lang/c/jansson/test/suites/invalid/invalid-second-surrogate/input deleted file mode 100644 index b21453f6f2c..00000000000 --- a/lang/c/jansson/test/suites/invalid/invalid-second-surrogate/input +++ /dev/null @@ -1 +0,0 @@ -["\uD888\u3210 (first surrogate and invalid second surrogate)"] diff --git a/lang/c/jansson/test/suites/invalid/lone-open-brace/error.normal b/lang/c/jansson/test/suites/invalid/lone-open-brace/error.normal deleted file mode 100644 index 00dc765b9ce..00000000000 --- a/lang/c/jansson/test/suites/invalid/lone-open-brace/error.normal +++ /dev/null @@ -1,2 +0,0 @@ -2 0 2 -string or '}' expected near end of file diff --git a/lang/c/jansson/test/suites/invalid/lone-open-brace/error.strip b/lang/c/jansson/test/suites/invalid/lone-open-brace/error.strip deleted file mode 100644 index bb1c0474569..00000000000 --- a/lang/c/jansson/test/suites/invalid/lone-open-brace/error.strip +++ /dev/null @@ -1,2 +0,0 @@ -1 1 1 -string or '}' expected near end of file diff --git a/lang/c/jansson/test/suites/invalid/lone-open-brace/input b/lang/c/jansson/test/suites/invalid/lone-open-brace/input deleted file mode 100644 index 98232c64fce..00000000000 --- a/lang/c/jansson/test/suites/invalid/lone-open-brace/input +++ /dev/null @@ -1 +0,0 @@ -{ diff --git a/lang/c/jansson/test/suites/invalid/lone-open-bracket/error.normal b/lang/c/jansson/test/suites/invalid/lone-open-bracket/error.normal deleted file mode 100644 index f463928f8ac..00000000000 --- a/lang/c/jansson/test/suites/invalid/lone-open-bracket/error.normal +++ /dev/null @@ -1,2 +0,0 @@ -2 0 2 -']' expected near end of file diff --git a/lang/c/jansson/test/suites/invalid/lone-open-bracket/error.strip b/lang/c/jansson/test/suites/invalid/lone-open-bracket/error.strip deleted file mode 100644 index 2bc07ea0c5d..00000000000 --- a/lang/c/jansson/test/suites/invalid/lone-open-bracket/error.strip +++ /dev/null @@ -1,2 +0,0 @@ -1 1 1 -']' expected near end of file diff --git a/lang/c/jansson/test/suites/invalid/lone-open-bracket/input b/lang/c/jansson/test/suites/invalid/lone-open-bracket/input deleted file mode 100644 index 558ed37d93c..00000000000 --- a/lang/c/jansson/test/suites/invalid/lone-open-bracket/input +++ /dev/null @@ -1 +0,0 @@ -[ diff --git a/lang/c/jansson/test/suites/invalid/lone-second-surrogate/error b/lang/c/jansson/test/suites/invalid/lone-second-surrogate/error deleted file mode 100644 index bc5f34e11ac..00000000000 --- a/lang/c/jansson/test/suites/invalid/lone-second-surrogate/error +++ /dev/null @@ -1,2 +0,0 @@ -1 40 40 -invalid Unicode '\uDFAA' diff --git a/lang/c/jansson/test/suites/invalid/lone-second-surrogate/input b/lang/c/jansson/test/suites/invalid/lone-second-surrogate/input deleted file mode 100644 index 328e35c8260..00000000000 --- a/lang/c/jansson/test/suites/invalid/lone-second-surrogate/input +++ /dev/null @@ -1 +0,0 @@ -["\uDFAA (second surrogate on it's own)"] diff --git a/lang/c/jansson/test/suites/invalid/minus-sign-without-number/error b/lang/c/jansson/test/suites/invalid/minus-sign-without-number/error deleted file mode 100644 index b3a78b97817..00000000000 --- a/lang/c/jansson/test/suites/invalid/minus-sign-without-number/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -invalid token near '-' diff --git a/lang/c/jansson/test/suites/invalid/minus-sign-without-number/input b/lang/c/jansson/test/suites/invalid/minus-sign-without-number/input deleted file mode 100644 index 03378835575..00000000000 --- a/lang/c/jansson/test/suites/invalid/minus-sign-without-number/input +++ /dev/null @@ -1 +0,0 @@ -[-foo] diff --git a/lang/c/jansson/test/suites/invalid/negative-integer-starting-with-zero/error b/lang/c/jansson/test/suites/invalid/negative-integer-starting-with-zero/error deleted file mode 100644 index 36adc34b4c4..00000000000 --- a/lang/c/jansson/test/suites/invalid/negative-integer-starting-with-zero/error +++ /dev/null @@ -1,2 +0,0 @@ -1 3 3 -invalid token near '-0' diff --git a/lang/c/jansson/test/suites/invalid/negative-integer-starting-with-zero/input b/lang/c/jansson/test/suites/invalid/negative-integer-starting-with-zero/input deleted file mode 100644 index 6fbb7a2f826..00000000000 --- a/lang/c/jansson/test/suites/invalid/negative-integer-starting-with-zero/input +++ /dev/null @@ -1 +0,0 @@ -[-012] diff --git a/lang/c/jansson/test/suites/invalid/null-byte-in-string/error b/lang/c/jansson/test/suites/invalid/null-byte-in-string/error deleted file mode 100644 index 45f9bd81724..00000000000 --- a/lang/c/jansson/test/suites/invalid/null-byte-in-string/error +++ /dev/null @@ -1,2 +0,0 @@ -1 12 12 -control character 0x0 near '"null byte ' diff --git a/lang/c/jansson/test/suites/invalid/null-byte-in-string/input b/lang/c/jansson/test/suites/invalid/null-byte-in-string/input deleted file mode 100644 index 268d1f19435baef5ad7a609c65a951f6c8f6b30f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 28 jcma!6$}7#uQAnyRNmXD_$jdKLNX*H}FHcQTisb?Thx!RG diff --git a/lang/c/jansson/test/suites/invalid/null-byte-in-string/nostrip b/lang/c/jansson/test/suites/invalid/null-byte-in-string/nostrip deleted file mode 100644 index 80f4bf761f4..00000000000 --- a/lang/c/jansson/test/suites/invalid/null-byte-in-string/nostrip +++ /dev/null @@ -1,2 +0,0 @@ -The embedded NULL byte breaks json_loads(), which is used instead of -json_loadf() in the stripped tests. diff --git a/lang/c/jansson/test/suites/invalid/null-byte-outside-string/error b/lang/c/jansson/test/suites/invalid/null-byte-outside-string/error deleted file mode 100644 index 44d4def9245..00000000000 --- a/lang/c/jansson/test/suites/invalid/null-byte-outside-string/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -invalid token near end of file diff --git a/lang/c/jansson/test/suites/invalid/null-byte-outside-string/input b/lang/c/jansson/test/suites/invalid/null-byte-outside-string/input deleted file mode 100644 index aa550eb0cd16b047736975b6c92ebd989d1981b3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3 Kcma!M-~s>v9sp(l diff --git a/lang/c/jansson/test/suites/invalid/null-byte-outside-string/nostrip b/lang/c/jansson/test/suites/invalid/null-byte-outside-string/nostrip deleted file mode 100644 index 80f4bf761f4..00000000000 --- a/lang/c/jansson/test/suites/invalid/null-byte-outside-string/nostrip +++ /dev/null @@ -1,2 +0,0 @@ -The embedded NULL byte breaks json_loads(), which is used instead of -json_loadf() in the stripped tests. diff --git a/lang/c/jansson/test/suites/invalid/null/error b/lang/c/jansson/test/suites/invalid/null/error deleted file mode 100644 index 1f5d46490db..00000000000 --- a/lang/c/jansson/test/suites/invalid/null/error +++ /dev/null @@ -1,2 +0,0 @@ -1 4 4 -'[' or '{' expected near 'null' diff --git a/lang/c/jansson/test/suites/invalid/null/input b/lang/c/jansson/test/suites/invalid/null/input deleted file mode 100644 index 19765bd501b..00000000000 --- a/lang/c/jansson/test/suites/invalid/null/input +++ /dev/null @@ -1 +0,0 @@ -null diff --git a/lang/c/jansson/test/suites/invalid/object-apostrophes/error b/lang/c/jansson/test/suites/invalid/object-apostrophes/error deleted file mode 100644 index 23fab01f652..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-apostrophes/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -string or '}' expected near ''' diff --git a/lang/c/jansson/test/suites/invalid/object-apostrophes/input b/lang/c/jansson/test/suites/invalid/object-apostrophes/input deleted file mode 100644 index 52b290574b2..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-apostrophes/input +++ /dev/null @@ -1 +0,0 @@ -{'a' diff --git a/lang/c/jansson/test/suites/invalid/object-garbage-at-end/error b/lang/c/jansson/test/suites/invalid/object-garbage-at-end/error deleted file mode 100644 index 06c4ec1c22d..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-garbage-at-end/error +++ /dev/null @@ -1,2 +0,0 @@ -1 12 12 -'}' expected near '123' diff --git a/lang/c/jansson/test/suites/invalid/object-garbage-at-end/input b/lang/c/jansson/test/suites/invalid/object-garbage-at-end/input deleted file mode 100644 index 62c19d742b2..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-garbage-at-end/input +++ /dev/null @@ -1 +0,0 @@ -{"a":"a" 123} diff --git a/lang/c/jansson/test/suites/invalid/object-in-unterminated-array/error.normal b/lang/c/jansson/test/suites/invalid/object-in-unterminated-array/error.normal deleted file mode 100644 index 0248b114aa8..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-in-unterminated-array/error.normal +++ /dev/null @@ -1,2 +0,0 @@ -2 0 4 -']' expected near end of file diff --git a/lang/c/jansson/test/suites/invalid/object-in-unterminated-array/error.strip b/lang/c/jansson/test/suites/invalid/object-in-unterminated-array/error.strip deleted file mode 100644 index f89b38fcbfb..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-in-unterminated-array/error.strip +++ /dev/null @@ -1,2 +0,0 @@ -1 3 3 -']' expected near end of file diff --git a/lang/c/jansson/test/suites/invalid/object-in-unterminated-array/input b/lang/c/jansson/test/suites/invalid/object-in-unterminated-array/input deleted file mode 100644 index ca9ec378e20..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-in-unterminated-array/input +++ /dev/null @@ -1 +0,0 @@ -[{} diff --git a/lang/c/jansson/test/suites/invalid/object-no-colon/error.normal b/lang/c/jansson/test/suites/invalid/object-no-colon/error.normal deleted file mode 100644 index 78d84f7b7d0..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-no-colon/error.normal +++ /dev/null @@ -1,2 +0,0 @@ -2 0 5 -':' expected near end of file diff --git a/lang/c/jansson/test/suites/invalid/object-no-colon/error.strip b/lang/c/jansson/test/suites/invalid/object-no-colon/error.strip deleted file mode 100644 index 528e266d279..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-no-colon/error.strip +++ /dev/null @@ -1,2 +0,0 @@ -1 4 4 -':' expected near end of file diff --git a/lang/c/jansson/test/suites/invalid/object-no-colon/input b/lang/c/jansson/test/suites/invalid/object-no-colon/input deleted file mode 100644 index 107e6265c64..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-no-colon/input +++ /dev/null @@ -1 +0,0 @@ -{"a" diff --git a/lang/c/jansson/test/suites/invalid/object-no-value/error.normal b/lang/c/jansson/test/suites/invalid/object-no-value/error.normal deleted file mode 100644 index 47ad902ddbd..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-no-value/error.normal +++ /dev/null @@ -1,2 +0,0 @@ -2 0 6 -unexpected token near end of file diff --git a/lang/c/jansson/test/suites/invalid/object-no-value/error.strip b/lang/c/jansson/test/suites/invalid/object-no-value/error.strip deleted file mode 100644 index b36c5e2bc64..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-no-value/error.strip +++ /dev/null @@ -1,2 +0,0 @@ -1 5 5 -unexpected token near end of file diff --git a/lang/c/jansson/test/suites/invalid/object-no-value/input b/lang/c/jansson/test/suites/invalid/object-no-value/input deleted file mode 100644 index f68f2626960..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-no-value/input +++ /dev/null @@ -1 +0,0 @@ -{"a": diff --git a/lang/c/jansson/test/suites/invalid/object-unterminated-value/error.normal b/lang/c/jansson/test/suites/invalid/object-unterminated-value/error.normal deleted file mode 100644 index 2ad76d47368..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-unterminated-value/error.normal +++ /dev/null @@ -1,2 +0,0 @@ -1 7 7 -unexpected newline near '"a' diff --git a/lang/c/jansson/test/suites/invalid/object-unterminated-value/error.strip b/lang/c/jansson/test/suites/invalid/object-unterminated-value/error.strip deleted file mode 100644 index 385afb534c6..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-unterminated-value/error.strip +++ /dev/null @@ -1,2 +0,0 @@ -1 7 7 -premature end of input near '"a' diff --git a/lang/c/jansson/test/suites/invalid/object-unterminated-value/input b/lang/c/jansson/test/suites/invalid/object-unterminated-value/input deleted file mode 100644 index b854d7e1848..00000000000 --- a/lang/c/jansson/test/suites/invalid/object-unterminated-value/input +++ /dev/null @@ -1 +0,0 @@ -{"a":"a diff --git a/lang/c/jansson/test/suites/invalid/real-garbage-after-e/error b/lang/c/jansson/test/suites/invalid/real-garbage-after-e/error deleted file mode 100644 index b40ffa9b587..00000000000 --- a/lang/c/jansson/test/suites/invalid/real-garbage-after-e/error +++ /dev/null @@ -1,2 +0,0 @@ -1 3 3 -invalid token near '1e' diff --git a/lang/c/jansson/test/suites/invalid/real-garbage-after-e/input b/lang/c/jansson/test/suites/invalid/real-garbage-after-e/input deleted file mode 100644 index 6a945ac0f3c..00000000000 --- a/lang/c/jansson/test/suites/invalid/real-garbage-after-e/input +++ /dev/null @@ -1 +0,0 @@ -[1ea] diff --git a/lang/c/jansson/test/suites/invalid/real-negative-overflow/error b/lang/c/jansson/test/suites/invalid/real-negative-overflow/error deleted file mode 100644 index d7f8e412d45..00000000000 --- a/lang/c/jansson/test/suites/invalid/real-negative-overflow/error +++ /dev/null @@ -1,2 +0,0 @@ -1 15 15 -real number overflow near '-123123e100000' diff --git a/lang/c/jansson/test/suites/invalid/real-negative-overflow/input b/lang/c/jansson/test/suites/invalid/real-negative-overflow/input deleted file mode 100644 index b5bd21c4669..00000000000 --- a/lang/c/jansson/test/suites/invalid/real-negative-overflow/input +++ /dev/null @@ -1 +0,0 @@ -[-123123e100000] diff --git a/lang/c/jansson/test/suites/invalid/real-positive-overflow/error b/lang/c/jansson/test/suites/invalid/real-positive-overflow/error deleted file mode 100644 index 55883c981e2..00000000000 --- a/lang/c/jansson/test/suites/invalid/real-positive-overflow/error +++ /dev/null @@ -1,2 +0,0 @@ -1 14 14 -real number overflow near '123123e100000' diff --git a/lang/c/jansson/test/suites/invalid/real-positive-overflow/input b/lang/c/jansson/test/suites/invalid/real-positive-overflow/input deleted file mode 100644 index 524e53b316a..00000000000 --- a/lang/c/jansson/test/suites/invalid/real-positive-overflow/input +++ /dev/null @@ -1 +0,0 @@ -[123123e100000] diff --git a/lang/c/jansson/test/suites/invalid/real-truncated-at-e/error b/lang/c/jansson/test/suites/invalid/real-truncated-at-e/error deleted file mode 100644 index b40ffa9b587..00000000000 --- a/lang/c/jansson/test/suites/invalid/real-truncated-at-e/error +++ /dev/null @@ -1,2 +0,0 @@ -1 3 3 -invalid token near '1e' diff --git a/lang/c/jansson/test/suites/invalid/real-truncated-at-e/input b/lang/c/jansson/test/suites/invalid/real-truncated-at-e/input deleted file mode 100644 index 1d67b7b822c..00000000000 --- a/lang/c/jansson/test/suites/invalid/real-truncated-at-e/input +++ /dev/null @@ -1 +0,0 @@ -[1e] diff --git a/lang/c/jansson/test/suites/invalid/real-truncated-at-point/error b/lang/c/jansson/test/suites/invalid/real-truncated-at-point/error deleted file mode 100644 index db972e8e16b..00000000000 --- a/lang/c/jansson/test/suites/invalid/real-truncated-at-point/error +++ /dev/null @@ -1,2 +0,0 @@ -1 3 3 -invalid token near '1.' diff --git a/lang/c/jansson/test/suites/invalid/real-truncated-at-point/input b/lang/c/jansson/test/suites/invalid/real-truncated-at-point/input deleted file mode 100644 index b652b3fe026..00000000000 --- a/lang/c/jansson/test/suites/invalid/real-truncated-at-point/input +++ /dev/null @@ -1 +0,0 @@ -[1.] diff --git a/lang/c/jansson/test/suites/invalid/run b/lang/c/jansson/test/suites/invalid/run deleted file mode 100755 index f8394d7f1ca..00000000000 --- a/lang/c/jansson/test/suites/invalid/run +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2009-2011 Petri Lehtinen -# -# Jansson is free software; you can redistribute it and/or modify -# it under the terms of the MIT license. See LICENSE for details. - -is_test() { - test -d $test_path -} - -do_run() { - variant=$1 - s=".$1" - - strip=0 - if [ "$variant" = "strip" ]; then - # This test should not be stripped - [ -f $test_path/nostrip ] && return - strip=1 - fi - - STRIP=$strip $json_process \ - <$test_path/input >$test_log/stdout$s 2>$test_log/stderr$s - valgrind_check $test_log/stderr$s || return 1 - - ref=error - [ -f $test_path/error$s ] && ref=error$s - - if ! cmp -s $test_path/$ref $test_log/stderr$s; then - echo $variant > $test_log/variant - return 1 - fi -} - -run_test() { - do_run normal && do_run strip -} - -show_error() { - valgrind_show_error && return - - read variant < $test_log/variant - s=".$variant" - - echo "VARIANT: $variant" - - echo "EXPECTED ERROR:" - ref=error - [ -f $test_path/error$s ] && ref=error$s - nl -bn $test_path/$ref - - echo "ACTUAL ERROR:" - nl -bn $test_log/stderr$s -} - -. $top_srcdir/test/scripts/run-tests.sh diff --git a/lang/c/jansson/test/suites/invalid/tab-character-in-string/error b/lang/c/jansson/test/suites/invalid/tab-character-in-string/error deleted file mode 100644 index 9e2f76ed23c..00000000000 --- a/lang/c/jansson/test/suites/invalid/tab-character-in-string/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -control character 0x9 near '"' diff --git a/lang/c/jansson/test/suites/invalid/tab-character-in-string/input b/lang/c/jansson/test/suites/invalid/tab-character-in-string/input deleted file mode 100644 index 3ebae0953c1..00000000000 --- a/lang/c/jansson/test/suites/invalid/tab-character-in-string/input +++ /dev/null @@ -1 +0,0 @@ -[" <-- tab character"] diff --git a/lang/c/jansson/test/suites/invalid/too-big-negative-integer/error b/lang/c/jansson/test/suites/invalid/too-big-negative-integer/error deleted file mode 100644 index a0640b9a944..00000000000 --- a/lang/c/jansson/test/suites/invalid/too-big-negative-integer/error +++ /dev/null @@ -1,2 +0,0 @@ -1 32 32 -too big negative integer diff --git a/lang/c/jansson/test/suites/invalid/too-big-negative-integer/input b/lang/c/jansson/test/suites/invalid/too-big-negative-integer/input deleted file mode 100644 index d6c26f1cf38..00000000000 --- a/lang/c/jansson/test/suites/invalid/too-big-negative-integer/input +++ /dev/null @@ -1 +0,0 @@ -[-123123123123123123123123123123] diff --git a/lang/c/jansson/test/suites/invalid/too-big-positive-integer/error b/lang/c/jansson/test/suites/invalid/too-big-positive-integer/error deleted file mode 100644 index 3bdbefd5350..00000000000 --- a/lang/c/jansson/test/suites/invalid/too-big-positive-integer/error +++ /dev/null @@ -1,2 +0,0 @@ -1 31 31 -too big integer diff --git a/lang/c/jansson/test/suites/invalid/too-big-positive-integer/input b/lang/c/jansson/test/suites/invalid/too-big-positive-integer/input deleted file mode 100644 index 27c85539938..00000000000 --- a/lang/c/jansson/test/suites/invalid/too-big-positive-integer/input +++ /dev/null @@ -1 +0,0 @@ -[123123123123123123123123123123] diff --git a/lang/c/jansson/test/suites/invalid/truncated-unicode-surrogate/error b/lang/c/jansson/test/suites/invalid/truncated-unicode-surrogate/error deleted file mode 100644 index 1b99f061a2a..00000000000 --- a/lang/c/jansson/test/suites/invalid/truncated-unicode-surrogate/error +++ /dev/null @@ -1,2 +0,0 @@ -1 46 46 -invalid Unicode '\uDADA' diff --git a/lang/c/jansson/test/suites/invalid/truncated-unicode-surrogate/input b/lang/c/jansson/test/suites/invalid/truncated-unicode-surrogate/input deleted file mode 100644 index 2b340f4ad40..00000000000 --- a/lang/c/jansson/test/suites/invalid/truncated-unicode-surrogate/input +++ /dev/null @@ -1 +0,0 @@ -["\uDADA (first surrogate without the second)"] diff --git a/lang/c/jansson/test/suites/invalid/unicode-identifier/error b/lang/c/jansson/test/suites/invalid/unicode-identifier/error deleted file mode 100644 index 178b0dd4d82..00000000000 --- a/lang/c/jansson/test/suites/invalid/unicode-identifier/error +++ /dev/null @@ -1,2 +0,0 @@ -1 1 2 -'[' or '{' expected near 'å' diff --git a/lang/c/jansson/test/suites/invalid/unicode-identifier/input b/lang/c/jansson/test/suites/invalid/unicode-identifier/input deleted file mode 100644 index aad321caf77..00000000000 --- a/lang/c/jansson/test/suites/invalid/unicode-identifier/input +++ /dev/null @@ -1 +0,0 @@ -å diff --git a/lang/c/jansson/test/suites/invalid/unterminated-array-and-object/error.normal b/lang/c/jansson/test/suites/invalid/unterminated-array-and-object/error.normal deleted file mode 100644 index 5b19804bc5d..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-array-and-object/error.normal +++ /dev/null @@ -1,2 +0,0 @@ -2 0 3 -string or '}' expected near end of file diff --git a/lang/c/jansson/test/suites/invalid/unterminated-array-and-object/error.strip b/lang/c/jansson/test/suites/invalid/unterminated-array-and-object/error.strip deleted file mode 100644 index da2bb22f157..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-array-and-object/error.strip +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -string or '}' expected near end of file diff --git a/lang/c/jansson/test/suites/invalid/unterminated-array-and-object/input b/lang/c/jansson/test/suites/invalid/unterminated-array-and-object/input deleted file mode 100644 index cd9dc648237..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-array-and-object/input +++ /dev/null @@ -1 +0,0 @@ -[{ diff --git a/lang/c/jansson/test/suites/invalid/unterminated-array/error.normal b/lang/c/jansson/test/suites/invalid/unterminated-array/error.normal deleted file mode 100644 index 8025ed1b020..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-array/error.normal +++ /dev/null @@ -1,2 +0,0 @@ -2 0 5 -']' expected near end of file diff --git a/lang/c/jansson/test/suites/invalid/unterminated-array/error.strip b/lang/c/jansson/test/suites/invalid/unterminated-array/error.strip deleted file mode 100644 index 495d0f7c430..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-array/error.strip +++ /dev/null @@ -1,2 +0,0 @@ -1 4 4 -']' expected near end of file diff --git a/lang/c/jansson/test/suites/invalid/unterminated-array/input b/lang/c/jansson/test/suites/invalid/unterminated-array/input deleted file mode 100644 index 727ee810636..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-array/input +++ /dev/null @@ -1 +0,0 @@ -["a" diff --git a/lang/c/jansson/test/suites/invalid/unterminated-empty-key/error.normal b/lang/c/jansson/test/suites/invalid/unterminated-empty-key/error.normal deleted file mode 100644 index 3d646abda3f..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-empty-key/error.normal +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -unexpected newline near '"' diff --git a/lang/c/jansson/test/suites/invalid/unterminated-empty-key/error.strip b/lang/c/jansson/test/suites/invalid/unterminated-empty-key/error.strip deleted file mode 100644 index 94f19471552..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-empty-key/error.strip +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -premature end of input near '"' diff --git a/lang/c/jansson/test/suites/invalid/unterminated-empty-key/input b/lang/c/jansson/test/suites/invalid/unterminated-empty-key/input deleted file mode 100644 index 4117452de4e..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-empty-key/input +++ /dev/null @@ -1 +0,0 @@ -{" diff --git a/lang/c/jansson/test/suites/invalid/unterminated-key/error.normal b/lang/c/jansson/test/suites/invalid/unterminated-key/error.normal deleted file mode 100644 index 5f09b77da84..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-key/error.normal +++ /dev/null @@ -1,2 +0,0 @@ -1 3 3 -unexpected newline near '"a' diff --git a/lang/c/jansson/test/suites/invalid/unterminated-key/error.strip b/lang/c/jansson/test/suites/invalid/unterminated-key/error.strip deleted file mode 100644 index 8b6bec430d2..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-key/error.strip +++ /dev/null @@ -1,2 +0,0 @@ -1 3 3 -premature end of input near '"a' diff --git a/lang/c/jansson/test/suites/invalid/unterminated-key/input b/lang/c/jansson/test/suites/invalid/unterminated-key/input deleted file mode 100644 index 705948c64ed..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-key/input +++ /dev/null @@ -1 +0,0 @@ -{"a diff --git a/lang/c/jansson/test/suites/invalid/unterminated-object-and-array/error b/lang/c/jansson/test/suites/invalid/unterminated-object-and-array/error deleted file mode 100644 index ed97be73e36..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-object-and-array/error +++ /dev/null @@ -1,2 +0,0 @@ -1 2 2 -string or '}' expected near '[' diff --git a/lang/c/jansson/test/suites/invalid/unterminated-object-and-array/input b/lang/c/jansson/test/suites/invalid/unterminated-object-and-array/input deleted file mode 100644 index da35a862075..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-object-and-array/input +++ /dev/null @@ -1 +0,0 @@ -{[ diff --git a/lang/c/jansson/test/suites/invalid/unterminated-string/error.normal b/lang/c/jansson/test/suites/invalid/unterminated-string/error.normal deleted file mode 100644 index 5f09b77da84..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-string/error.normal +++ /dev/null @@ -1,2 +0,0 @@ -1 3 3 -unexpected newline near '"a' diff --git a/lang/c/jansson/test/suites/invalid/unterminated-string/error.strip b/lang/c/jansson/test/suites/invalid/unterminated-string/error.strip deleted file mode 100644 index 8b6bec430d2..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-string/error.strip +++ /dev/null @@ -1,2 +0,0 @@ -1 3 3 -premature end of input near '"a' diff --git a/lang/c/jansson/test/suites/invalid/unterminated-string/input b/lang/c/jansson/test/suites/invalid/unterminated-string/input deleted file mode 100644 index 38ab6b04caa..00000000000 --- a/lang/c/jansson/test/suites/invalid/unterminated-string/input +++ /dev/null @@ -1 +0,0 @@ -["a diff --git a/lang/c/jansson/test/suites/valid/complex-array/input b/lang/c/jansson/test/suites/valid/complex-array/input deleted file mode 100644 index 1b9bbb949f8..00000000000 --- a/lang/c/jansson/test/suites/valid/complex-array/input +++ /dev/null @@ -1,5 +0,0 @@ -[1,2,3,4, -"a", "b", "c", -{"foo": "bar", "core": "dump"}, -true, false, true, true, null, false -] diff --git a/lang/c/jansson/test/suites/valid/complex-array/output b/lang/c/jansson/test/suites/valid/complex-array/output deleted file mode 100644 index 7aefe5642ce..00000000000 --- a/lang/c/jansson/test/suites/valid/complex-array/output +++ /dev/null @@ -1 +0,0 @@ -[1, 2, 3, 4, "a", "b", "c", {"core": "dump", "foo": "bar"}, true, false, true, true, null, false] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/empty-array/input b/lang/c/jansson/test/suites/valid/empty-array/input deleted file mode 100644 index fe51488c706..00000000000 --- a/lang/c/jansson/test/suites/valid/empty-array/input +++ /dev/null @@ -1 +0,0 @@ -[] diff --git a/lang/c/jansson/test/suites/valid/empty-array/output b/lang/c/jansson/test/suites/valid/empty-array/output deleted file mode 100644 index 0637a088a01..00000000000 --- a/lang/c/jansson/test/suites/valid/empty-array/output +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/empty-object-in-array/input b/lang/c/jansson/test/suites/valid/empty-object-in-array/input deleted file mode 100644 index 93d51406d63..00000000000 --- a/lang/c/jansson/test/suites/valid/empty-object-in-array/input +++ /dev/null @@ -1 +0,0 @@ -[{}] diff --git a/lang/c/jansson/test/suites/valid/empty-object-in-array/output b/lang/c/jansson/test/suites/valid/empty-object-in-array/output deleted file mode 100644 index ee1aac42be5..00000000000 --- a/lang/c/jansson/test/suites/valid/empty-object-in-array/output +++ /dev/null @@ -1 +0,0 @@ -[{}] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/empty-object/input b/lang/c/jansson/test/suites/valid/empty-object/input deleted file mode 100644 index 0967ef424bc..00000000000 --- a/lang/c/jansson/test/suites/valid/empty-object/input +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/lang/c/jansson/test/suites/valid/empty-object/output b/lang/c/jansson/test/suites/valid/empty-object/output deleted file mode 100644 index 9e26dfeeb6e..00000000000 --- a/lang/c/jansson/test/suites/valid/empty-object/output +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/empty-string/input b/lang/c/jansson/test/suites/valid/empty-string/input deleted file mode 100644 index 66a1e185606..00000000000 --- a/lang/c/jansson/test/suites/valid/empty-string/input +++ /dev/null @@ -1 +0,0 @@ -[""] diff --git a/lang/c/jansson/test/suites/valid/empty-string/output b/lang/c/jansson/test/suites/valid/empty-string/output deleted file mode 100644 index 93b6be2bcca..00000000000 --- a/lang/c/jansson/test/suites/valid/empty-string/output +++ /dev/null @@ -1 +0,0 @@ -[""] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/escaped-utf-control-char/input b/lang/c/jansson/test/suites/valid/escaped-utf-control-char/input deleted file mode 100644 index 9a98545c006..00000000000 --- a/lang/c/jansson/test/suites/valid/escaped-utf-control-char/input +++ /dev/null @@ -1 +0,0 @@ -["\u0012 escaped control character"] diff --git a/lang/c/jansson/test/suites/valid/escaped-utf-control-char/output b/lang/c/jansson/test/suites/valid/escaped-utf-control-char/output deleted file mode 100644 index 07221b78d28..00000000000 --- a/lang/c/jansson/test/suites/valid/escaped-utf-control-char/output +++ /dev/null @@ -1 +0,0 @@ -["\u0012 escaped control character"] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/false/input b/lang/c/jansson/test/suites/valid/false/input deleted file mode 100644 index 43436520249..00000000000 --- a/lang/c/jansson/test/suites/valid/false/input +++ /dev/null @@ -1 +0,0 @@ -[false] diff --git a/lang/c/jansson/test/suites/valid/false/output b/lang/c/jansson/test/suites/valid/false/output deleted file mode 100644 index 67b2f07601e..00000000000 --- a/lang/c/jansson/test/suites/valid/false/output +++ /dev/null @@ -1 +0,0 @@ -[false] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/negative-int/input b/lang/c/jansson/test/suites/valid/negative-int/input deleted file mode 100644 index a96d5cdb317..00000000000 --- a/lang/c/jansson/test/suites/valid/negative-int/input +++ /dev/null @@ -1 +0,0 @@ -[-123] diff --git a/lang/c/jansson/test/suites/valid/negative-int/output b/lang/c/jansson/test/suites/valid/negative-int/output deleted file mode 100644 index 8e30f8bd966..00000000000 --- a/lang/c/jansson/test/suites/valid/negative-int/output +++ /dev/null @@ -1 +0,0 @@ -[-123] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/negative-one/input b/lang/c/jansson/test/suites/valid/negative-one/input deleted file mode 100644 index 2363a1ac08e..00000000000 --- a/lang/c/jansson/test/suites/valid/negative-one/input +++ /dev/null @@ -1 +0,0 @@ -[-1] diff --git a/lang/c/jansson/test/suites/valid/negative-one/output b/lang/c/jansson/test/suites/valid/negative-one/output deleted file mode 100644 index 99d21a2a0f0..00000000000 --- a/lang/c/jansson/test/suites/valid/negative-one/output +++ /dev/null @@ -1 +0,0 @@ -[-1] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/negative-zero/input b/lang/c/jansson/test/suites/valid/negative-zero/input deleted file mode 100644 index 40fc49c7159..00000000000 --- a/lang/c/jansson/test/suites/valid/negative-zero/input +++ /dev/null @@ -1 +0,0 @@ -[-0] diff --git a/lang/c/jansson/test/suites/valid/negative-zero/output b/lang/c/jansson/test/suites/valid/negative-zero/output deleted file mode 100644 index 6e7ea636eec..00000000000 --- a/lang/c/jansson/test/suites/valid/negative-zero/output +++ /dev/null @@ -1 +0,0 @@ -[0] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/null/input b/lang/c/jansson/test/suites/valid/null/input deleted file mode 100644 index 62864b313dd..00000000000 --- a/lang/c/jansson/test/suites/valid/null/input +++ /dev/null @@ -1 +0,0 @@ -[null] diff --git a/lang/c/jansson/test/suites/valid/null/output b/lang/c/jansson/test/suites/valid/null/output deleted file mode 100644 index 500db4a86aa..00000000000 --- a/lang/c/jansson/test/suites/valid/null/output +++ /dev/null @@ -1 +0,0 @@ -[null] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/one-byte-utf-8/input b/lang/c/jansson/test/suites/valid/one-byte-utf-8/input deleted file mode 100644 index 8bda4685d48..00000000000 --- a/lang/c/jansson/test/suites/valid/one-byte-utf-8/input +++ /dev/null @@ -1 +0,0 @@ -["\u002c one-byte UTF-8"] diff --git a/lang/c/jansson/test/suites/valid/one-byte-utf-8/output b/lang/c/jansson/test/suites/valid/one-byte-utf-8/output deleted file mode 100644 index c33d250ff71..00000000000 --- a/lang/c/jansson/test/suites/valid/one-byte-utf-8/output +++ /dev/null @@ -1 +0,0 @@ -[", one-byte UTF-8"] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/real-capital-e-negative-exponent/input b/lang/c/jansson/test/suites/valid/real-capital-e-negative-exponent/input deleted file mode 100644 index 1e9fa515370..00000000000 --- a/lang/c/jansson/test/suites/valid/real-capital-e-negative-exponent/input +++ /dev/null @@ -1 +0,0 @@ -[1E-2] diff --git a/lang/c/jansson/test/suites/valid/real-capital-e-negative-exponent/output b/lang/c/jansson/test/suites/valid/real-capital-e-negative-exponent/output deleted file mode 100644 index 75b9ef92cd4..00000000000 --- a/lang/c/jansson/test/suites/valid/real-capital-e-negative-exponent/output +++ /dev/null @@ -1 +0,0 @@ -[0.01] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/real-capital-e-positive-exponent/input b/lang/c/jansson/test/suites/valid/real-capital-e-positive-exponent/input deleted file mode 100644 index 6a6ab933715..00000000000 --- a/lang/c/jansson/test/suites/valid/real-capital-e-positive-exponent/input +++ /dev/null @@ -1 +0,0 @@ -[1E+2] diff --git a/lang/c/jansson/test/suites/valid/real-capital-e-positive-exponent/output b/lang/c/jansson/test/suites/valid/real-capital-e-positive-exponent/output deleted file mode 100644 index d8ff702a11b..00000000000 --- a/lang/c/jansson/test/suites/valid/real-capital-e-positive-exponent/output +++ /dev/null @@ -1 +0,0 @@ -[100.0] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/real-capital-e/input b/lang/c/jansson/test/suites/valid/real-capital-e/input deleted file mode 100644 index e70322356c3..00000000000 --- a/lang/c/jansson/test/suites/valid/real-capital-e/input +++ /dev/null @@ -1 +0,0 @@ -[1E22] diff --git a/lang/c/jansson/test/suites/valid/real-capital-e/output b/lang/c/jansson/test/suites/valid/real-capital-e/output deleted file mode 100644 index 88e90ce2525..00000000000 --- a/lang/c/jansson/test/suites/valid/real-capital-e/output +++ /dev/null @@ -1 +0,0 @@ -[1e+22] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/real-exponent/input b/lang/c/jansson/test/suites/valid/real-exponent/input deleted file mode 100644 index b2a69b9a35c..00000000000 --- a/lang/c/jansson/test/suites/valid/real-exponent/input +++ /dev/null @@ -1 +0,0 @@ -[123e45] diff --git a/lang/c/jansson/test/suites/valid/real-exponent/output b/lang/c/jansson/test/suites/valid/real-exponent/output deleted file mode 100644 index ac910d678fc..00000000000 --- a/lang/c/jansson/test/suites/valid/real-exponent/output +++ /dev/null @@ -1 +0,0 @@ -[1.2299999999999999e+47] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/real-fraction-exponent/input b/lang/c/jansson/test/suites/valid/real-fraction-exponent/input deleted file mode 100644 index 0c1660d1e9c..00000000000 --- a/lang/c/jansson/test/suites/valid/real-fraction-exponent/input +++ /dev/null @@ -1 +0,0 @@ -[123.456e78] diff --git a/lang/c/jansson/test/suites/valid/real-fraction-exponent/output b/lang/c/jansson/test/suites/valid/real-fraction-exponent/output deleted file mode 100644 index 4b87bda2583..00000000000 --- a/lang/c/jansson/test/suites/valid/real-fraction-exponent/output +++ /dev/null @@ -1 +0,0 @@ -[1.23456e+80] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/real-negative-exponent/input b/lang/c/jansson/test/suites/valid/real-negative-exponent/input deleted file mode 100644 index daa4af932bd..00000000000 --- a/lang/c/jansson/test/suites/valid/real-negative-exponent/input +++ /dev/null @@ -1 +0,0 @@ -[1e-2] diff --git a/lang/c/jansson/test/suites/valid/real-negative-exponent/output b/lang/c/jansson/test/suites/valid/real-negative-exponent/output deleted file mode 100644 index 75b9ef92cd4..00000000000 --- a/lang/c/jansson/test/suites/valid/real-negative-exponent/output +++ /dev/null @@ -1 +0,0 @@ -[0.01] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/real-positive-exponent/input b/lang/c/jansson/test/suites/valid/real-positive-exponent/input deleted file mode 100644 index f3780773a9a..00000000000 --- a/lang/c/jansson/test/suites/valid/real-positive-exponent/input +++ /dev/null @@ -1 +0,0 @@ -[1e+2] diff --git a/lang/c/jansson/test/suites/valid/real-positive-exponent/output b/lang/c/jansson/test/suites/valid/real-positive-exponent/output deleted file mode 100644 index d8ff702a11b..00000000000 --- a/lang/c/jansson/test/suites/valid/real-positive-exponent/output +++ /dev/null @@ -1 +0,0 @@ -[100.0] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/real-underflow/input b/lang/c/jansson/test/suites/valid/real-underflow/input deleted file mode 100644 index dc709960a11..00000000000 --- a/lang/c/jansson/test/suites/valid/real-underflow/input +++ /dev/null @@ -1 +0,0 @@ -[123e-10000000] diff --git a/lang/c/jansson/test/suites/valid/real-underflow/output b/lang/c/jansson/test/suites/valid/real-underflow/output deleted file mode 100644 index 92df1df1d15..00000000000 --- a/lang/c/jansson/test/suites/valid/real-underflow/output +++ /dev/null @@ -1 +0,0 @@ -[0.0] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/run b/lang/c/jansson/test/suites/valid/run deleted file mode 100755 index fa594e6b673..00000000000 --- a/lang/c/jansson/test/suites/valid/run +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2009-2011 Petri Lehtinen -# -# Jansson is free software; you can redistribute it and/or modify -# it under the terms of the MIT license. See LICENSE for details. - -export JSON_SORT_KEYS=1 - -is_test() { - test -d $test_path -} - -do_run() { - variant=$1 - s=".$1" - - strip=0 - [ "$variant" = "strip" ] && strip=1 - - STRIP=$strip $json_process \ - <$test_path/input >$test_log/stdout$s 2>$test_log/stderr$s - valgrind_check $test_log/stderr$s || return 1 - - ref=output - [ -f $test_path/output$s ] && ref=output$s - - if ! cmp -s $test_path/$ref $test_log/stdout$s; then - echo $variant > $test_log/variant - return 1 - fi -} - -run_test() { - do_run normal && do_run strip -} - -show_error() { - valgrind_show_error && return - - read variant < $test_log/variant - s=".$variant" - - echo "VARIANT: $variant" - - echo "EXPECTED OUTPUT:" - ref=output - [ -f $test_path/output$s ] && ref=output$s - nl -bn $test_path/$ref - - echo "ACTUAL OUTPUT:" - nl -bn $test_log/stdout$s -} - -. $top_srcdir/test/scripts/run-tests.sh diff --git a/lang/c/jansson/test/suites/valid/short-string/input b/lang/c/jansson/test/suites/valid/short-string/input deleted file mode 100644 index 0c3426d4c28..00000000000 --- a/lang/c/jansson/test/suites/valid/short-string/input +++ /dev/null @@ -1 +0,0 @@ -["a"] diff --git a/lang/c/jansson/test/suites/valid/short-string/output b/lang/c/jansson/test/suites/valid/short-string/output deleted file mode 100644 index eac5f7b46e0..00000000000 --- a/lang/c/jansson/test/suites/valid/short-string/output +++ /dev/null @@ -1 +0,0 @@ -["a"] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/simple-ascii-string/input b/lang/c/jansson/test/suites/valid/simple-ascii-string/input deleted file mode 100644 index 929b215c177..00000000000 --- a/lang/c/jansson/test/suites/valid/simple-ascii-string/input +++ /dev/null @@ -1 +0,0 @@ -["abcdefghijklmnopqrstuvwxyz1234567890 "] diff --git a/lang/c/jansson/test/suites/valid/simple-ascii-string/output b/lang/c/jansson/test/suites/valid/simple-ascii-string/output deleted file mode 100644 index 90358ab7032..00000000000 --- a/lang/c/jansson/test/suites/valid/simple-ascii-string/output +++ /dev/null @@ -1 +0,0 @@ -["abcdefghijklmnopqrstuvwxyz1234567890 "] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/simple-int-0/input b/lang/c/jansson/test/suites/valid/simple-int-0/input deleted file mode 100644 index 111bb868654..00000000000 --- a/lang/c/jansson/test/suites/valid/simple-int-0/input +++ /dev/null @@ -1 +0,0 @@ -[0] diff --git a/lang/c/jansson/test/suites/valid/simple-int-0/output b/lang/c/jansson/test/suites/valid/simple-int-0/output deleted file mode 100644 index 6e7ea636eec..00000000000 --- a/lang/c/jansson/test/suites/valid/simple-int-0/output +++ /dev/null @@ -1 +0,0 @@ -[0] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/simple-int-1/input b/lang/c/jansson/test/suites/valid/simple-int-1/input deleted file mode 100644 index 7660873d103..00000000000 --- a/lang/c/jansson/test/suites/valid/simple-int-1/input +++ /dev/null @@ -1 +0,0 @@ -[1] diff --git a/lang/c/jansson/test/suites/valid/simple-int-1/output b/lang/c/jansson/test/suites/valid/simple-int-1/output deleted file mode 100644 index bace2a0be17..00000000000 --- a/lang/c/jansson/test/suites/valid/simple-int-1/output +++ /dev/null @@ -1 +0,0 @@ -[1] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/simple-int-123/input b/lang/c/jansson/test/suites/valid/simple-int-123/input deleted file mode 100644 index 3214bfe58c9..00000000000 --- a/lang/c/jansson/test/suites/valid/simple-int-123/input +++ /dev/null @@ -1 +0,0 @@ -[123] diff --git a/lang/c/jansson/test/suites/valid/simple-int-123/output b/lang/c/jansson/test/suites/valid/simple-int-123/output deleted file mode 100644 index e47f69afcf4..00000000000 --- a/lang/c/jansson/test/suites/valid/simple-int-123/output +++ /dev/null @@ -1 +0,0 @@ -[123] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/simple-object/input b/lang/c/jansson/test/suites/valid/simple-object/input deleted file mode 100644 index a34fb4907eb..00000000000 --- a/lang/c/jansson/test/suites/valid/simple-object/input +++ /dev/null @@ -1 +0,0 @@ -{"a":[]} diff --git a/lang/c/jansson/test/suites/valid/simple-object/output b/lang/c/jansson/test/suites/valid/simple-object/output deleted file mode 100644 index 982abe82624..00000000000 --- a/lang/c/jansson/test/suites/valid/simple-object/output +++ /dev/null @@ -1 +0,0 @@ -{"a": []} \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/simple-real/input b/lang/c/jansson/test/suites/valid/simple-real/input deleted file mode 100644 index 0fed7df36a1..00000000000 --- a/lang/c/jansson/test/suites/valid/simple-real/input +++ /dev/null @@ -1 +0,0 @@ -[123.456789] diff --git a/lang/c/jansson/test/suites/valid/simple-real/output b/lang/c/jansson/test/suites/valid/simple-real/output deleted file mode 100644 index b02878e5fc1..00000000000 --- a/lang/c/jansson/test/suites/valid/simple-real/output +++ /dev/null @@ -1 +0,0 @@ -[123.456789] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/string-escapes/input b/lang/c/jansson/test/suites/valid/string-escapes/input deleted file mode 100644 index d994564d3f0..00000000000 --- a/lang/c/jansson/test/suites/valid/string-escapes/input +++ /dev/null @@ -1 +0,0 @@ -["\"\\\/\b\f\n\r\t"] diff --git a/lang/c/jansson/test/suites/valid/string-escapes/output b/lang/c/jansson/test/suites/valid/string-escapes/output deleted file mode 100644 index ca5c1c6583b..00000000000 --- a/lang/c/jansson/test/suites/valid/string-escapes/output +++ /dev/null @@ -1 +0,0 @@ -["\"\\/\b\f\n\r\t"] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/three-byte-utf-8/input b/lang/c/jansson/test/suites/valid/three-byte-utf-8/input deleted file mode 100644 index ccc0bfa5727..00000000000 --- a/lang/c/jansson/test/suites/valid/three-byte-utf-8/input +++ /dev/null @@ -1 +0,0 @@ -["\u0821 three-byte UTF-8"] diff --git a/lang/c/jansson/test/suites/valid/three-byte-utf-8/output b/lang/c/jansson/test/suites/valid/three-byte-utf-8/output deleted file mode 100644 index c44d124e755..00000000000 --- a/lang/c/jansson/test/suites/valid/three-byte-utf-8/output +++ /dev/null @@ -1 +0,0 @@ -["ࠡ three-byte UTF-8"] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/true/input b/lang/c/jansson/test/suites/valid/true/input deleted file mode 100644 index 29513c49176..00000000000 --- a/lang/c/jansson/test/suites/valid/true/input +++ /dev/null @@ -1 +0,0 @@ -[true] diff --git a/lang/c/jansson/test/suites/valid/true/output b/lang/c/jansson/test/suites/valid/true/output deleted file mode 100644 index de601e305f4..00000000000 --- a/lang/c/jansson/test/suites/valid/true/output +++ /dev/null @@ -1 +0,0 @@ -[true] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/two-byte-utf-8/input b/lang/c/jansson/test/suites/valid/two-byte-utf-8/input deleted file mode 100644 index 05ae854b52f..00000000000 --- a/lang/c/jansson/test/suites/valid/two-byte-utf-8/input +++ /dev/null @@ -1 +0,0 @@ -["\u0123 two-byte UTF-8"] diff --git a/lang/c/jansson/test/suites/valid/two-byte-utf-8/output b/lang/c/jansson/test/suites/valid/two-byte-utf-8/output deleted file mode 100644 index 1f0988d9451..00000000000 --- a/lang/c/jansson/test/suites/valid/two-byte-utf-8/output +++ /dev/null @@ -1 +0,0 @@ -["ģ two-byte UTF-8"] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/utf-8-string/input b/lang/c/jansson/test/suites/valid/utf-8-string/input deleted file mode 100644 index 20dc64a45ca..00000000000 --- a/lang/c/jansson/test/suites/valid/utf-8-string/input +++ /dev/null @@ -1 +0,0 @@ -["€þıœəßð some utf-8 ĸʒ×ŋµåäö𝄞"] diff --git a/lang/c/jansson/test/suites/valid/utf-8-string/output b/lang/c/jansson/test/suites/valid/utf-8-string/output deleted file mode 100644 index 53728650da8..00000000000 --- a/lang/c/jansson/test/suites/valid/utf-8-string/output +++ /dev/null @@ -1 +0,0 @@ -["€þıœəßð some utf-8 ĸʒ×ŋµåäö𝄞"] \ No newline at end of file diff --git a/lang/c/jansson/test/suites/valid/utf-surrogate-four-byte-encoding/input b/lang/c/jansson/test/suites/valid/utf-surrogate-four-byte-encoding/input deleted file mode 100644 index c598b41723e..00000000000 --- a/lang/c/jansson/test/suites/valid/utf-surrogate-four-byte-encoding/input +++ /dev/null @@ -1 +0,0 @@ -["\uD834\uDD1E surrogate, four-byte UTF-8"] diff --git a/lang/c/jansson/test/suites/valid/utf-surrogate-four-byte-encoding/output b/lang/c/jansson/test/suites/valid/utf-surrogate-four-byte-encoding/output deleted file mode 100644 index fa806d25446..00000000000 --- a/lang/c/jansson/test/suites/valid/utf-surrogate-four-byte-encoding/output +++ /dev/null @@ -1 +0,0 @@ -["𝄞 surrogate, four-byte UTF-8"] \ No newline at end of file diff --git a/lang/c/src/CMakeLists.txt b/lang/c/src/CMakeLists.txt index 589296b8aae..c21f1ce08c5 100644 --- a/lang/c/src/CMakeLists.txt +++ b/lang/c/src/CMakeLists.txt @@ -76,39 +76,22 @@ set(AVRO_SRC wrapped-buffer.c ) -set(JANSSON_SRC - ../jansson/src/dump.c - ../jansson/src/error.c - ../jansson/src/hashtable.c - ../jansson/src/hashtable.h - ../jansson/src/jansson.h - ../jansson/src/jansson_private.h - ../jansson/src/load.c - ../jansson/src/memory.c - ../jansson/src/pack_unpack.c - ../jansson/src/strbuffer.c - ../jansson/src/strbuffer.h - ../jansson/src/utf.c - ../jansson/src/utf.h - ../jansson/src/value.c -) source_group(Avro FILES ${AVRO_SRC}) -source_group(Jansson FILES ${JANSSON_SRC}) # The version.sh script gives us a SOVERSION that uses colon as a # separator; we need periods. string(REPLACE ":" "." LIBAVRO_DOT_VERSION ${LIBAVRO_VERSION}) -add_library(avro-static STATIC ${AVRO_SRC} ${JANSSON_SRC}) -target_link_libraries(avro-static ${CODEC_LIBRARIES} ${THREADS_LIBRARIES}) +add_library(avro-static STATIC ${AVRO_SRC}) +target_link_libraries(avro-static ${JANSSON_LIBRARIES} ${CODEC_LIBRARIES} ${THREADS_LIBRARIES}) set_target_properties(avro-static PROPERTIES OUTPUT_NAME avro) if (NOT WIN32) # TODO: Create Windows DLLs. See http://www.cmake.org/Wiki/BuildingWinDLL -add_library(avro-shared SHARED ${AVRO_SRC} ${JANSSON_SRC}) -target_link_libraries(avro-shared ${CODEC_LIBRARIES} ${THREADS_LIBRARIES}) +add_library(avro-shared SHARED ${AVRO_SRC}) +target_link_libraries(avro-shared ${JANSSON_LIBRARIES} ${CODEC_LIBRARIES} ${THREADS_LIBRARIES}) set_target_properties(avro-shared PROPERTIES OUTPUT_NAME avro SOVERSION ${LIBAVRO_DOT_VERSION}) diff --git a/lang/c/tests/test_avro_data.c b/lang/c/tests/test_avro_data.c index 652ff167676..0b82c2711d6 100644 --- a/lang/c/tests/test_avro_data.c +++ b/lang/c/tests/test_avro_data.c @@ -142,7 +142,7 @@ static void test_json(avro_datum_t datum, const char *expected) { char *json = NULL; avro_datum_to_json(datum, 1, &json); - if (strcmp(json, expected) != 0) { + if (strcasecmp(json, expected) != 0) { fprintf(stderr, "Unexpected JSON encoding: %s\n", json); exit(EXIT_FAILURE); } diff --git a/share/docker/Dockerfile b/share/docker/Dockerfile index aa82a458f67..01760554d7b 100644 --- a/share/docker/Dockerfile +++ b/share/docker/Dockerfile @@ -27,7 +27,7 @@ RUN curl -sL https://deb.nodesource.com/setup_4.x | bash - # Install dependencies from packages RUN apt-get update && apt-get install --no-install-recommends -y \ git subversion curl ant make maven \ - gcc cmake asciidoc source-highlight \ + gcc cmake libjansson-dev asciidoc source-highlight \ g++ flex bison libboost-all-dev doxygen \ mono-devel mono-gmcs nunit \ nodejs \ From a38ca8957c021e8dc532132652c2fb289d8e1d6a Mon Sep 17 00:00:00 2001 From: Martin Kleppmann Date: Thu, 21 Jan 2016 10:59:16 +0000 Subject: [PATCH 024/116] AVRO-1691. C: Allow schemas consisting only of a primitive type. Contributed by Magnus Edenhill. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1725902 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 ++ lang/c/src/schema.c | 4 +- lang/c/tests/CMakeLists.txt | 1 + lang/c/tests/test_avro_1691.c | 94 +++++++++++++++++++++++++++++++++++ 4 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 lang/c/tests/test_avro_1691.c diff --git a/CHANGES.txt b/CHANGES.txt index 433d434fd00..7f77ae23f29 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -258,6 +258,9 @@ Avro 1.8.0 (15 December 2015) AVRO-1769. C: Use operating system's libjansson instead of bundling it with Avro. (Magnus Edenhill via martinkl) + AVRO-1691. C: Allow schemas consisting only of a primitive type. + (Magnus Edenhill via martinkl) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/lang/c/src/schema.c b/lang/c/src/schema.c index 7ed6125370d..bb8c3403194 100644 --- a/lang/c/src/schema.c +++ b/lang/c/src/schema.c @@ -1136,7 +1136,7 @@ avro_schema_from_json(const char *jsontext, const int32_t len, AVRO_UNUSED(len); AVRO_UNUSED(e); - root = json_loads(jsontext, 0, &json_error); + root = json_loads(jsontext, JSON_DECODE_ANY, &json_error); if (!root) { avro_set_error("Error parsing JSON: %s", json_error.text); return EINVAL; @@ -1155,7 +1155,7 @@ avro_schema_from_json_length(const char *jsontext, size_t length, json_t *root; json_error_t json_error; - root = json_loadb(jsontext, length, 0, &json_error); + root = json_loadb(jsontext, length, JSON_DECODE_ANY, &json_error); if (!root) { avro_set_error("Error parsing JSON: %s", json_error.text); return EINVAL; diff --git a/lang/c/tests/CMakeLists.txt b/lang/c/tests/CMakeLists.txt index 2e51005220d..445e689a7ed 100644 --- a/lang/c/tests/CMakeLists.txt +++ b/lang/c/tests/CMakeLists.txt @@ -63,3 +63,4 @@ add_avro_test(test_avro_data) add_avro_test(test_refcount) add_avro_test(test_cpp test_cpp.cpp) add_avro_test(test_avro_1379) +add_avro_test(test_avro_1691) diff --git a/lang/c/tests/test_avro_1691.c b/lang/c/tests/test_avro_1691.c new file mode 100644 index 00000000000..455f2cb627c --- /dev/null +++ b/lang/c/tests/test_avro_1691.c @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to you under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +/** + * AVRO-1691 test case - support of string-field JSON schemas. + */ +#include "avro.h" +#include "avro_private.h" +#include +#include + +static const char *json_schemas[] = { + /* These two schemas are functionally equivalent. */ + "{ \"type\": \"string\" }", /* Object wrapped */ + "\"string\"", /* JSON string field */ + NULL +}; + + + + +int main(void) +{ + int pass; + + for (pass = 0 ; json_schemas[pass] ; pass++) { + int rval = 0; + size_t len; + static char buf[4096]; + avro_writer_t writer; + avro_file_writer_t file_writer; + avro_file_reader_t file_reader; + avro_schema_t schema = NULL; + avro_schema_error_t error = NULL; + char outpath[64]; + const char *json_schema = json_schemas[pass]; + + printf("pass %d with schema %s\n", pass, json_schema); + check(rval, avro_schema_from_json(json_schema, strlen(json_schema), + &schema, &error)); + + avro_value_iface_t *iface = avro_generic_class_from_schema(schema); + + avro_value_t val; + avro_generic_value_new(iface, &val); + + avro_value_t out; + avro_generic_value_new(iface, &out); + + /* create the val */ + avro_value_reset(&val); + avro_value_set_string(&val, "test-1691"); + + /* Write value to file */ + snprintf(outpath, sizeof(outpath), "test-1691-%d.avro", pass); + + /* create the writers */ + writer = avro_writer_memory(buf, sizeof(buf)); + check(rval, avro_file_writer_create(outpath, schema, &file_writer)); + + check(rval, avro_value_write(writer, &val)); + + len = avro_writer_tell(writer); + check(rval, avro_file_writer_append_encoded(file_writer, buf, len)); + check(rval, avro_file_writer_close(file_writer)); + + /* Read the value back */ + check(rval, avro_file_reader(outpath, &file_reader)); + check(rval, avro_file_reader_read_value(file_reader, &out)); + if (!avro_value_equal(&val, &out)) { + fprintf(stderr, "fail!\n"); + exit(EXIT_FAILURE); + } + fprintf(stderr, "pass %d: ok: schema %s\n", pass, json_schema); + check(rval, avro_file_reader_close(file_reader)); + remove(outpath); + } + + exit(EXIT_SUCCESS); +} From e810734de79c0be44e2038bede4129189fe68648 Mon Sep 17 00:00:00 2001 From: Martin Kleppmann Date: Thu, 21 Jan 2016 11:00:54 +0000 Subject: [PATCH 025/116] AVRO-1663. C: Fix handling of namespaces for enum and fixed types. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1725903 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 + lang/c/src/allocation.c | 13 ++ lang/c/src/avro/allocation.h | 1 + lang/c/src/avro/schema.h | 4 + lang/c/src/schema.c | 199 ++++++++++++++---- lang/c/src/schema.h | 2 + lang/c/src/schema_equal.c | 6 + lang/c/tests/schema_tests/pass/namespace_enum | 9 + .../c/tests/schema_tests/pass/namespace_fixed | 9 + .../schema_tests/pass/namespace_fullname | 8 + 10 files changed, 216 insertions(+), 38 deletions(-) create mode 100644 lang/c/tests/schema_tests/pass/namespace_enum create mode 100644 lang/c/tests/schema_tests/pass/namespace_fixed create mode 100644 lang/c/tests/schema_tests/pass/namespace_fullname diff --git a/CHANGES.txt b/CHANGES.txt index 7f77ae23f29..9bbe7605db3 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -261,6 +261,9 @@ Avro 1.8.0 (15 December 2015) AVRO-1691. C: Allow schemas consisting only of a primitive type. (Magnus Edenhill via martinkl) + AVRO-1663. C: Fix handling of namespaces for enum and fixed types. + (martinkl) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/lang/c/src/allocation.c b/lang/c/src/allocation.c index 58af9bd0573..23298a674cf 100644 --- a/lang/c/src/allocation.c +++ b/lang/c/src/allocation.c @@ -88,6 +88,19 @@ char *avro_strdup(const char *str) return new_str; } +char *avro_strndup(const char *str, size_t size) +{ + if (str == NULL) { + return NULL; + } + + char *new_str = avro_str_alloc(size + 1); + memcpy(new_str, str, size); + new_str[size] = '\0'; + + return new_str; +} + void avro_str_free(char *str) { size_t *size = ((size_t *) str) - 1; diff --git a/lang/c/src/avro/allocation.h b/lang/c/src/avro/allocation.h index ca6951778bb..079085978b8 100644 --- a/lang/c/src/avro/allocation.h +++ b/lang/c/src/avro/allocation.h @@ -82,6 +82,7 @@ void *avro_calloc(size_t count, size_t size); char *avro_str_alloc(size_t str_size); char *avro_strdup(const char *str); +char *avro_strndup(const char *str, size_t size); void avro_str_free(char *str); CLOSE_EXTERN diff --git a/lang/c/src/avro/schema.h b/lang/c/src/avro/schema.h index b9c59cd45d1..41dd8ea48d6 100644 --- a/lang/c/src/avro/schema.h +++ b/lang/c/src/avro/schema.h @@ -54,6 +54,7 @@ int avro_schema_record_field_append(const avro_schema_t record, size_t avro_schema_record_size(const avro_schema_t record); avro_schema_t avro_schema_enum(const char *name); +avro_schema_t avro_schema_enum_ns(const char *name, const char *space); const char *avro_schema_enum_get(const avro_schema_t enump, int index); int avro_schema_enum_get_by_name(const avro_schema_t enump, @@ -62,6 +63,8 @@ int avro_schema_enum_symbol_append(const avro_schema_t enump, const char *symbol); avro_schema_t avro_schema_fixed(const char *name, const int64_t len); +avro_schema_t avro_schema_fixed_ns(const char *name, const char *space, + const int64_t len); int64_t avro_schema_fixed_size(const avro_schema_t fixed); avro_schema_t avro_schema_map(const avro_schema_t values); @@ -103,6 +106,7 @@ int avro_schema_to_specific(avro_schema_t schema, const char *prefix); avro_schema_t avro_schema_get_subschema(const avro_schema_t schema, const char *name); const char *avro_schema_name(const avro_schema_t schema); +const char *avro_schema_namespace(const avro_schema_t schema); const char *avro_schema_type_name(const avro_schema_t schema); avro_schema_t avro_schema_copy(avro_schema_t schema); int avro_schema_equal(avro_schema_t a, avro_schema_t b); diff --git a/lang/c/src/schema.c b/lang/c/src/schema.c index bb8c3403194..3ade1140e01 100644 --- a/lang/c/src/schema.c +++ b/lang/c/src/schema.c @@ -68,6 +68,22 @@ static int is_avro_id(const char *name) return 0; } +/* Splits a qualified name by the last period, e.g. fullname "foo.bar.Baz" into + * name "Baz" and namespace "foo.bar". Sets name_out to the name part (pointing + * to a later position in the buffer that was passed in), and returns the + * namespace (as a newly allocated buffer using Avro's allocator). */ +static char *split_namespace_name(const char *fullname, const char **name_out) +{ + char *last_dot = strrchr(fullname, '.'); + if (last_dot == NULL) { + *name_out = fullname; + return NULL; + } else { + *name_out = last_dot + 1; + return avro_strndup(fullname, last_dot - fullname); + } +} + static int record_free_foreach(int i, struct avro_record_field_t *field, void *arg) { @@ -132,6 +148,9 @@ static void avro_schema_free(avro_schema_t schema) struct avro_enum_schema_t *enump; enump = avro_schema_to_enum(schema); avro_str_free(enump->name); + if (enump->space) { + avro_str_free(enump->space); + } st_foreach(enump->symbols, HASH_FUNCTION_CAST enum_free_foreach, 0); st_free_table(enump->symbols); @@ -144,6 +163,9 @@ static void avro_schema_free(avro_schema_t schema) struct avro_fixed_schema_t *fixed; fixed = avro_schema_to_fixed(schema); avro_str_free((char *) fixed->name); + if (fixed->space) { + avro_str_free((char *) fixed->space); + } avro_freet(struct avro_fixed_schema_t, fixed); } break; @@ -284,6 +306,12 @@ avro_schema_t avro_schema_null(void) } avro_schema_t avro_schema_fixed(const char *name, const int64_t size) +{ + return avro_schema_fixed_ns(name, NULL, size); +} + +avro_schema_t avro_schema_fixed_ns(const char *name, const char *space, + const int64_t size) { if (!is_avro_id(name)) { avro_set_error("Invalid Avro identifier"); @@ -297,6 +325,18 @@ avro_schema_t avro_schema_fixed(const char *name, const int64_t size) return NULL; } fixed->name = avro_strdup(name); + if (!fixed->name) { + avro_set_error("Cannot allocate new fixed schema"); + avro_freet(struct avro_fixed_schema_t, fixed); + return NULL; + } + fixed->space = space ? avro_strdup(space) : NULL; + if (space && !fixed->space) { + avro_set_error("Cannot allocate new fixed schema"); + avro_str_free((char *) fixed->name); + avro_freet(struct avro_fixed_schema_t, fixed); + return NULL; + } fixed->size = size; avro_schema_init(&fixed->obj, AVRO_FIXED); return &fixed->obj; @@ -434,6 +474,11 @@ avro_schema_t avro_schema_map_values(avro_schema_t map) } avro_schema_t avro_schema_enum(const char *name) +{ + return avro_schema_enum_ns(name, NULL); +} + +avro_schema_t avro_schema_enum_ns(const char *name, const char *space) { if (!is_avro_id(name)) { avro_set_error("Invalid Avro identifier"); @@ -451,9 +496,17 @@ avro_schema_t avro_schema_enum(const char *name) avro_freet(struct avro_enum_schema_t, enump); return NULL; } + enump->space = space ? avro_strdup(space) : NULL; + if (space && !enump->space) { + avro_set_error("Cannot allocate new enum schema"); + avro_str_free(enump->name); + avro_freet(struct avro_enum_schema_t, enump); + return NULL; + } enump->symbols = st_init_numtable_with_size(DEFAULT_TABLE_SIZE); if (!enump->symbols) { avro_set_error("Cannot allocate new enum schema"); + if (enump->space) avro_str_free(enump->space); avro_str_free(enump->name); avro_freet(struct avro_enum_schema_t, enump); return NULL; @@ -462,6 +515,7 @@ avro_schema_t avro_schema_enum(const char *name) if (!enump->symbols_byname) { avro_set_error("Cannot allocate new enum schema"); st_free_table(enump->symbols); + if (enump->space) avro_str_free(enump->space); avro_str_free(enump->name); avro_freet(struct avro_enum_schema_t, enump); return NULL; @@ -701,8 +755,10 @@ qualify_name(const char *name, const char *namespace) } static int -save_named_schemas(const char *name, const char *namespace, avro_schema_t schema, st_table *st) +save_named_schemas(const avro_schema_t schema, st_table *st) { + const char *name = avro_schema_name(schema); + const char *namespace = avro_schema_namespace(schema); const char *full_name = qualify_name(name, namespace); int rval = st_insert(st, (st_data_t) full_name, (st_data_t) schema); return rval; @@ -852,8 +908,7 @@ avro_schema_from_json_t(json_t *json, avro_schema_t *schema, json_object_get(json, "namespace"); json_t *json_fields = json_object_get(json, "fields"); unsigned int num_fields; - const char *record_name; - const char *record_namespace; + const char *fullname, *name; if (!json_is_string(json_name)) { avro_set_error("Record type must have a \"name\""); @@ -868,20 +923,27 @@ avro_schema_from_json_t(json_t *json, avro_schema_t *schema, avro_set_error("Record type must have at least one field"); return EINVAL; } - record_name = json_string_value(json_name); - if (!record_name) { + fullname = json_string_value(json_name); + if (!fullname) { avro_set_error("Record type must have a \"name\""); return EINVAL; } - if (json_is_string(json_namespace)) { - record_namespace = - json_string_value(json_namespace); + + if (strchr(fullname, '.')) { + char *namespace = split_namespace_name(fullname, &name); + *schema = avro_schema_record(name, namespace); + avro_str_free(namespace); + } else if (json_is_string(json_namespace)) { + const char *namespace = json_string_value(json_namespace); + *schema = avro_schema_record(fullname, namespace); } else { - record_namespace = parent_namespace; + *schema = avro_schema_record(fullname, parent_namespace); } - *schema = - avro_schema_record(record_name, record_namespace); - if (save_named_schemas(record_name, record_namespace, *schema, named_schemas)) { + + if (*schema == NULL) { + return ENOMEM; + } + if (save_named_schemas(*schema, named_schemas)) { avro_set_error("Cannot save record schema"); return ENOMEM; } @@ -915,7 +977,8 @@ avro_schema_from_json_t(json_t *json, avro_schema_t *schema, field_rval = avro_schema_from_json_t(json_field_type, &json_field_type_schema, - named_schemas, record_namespace); + named_schemas, + avro_schema_namespace(*schema)); if (field_rval) { avro_schema_decref(*schema); return field_rval; @@ -938,7 +1001,8 @@ avro_schema_from_json_t(json_t *json, avro_schema_t *schema, { json_t *json_name = json_object_get(json, "name"); json_t *json_symbols = json_object_get(json, "symbols"); - const char *name; + json_t *json_namespace = json_object_get(json, "namespace"); + const char *fullname, *name; unsigned int num_symbols; if (!json_is_string(json_name)) { @@ -950,8 +1014,8 @@ avro_schema_from_json_t(json_t *json, avro_schema_t *schema, return EINVAL; } - name = json_string_value(json_name); - if (!name) { + fullname = json_string_value(json_name); + if (!fullname) { avro_set_error("Enum type must have a \"name\""); return EINVAL; } @@ -960,8 +1024,23 @@ avro_schema_from_json_t(json_t *json, avro_schema_t *schema, avro_set_error("Enum type must have at least one symbol"); return EINVAL; } - *schema = avro_schema_enum(name); - if (save_named_schemas(name, parent_namespace, *schema, named_schemas)) { + + if (strchr(fullname, '.')) { + char *namespace; + namespace = split_namespace_name(fullname, &name); + *schema = avro_schema_enum_ns(name, namespace); + avro_str_free(namespace); + } else if (json_is_string(json_namespace)) { + const char *namespace = json_string_value(json_namespace); + *schema = avro_schema_enum_ns(fullname, namespace); + } else { + *schema = avro_schema_enum_ns(fullname, parent_namespace); + } + + if (*schema == NULL) { + return ENOMEM; + } + if (save_named_schemas(*schema, named_schemas)) { avro_set_error("Cannot save enum schema"); return ENOMEM; } @@ -1066,8 +1145,9 @@ avro_schema_from_json_t(json_t *json, avro_schema_t *schema, { json_t *json_size = json_object_get(json, "size"); json_t *json_name = json_object_get(json, "name"); + json_t *json_namespace = json_object_get(json, "namespace"); json_int_t size; - const char *name; + const char *fullname, *name; if (!json_is_integer(json_size)) { avro_set_error("Fixed type must have a \"size\""); return EINVAL; @@ -1077,9 +1157,24 @@ avro_schema_from_json_t(json_t *json, avro_schema_t *schema, return EINVAL; } size = json_integer_value(json_size); - name = json_string_value(json_name); - *schema = avro_schema_fixed(name, (int64_t) size); - if (save_named_schemas(name, parent_namespace, *schema, named_schemas)) { + fullname = json_string_value(json_name); + + if (strchr(fullname, '.')) { + char *namespace; + namespace = split_namespace_name(fullname, &name); + *schema = avro_schema_fixed_ns(name, namespace, (int64_t) size); + avro_str_free(namespace); + } else if (json_is_string(json_namespace)) { + const char *namespace = json_string_value(json_namespace); + *schema = avro_schema_fixed_ns(fullname, namespace, (int64_t) size); + } else { + *schema = avro_schema_fixed_ns(fullname, parent_namespace, (int64_t) size); + } + + if (*schema == NULL) { + return ENOMEM; + } + if (save_named_schemas(*schema, named_schemas)) { avro_set_error("Cannot save fixed schema"); return ENOMEM; } @@ -1212,7 +1307,8 @@ avro_schema_t avro_schema_copy(avro_schema_t schema) { struct avro_enum_schema_t *enum_schema = avro_schema_to_enum(schema); - new_schema = avro_schema_enum(enum_schema->name); + new_schema = avro_schema_enum_ns(enum_schema->name, + enum_schema->space); for (i = 0; i < enum_schema->symbols->num_entries; i++) { union { st_data_t data; @@ -1230,8 +1326,9 @@ avro_schema_t avro_schema_copy(avro_schema_t schema) struct avro_fixed_schema_t *fixed_schema = avro_schema_to_fixed(schema); new_schema = - avro_schema_fixed(fixed_schema->name, - fixed_schema->size); + avro_schema_fixed_ns(fixed_schema->name, + fixed_schema->space, + fixed_schema->size); } break; @@ -1380,6 +1477,18 @@ const char *avro_schema_name(const avro_schema_t schema) return NULL; } +const char *avro_schema_namespace(const avro_schema_t schema) +{ + if (is_avro_record(schema)) { + return (avro_schema_to_record(schema))->space; + } else if (is_avro_enum(schema)) { + return (avro_schema_to_enum(schema))->space; + } else if (is_avro_fixed(schema)) { + return (avro_schema_to_fixed(schema))->space; + } + return NULL; +} + const char *avro_schema_type_name(const avro_schema_t schema) { if (is_avro_record(schema)) { @@ -1529,7 +1638,7 @@ static int write_record(avro_writer_t out, const struct avro_record_schema_t *re check(rval, avro_write_str(out, "{\"type\":\"record\",\"name\":\"")); check(rval, avro_write_str(out, record->name)); check(rval, avro_write_str(out, "\",")); - if (nullstrcmp(record->space, parent_namespace)) { + if (record->space && nullstrcmp(record->space, parent_namespace)) { check(rval, avro_write_str(out, "\"namespace\":\"")); check(rval, avro_write_str(out, record->space)); check(rval, avro_write_str(out, "\",")); @@ -1549,13 +1658,20 @@ static int write_record(avro_writer_t out, const struct avro_record_schema_t *re return avro_write_str(out, "]}"); } -static int write_enum(avro_writer_t out, const struct avro_enum_schema_t *enump) +static int write_enum(avro_writer_t out, const struct avro_enum_schema_t *enump, + const char *parent_namespace) { int rval; long i; check(rval, avro_write_str(out, "{\"type\":\"enum\",\"name\":\"")); check(rval, avro_write_str(out, enump->name)); - check(rval, avro_write_str(out, "\",\"symbols\":[")); + check(rval, avro_write_str(out, "\",")); + if (enump->space && nullstrcmp(enump->space, parent_namespace)) { + check(rval, avro_write_str(out, "\"namespace\":\"")); + check(rval, avro_write_str(out, enump->space)); + check(rval, avro_write_str(out, "\",")); + } + check(rval, avro_write_str(out, "\"symbols\":[")); for (i = 0; i < enump->symbols->num_entries; i++) { union { @@ -1572,17 +1688,26 @@ static int write_enum(avro_writer_t out, const struct avro_enum_schema_t *enump) } return avro_write_str(out, "]}"); } -static int write_fixed(avro_writer_t out, const struct avro_fixed_schema_t *fixed) + +static int write_fixed(avro_writer_t out, const struct avro_fixed_schema_t *fixed, + const char *parent_namespace) { int rval; char size[16]; check(rval, avro_write_str(out, "{\"type\":\"fixed\",\"name\":\"")); check(rval, avro_write_str(out, fixed->name)); - check(rval, avro_write_str(out, "\",\"size\":")); + check(rval, avro_write_str(out, "\",")); + if (fixed->space && nullstrcmp(fixed->space, parent_namespace)) { + check(rval, avro_write_str(out, "\"namespace\":\"")); + check(rval, avro_write_str(out, fixed->space)); + check(rval, avro_write_str(out, "\",")); + } + check(rval, avro_write_str(out, "\"size\":")); snprintf(size, sizeof(size), "%" PRId64, fixed->size); check(rval, avro_write_str(out, size)); return avro_write_str(out, "}"); } + static int write_map(avro_writer_t out, const struct avro_map_schema_t *map, const char *parent_namespace) { @@ -1624,12 +1749,10 @@ static int write_link(avro_writer_t out, const struct avro_link_schema_t *link, { int rval; check(rval, avro_write_str(out, "\"")); - if (is_avro_record(link->to)) { - const char *namespace = avro_schema_to_record(link->to)->space; - if (nullstrcmp(namespace, parent_namespace)) { - check(rval, avro_write_str(out, namespace)); - check(rval, avro_write_str(out, ".")); - } + const char *namespace = avro_schema_namespace(link->to); + if (namespace && nullstrcmp(namespace, parent_namespace)) { + check(rval, avro_write_str(out, namespace)); + check(rval, avro_write_str(out, ".")); } check(rval, avro_write_str(out, avro_schema_name(link->to))); return avro_write_str(out, "\""); @@ -1676,9 +1799,9 @@ avro_schema_to_json2(const avro_schema_t schema, avro_writer_t out, case AVRO_RECORD: return write_record(out, avro_schema_to_record(schema), parent_namespace); case AVRO_ENUM: - return write_enum(out, avro_schema_to_enum(schema)); + return write_enum(out, avro_schema_to_enum(schema), parent_namespace); case AVRO_FIXED: - return write_fixed(out, avro_schema_to_fixed(schema)); + return write_fixed(out, avro_schema_to_fixed(schema), parent_namespace); case AVRO_MAP: return write_map(out, avro_schema_to_map(schema), parent_namespace); case AVRO_ARRAY: diff --git a/lang/c/src/schema.h b/lang/c/src/schema.h index efeeac371b9..5d548358d91 100644 --- a/lang/c/src/schema.h +++ b/lang/c/src/schema.h @@ -43,6 +43,7 @@ struct avro_record_schema_t { struct avro_enum_schema_t { struct avro_obj_t obj; char *name; + char *space; st_table *symbols; st_table *symbols_byname; }; @@ -66,6 +67,7 @@ struct avro_union_schema_t { struct avro_fixed_schema_t { struct avro_obj_t obj; const char *name; + const char *space; int64_t size; }; diff --git a/lang/c/src/schema_equal.c b/lang/c/src/schema_equal.c index 0be1e832203..ccc19273512 100644 --- a/lang/c/src/schema_equal.c +++ b/lang/c/src/schema_equal.c @@ -72,6 +72,9 @@ schema_enum_equal(struct avro_enum_schema_t *a, struct avro_enum_schema_t *b) */ return 0; } + if (nullstrcmp(a->space, b->space)) { + return 0; + } for (i = 0; i < a->symbols->num_entries; i++) { union { st_data_t data; @@ -100,6 +103,9 @@ schema_fixed_equal(struct avro_fixed_schema_t *a, struct avro_fixed_schema_t *b) */ return 0; } + if (nullstrcmp(a->space, b->space)) { + return 0; + } return (a->size == b->size); } diff --git a/lang/c/tests/schema_tests/pass/namespace_enum b/lang/c/tests/schema_tests/pass/namespace_enum new file mode 100644 index 00000000000..5b77b3530a4 --- /dev/null +++ b/lang/c/tests/schema_tests/pass/namespace_enum @@ -0,0 +1,9 @@ +{"type": "record", "name": "org.apache.avro.tests.Hello", "fields": [ + {"name": "f1", "type": {"type": "enum", "name": "MyEnum", "symbols": ["Foo", "Bar", "Baz"]}}, + {"name": "f2", "type": "org.apache.avro.tests.MyEnum"}, + {"name": "f3", "type": "MyEnum"}, + {"name": "f4", "type": {"type": "enum", "name": "other.namespace.OtherEnum", "symbols": ["one", "two", "three"]}}, + {"name": "f5", "type": "other.namespace.OtherEnum"}, + {"name": "f6", "type": {"type": "enum", "name": "ThirdEnum", "namespace": "some.other", "symbols": ["Alice", "Bob"]}}, + {"name": "f7", "type": "some.other.ThirdEnum"} +]} diff --git a/lang/c/tests/schema_tests/pass/namespace_fixed b/lang/c/tests/schema_tests/pass/namespace_fixed new file mode 100644 index 00000000000..f621e79761b --- /dev/null +++ b/lang/c/tests/schema_tests/pass/namespace_fixed @@ -0,0 +1,9 @@ +{"type": "record", "name": "org.apache.avro.tests.Hello", "fields": [ + {"name": "f1", "type": {"type": "fixed", "name": "MyFixed", "size": 16}}, + {"name": "f2", "type": "org.apache.avro.tests.MyFixed"}, + {"name": "f3", "type": "MyFixed"}, + {"name": "f4", "type": {"type": "fixed", "name": "other.namespace.OtherFixed", "size": 18}}, + {"name": "f5", "type": "other.namespace.OtherFixed"}, + {"name": "f6", "type": {"type": "fixed", "name": "ThirdFixed", "namespace": "some.other", "size": 20}}, + {"name": "f7", "type": "some.other.ThirdFixed"} +]} diff --git a/lang/c/tests/schema_tests/pass/namespace_fullname b/lang/c/tests/schema_tests/pass/namespace_fullname new file mode 100644 index 00000000000..0cc24564824 --- /dev/null +++ b/lang/c/tests/schema_tests/pass/namespace_fullname @@ -0,0 +1,8 @@ +{"type": "record", "name": "x.Y", "fields": [ + {"name": "e", "type": + {"type": "record", "name": "Z", "fields": [ + {"name": "f", "type": "x.Y"}, + {"name": "g", "type": "x.Z"} + ]} + } +]} From 162aa95c11c935a43f2e2130ca3e28279b3ce6fa Mon Sep 17 00:00:00 2001 From: Martin Kleppmann Date: Thu, 21 Jan 2016 11:01:36 +0000 Subject: [PATCH 026/116] AVRO-1775. Ruby: Use test-unit gem for running tests. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1725904 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ lang/ruby/Gemfile | 1 + 2 files changed, 3 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 9bbe7605db3..bd04bdcc635 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -264,6 +264,8 @@ Avro 1.8.0 (15 December 2015) AVRO-1663. C: Fix handling of namespaces for enum and fixed types. (martinkl) + AVRO-1775. Ruby: Use test-unit gem for running tests. (martinkl) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/lang/ruby/Gemfile b/lang/ruby/Gemfile index 20543da7329..17161f526d6 100644 --- a/lang/ruby/Gemfile +++ b/lang/ruby/Gemfile @@ -18,3 +18,4 @@ gem 'rake' gem 'echoe' gem 'multi_json' gem 'snappy' +gem 'test-unit' From 2d192b499d04ff42afb10d06ea178543bc978077 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 21 Jan 2016 12:06:23 +0000 Subject: [PATCH 027/116] AVRO-1781 ADDENDUM: Remove LogicalTypes cache. This cache maps a Schema to its corresponding LogicalType that has been constructed from the Schema's properties, by object identity. This is no longer needed now that the LogicalType is set on the schema instance when it is parsed. The cache was necessary when we were trying to avoid all changes to the Schema class. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1725916 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/avro/LogicalTypes.java | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/lang/java/avro/src/main/java/org/apache/avro/LogicalTypes.java b/lang/java/avro/src/main/java/org/apache/avro/LogicalTypes.java index 727f86c65a2..09fb58113c9 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/LogicalTypes.java +++ b/lang/java/avro/src/main/java/org/apache/avro/LogicalTypes.java @@ -20,15 +20,9 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import com.google.common.base.Optional; -import com.google.common.collect.MapMaker; public class LogicalTypes { - private static final Map> CACHE = new MapMaker() - .weakKeys() - .makeMap(); - public interface LogicalTypeFactory { LogicalType fromSchema(Schema schema); } @@ -54,16 +48,7 @@ public static LogicalType fromSchema(Schema schema) { } public static LogicalType fromSchemaIgnoreInvalid(Schema schema) { - if (CACHE.containsKey(schema)) { - return CACHE.get(schema).orNull(); - } - - LogicalType logicalType = fromSchemaImpl(schema, false); - - // add to the cache, even if it is null - CACHE.put(schema, Optional.fromNullable(logicalType)); - - return logicalType; + return fromSchemaImpl(schema, false); } private static LogicalType fromSchemaImpl(Schema schema, boolean throwErrors) { From adfe620a98d4b0cd7baec266d58ad886a13a3663 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 21 Jan 2016 12:20:36 +0000 Subject: [PATCH 028/116] Increment C version number to reflect incomaptible changes since last update (May 2011). git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1725918 13f79535-47bb-0310-9956-ffa450edef68 --- lang/c/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/c/version.sh b/lang/c/version.sh index 60a922343af..c0215a274f6 100755 --- a/lang/c/version.sh +++ b/lang/c/version.sh @@ -36,7 +36,7 @@ # libavro_binary_age = 0 # libavro_interface_age = 0 # -libavro_micro_version=22 +libavro_micro_version=23 libavro_interface_age=0 libavro_binary_age=0 From 1c648145f37ccfa331c7790663c005858d35627c Mon Sep 17 00:00:00 2001 From: Martin Kleppmann Date: Thu, 21 Jan 2016 15:27:56 +0000 Subject: [PATCH 029/116] AVRO-1783. Ruby: Ensure correct binary encoding for byte strings. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1725987 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 3 +++ lang/ruby/lib/avro/io.rb | 2 +- lang/ruby/lib/avro/ipc.rb | 23 +++++++++--------- lang/ruby/lib/avro/schema.rb | 2 +- lang/ruby/test/test_io.rb | 45 ++++++++++++++++++++++++++++++++++++ 5 files changed, 62 insertions(+), 13 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index bd04bdcc635..37f8d2f08c9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -266,6 +266,9 @@ Avro 1.8.0 (15 December 2015) AVRO-1775. Ruby: Use test-unit gem for running tests. (martinkl) + AVRO-1783. Ruby: Ensure correct binary encoding for byte strings. + (martinkl) + Avro 1.7.7 (23 July 2014) NEW FEATURES diff --git a/lang/ruby/lib/avro/io.rb b/lang/ruby/lib/avro/io.rb index 9dc41db43ec..1c10c4abba6 100644 --- a/lang/ruby/lib/avro/io.rb +++ b/lang/ruby/lib/avro/io.rb @@ -209,7 +209,7 @@ def write_bytes(datum) # A string is encoded as a long followed by that many bytes of # UTF-8 encoded character data def write_string(datum) - # FIXME utf-8 encode this in 1.9 + datum = datum.encode('utf-8') if datum.respond_to? :encode write_bytes(datum) end diff --git a/lang/ruby/lib/avro/ipc.rb b/lang/ruby/lib/avro/ipc.rb index 1ac81294a72..03278225d45 100644 --- a/lang/ruby/lib/avro/ipc.rb +++ b/lang/ruby/lib/avro/ipc.rb @@ -100,7 +100,7 @@ def remote_hash=(new_remote_hash) def request(message_name, request_datum) # Writes a request message and reads a response or error message. # build handshake and call request - buffer_writer = StringIO.new('', 'w+') + buffer_writer = StringIO.new(''.force_encoding('BINARY')) buffer_encoder = Avro::IO::BinaryEncoder.new(buffer_writer) write_handshake_request(buffer_encoder) write_call_request(message_name, request_datum, buffer_encoder) @@ -244,7 +244,7 @@ def initialize(local_protocol) # a response or error. Compare to 'handle()' in Thrift. def respond(call_request, transport=nil) buffer_decoder = Avro::IO::BinaryDecoder.new(StringIO.new(call_request)) - buffer_writer = StringIO.new('', 'w+') + buffer_writer = StringIO.new(''.force_encoding('BINARY')) buffer_encoder = Avro::IO::BinaryEncoder.new(buffer_writer) error = nil response_metadata = {} @@ -294,6 +294,7 @@ def respond(call_request, transport=nil) end rescue Avro::AvroError => e error = AvroRemoteException.new(e.to_s) + # TODO does the stuff written here ever get used? buffer_encoder = Avro::IO::BinaryEncoder.new(StringIO.new) META_WRITER.write(response_metadata, buffer_encoder) buffer_encoder.write_boolean(true) @@ -393,7 +394,7 @@ def transceive(request) def read_framed_message message = [] loop do - buffer = StringIO.new + buffer = StringIO.new(''.force_encoding('BINARY')) buffer_length = read_buffer_length if buffer_length == 0 return message.join @@ -410,7 +411,7 @@ def read_framed_message end def write_framed_message(message) - message_length = message.size + message_length = message.bytesize total_bytes_sent = 0 while message_length - total_bytes_sent > 0 if message_length - total_bytes_sent > BUFFER_SIZE @@ -426,7 +427,7 @@ def write_framed_message(message) end def write_buffer(chunk) - buffer_length = chunk.size + buffer_length = chunk.bytesize write_buffer_length(buffer_length) total_bytes_sent = 0 while total_bytes_sent < buffer_length @@ -467,7 +468,7 @@ def initialize(writer) end def write_framed_message(message) - message_size = message.size + message_size = message.bytesize total_bytes_sent = 0 while message_size - total_bytes_sent > 0 if message_size - total_bytes_sent > BUFFER_SIZE @@ -485,7 +486,7 @@ def to_s; writer.string; end private def write_buffer(chunk) - buffer_size = chunk.size + buffer_size = chunk.bytesize write_buffer_size(buffer_size) writer << chunk end @@ -505,13 +506,13 @@ def initialize(reader) def read_framed_message message = [] loop do - buffer = "" + buffer = ''.force_encoding('BINARY') buffer_size = read_buffer_size return message.join if buffer_size == 0 - while buffer.size < buffer_size - chunk = reader.read(buffer_size - buffer.size) + while buffer.bytesize < buffer_size + chunk = reader.read(buffer_size - buffer.bytesize) chunk_error?(chunk) buffer << chunk end @@ -541,7 +542,7 @@ def initialize(host, port) end def transceive(message) - writer = FramedWriter.new(StringIO.new) + writer = FramedWriter.new(StringIO.new(''.force_encoding('BINARY'))) writer.write_framed_message(message) resp = @conn.post('/', writer.to_s, {'Content-Type' => 'avro/binary'}) FramedReader.new(StringIO.new(resp.body)).read_framed_message diff --git a/lang/ruby/lib/avro/schema.rb b/lang/ruby/lib/avro/schema.rb index 87f6fa4804e..ba6067a79d6 100644 --- a/lang/ruby/lib/avro/schema.rb +++ b/lang/ruby/lib/avro/schema.rb @@ -108,7 +108,7 @@ def self.validate(expected_schema, datum) when :float, :double datum.is_a?(Float) || datum.is_a?(Fixnum) || datum.is_a?(Bignum) when :fixed - datum.is_a?(String) && datum.size == expected_schema.size + datum.is_a?(String) && datum.bytesize == expected_schema.size when :enum expected_schema.symbols.include? datum when :array diff --git a/lang/ruby/test/test_io.rb b/lang/ruby/test/test_io.rb index f8f3da13cb9..7dca327fb37 100644 --- a/lang/ruby/test/test_io.rb +++ b/lang/ruby/test/test_io.rb @@ -210,6 +210,51 @@ def test_binary_long_encoding end end + def test_utf8_string_encoding + [ + "\xC3".force_encoding('ISO-8859-1'), + "\xC3\x83".force_encoding('UTF-8') + ].each do |value| + output = ''.force_encoding('BINARY') + encoder = Avro::IO::BinaryEncoder.new(StringIO.new(output)) + datum_writer = Avro::IO::DatumWriter.new(Avro::Schema.parse('"string"')) + datum_writer.write(value, encoder) + + assert_equal "\x04\xc3\x83".force_encoding('BINARY'), output + end + end + + def test_bytes_encoding + [ + "\xC3\x83".force_encoding('BINARY'), + "\xC3\x83".force_encoding('ISO-8859-1'), + "\xC3\x83".force_encoding('UTF-8') + ].each do |value| + output = ''.force_encoding('BINARY') + encoder = Avro::IO::BinaryEncoder.new(StringIO.new(output)) + datum_writer = Avro::IO::DatumWriter.new(Avro::Schema.parse('"bytes"')) + datum_writer.write(value, encoder) + + assert_equal "\x04\xc3\x83".force_encoding('BINARY'), output + end + end + + def test_fixed_encoding + [ + "\xC3\x83".force_encoding('BINARY'), + "\xC3\x83".force_encoding('ISO-8859-1'), + "\xC3\x83".force_encoding('UTF-8') + ].each do |value| + output = ''.force_encoding('BINARY') + encoder = Avro::IO::BinaryEncoder.new(StringIO.new(output)) + schema = '{"type": "fixed", "name": "TwoBytes", "size": 2}' + datum_writer = Avro::IO::DatumWriter.new(Avro::Schema.parse(schema)) + datum_writer.write(value, encoder) + + assert_equal "\xc3\x83".force_encoding('BINARY'), output + end + end + def test_skip_long for value_to_skip, hex_encoding in BINARY_INT_ENCODINGS value_to_read = 6253 From f896e3381ed648eeca4b90930659e3855d5a097a Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 22 Jan 2016 12:25:38 +0000 Subject: [PATCH 030/116] Update date for 1.8.0 release. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1726192 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 37f8d2f08c9..0d27f60676a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,7 +1,7 @@ Avro Change Log -Avro 1.8.0 (15 December 2015) +Avro 1.8.0 (22 January 2016) INCOMPATIBLE CHANGES From 85c9b5f628d16da82e84cfd89c68bbe8942f2ca5 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 22 Jan 2016 13:34:33 +0000 Subject: [PATCH 031/116] Skip javadoc for avro-guava-dependencies. git-svn-id: https://svn.apache.org/repos/asf/avro/branches/branch-1.8@1726207 13f79535-47bb-0310-9956-ffa450edef68 --- lang/java/guava/pom.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lang/java/guava/pom.xml b/lang/java/guava/pom.xml index 33595636a9f..b5717851390 100644 --- a/lang/java/guava/pom.xml +++ b/lang/java/guava/pom.xml @@ -36,6 +36,13 @@ + + org.apache.maven.plugins + maven-javadoc-plugin + + true + + org.apache.maven.plugins maven-shade-plugin From 8a3960ab1cdd9d575a7f5863f8e85f8bebd0419d Mon Sep 17 00:00:00 2001 From: Matthieu Monsch Date: Sat, 6 Feb 2016 09:58:42 -0800 Subject: [PATCH 032/116] AVRO-1793. Python2: Retain original exception on schema parsing failure. Contributed by Jakob Homan (jghoman). Previously, when a parse call failed the original exception was swallowed and replaced by a generic SchemaParseException. The original stack trace is not retained along with the actual exception message. --- CHANGES.txt | 14 ++++++++++++++ lang/py/src/avro/schema.py | 9 +++++---- lang/py/test/test_schema.py | 14 ++++++++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 0d27f60676a..fa0a9fa0402 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,19 @@ Avro Change Log +Trunk (not yet released) + + INCOMPATIBLE CHANGES + + NEW FEATURES + + OPTIMIZATIONS + + IMPROVEMENTS + + AVRO-1793. Python2: Retain stack trace and original exception when failing + to parse schemas. Contributed by Jakob Homan (jghoman). + + BUG FIXES Avro 1.8.0 (22 January 2016) diff --git a/lang/py/src/avro/schema.py b/lang/py/src/avro/schema.py index f946d0a966e..6a7fbbb8c8b 100644 --- a/lang/py/src/avro/schema.py +++ b/lang/py/src/avro/schema.py @@ -443,7 +443,7 @@ def __init__(self, name, namespace, symbols, names=None, doc=None, other_props=N fail_msg = 'Enum Schema requires a JSON array for the symbols property.' raise AvroException(fail_msg) elif False in [isinstance(s, basestring) for s in symbols]: - fail_msg = 'Enum Schems requires All symbols to be JSON strings.' + fail_msg = 'Enum Schema requires all symbols to be JSON strings.' raise AvroException(fail_msg) elif len(set(symbols)) < len(symbols): fail_msg = 'Duplicate symbol: %s' % symbols @@ -770,12 +770,13 @@ def make_avsc_object(json_data, names=None): # TODO(hammer): make method for reading from a file? def parse(json_string): """Constructs the Schema from the JSON text.""" - # TODO(hammer): preserve stack trace from JSON parse # parse the JSON try: json_data = json.loads(json_string) - except: - raise SchemaParseException('Error parsing JSON: %s' % json_string) + except Exception, e: + import sys + raise SchemaParseException('Error parsing JSON: %s, error = %s' + % (json_string, e)), None, sys.exc_info()[2] # Initialize the names object names = Names() diff --git a/lang/py/test/test_schema.py b/lang/py/test/test_schema.py index 204d1b1bf95..00e2a05de81 100644 --- a/lang/py/test/test_schema.py +++ b/lang/py/test/test_schema.py @@ -477,5 +477,19 @@ def test_other_attributes(self): self.assertEqual(type(v), list) self.assertEqual(correct,len(OTHER_PROP_EXAMPLES)) + def test_exception_is_not_swallowed_on_parse_error(self): + print_test_name('TEST EXCEPTION NOT SWALLOWED ON PARSE ERROR') + + try: + schema.parse('/not/a/real/file') + caught_exception = False + except schema.SchemaParseException, e: + expected_message = 'Error parsing JSON: /not/a/real/file, error = ' \ + 'No JSON object could be decoded' + self.assertEqual(expected_message, e.args[0]) + caught_exception = True + + self.assertTrue(caught_exception, 'Exception was not caught') + if __name__ == '__main__': unittest.main() From 133fafacdd6e39d68d14e2f903e2a49c6d6aad16 Mon Sep 17 00:00:00 2001 From: Matthieu Monsch Date: Sat, 6 Feb 2016 10:48:34 -0800 Subject: [PATCH 033/116] AVRO-1778. JavaScript: Add IPC/RPC support. This commit adds protocols to the JavaScript implementation. The API was designed to: + Be simple and idiomatic. The `Protocol` class added here is heavily inspired by node.js' core `EventEmitter` to keep things as familiar as possible. Getting a client and server working is straightforward and requires very few lines of code. + Support arbitrary transports, both stateful and stateless. Built-in node.js streams are supported out of the box (e.g. TCP/UNIX sockets, or even stdin/stdout). Exchanging messages over a custom transport requires implementing a single simple function. + Work both server-side and in the browser! --- CHANGES.txt | 2 + lang/js/build.sh | 2 +- lang/js/doc/API.md | 189 +++++ lang/js/doc/Advanced-usage.md | 124 +++ lang/js/lib/files.js | 8 +- lang/js/lib/index.js | 3 + lang/js/lib/protocols.js | 1271 +++++++++++++++++++++++++++++ lang/js/lib/schemas.js | 62 +- lang/js/lib/utils.js | 24 + lang/js/package.json | 5 +- lang/js/test/mocha.opts | 2 + lang/js/test/test_files.js | 8 +- lang/js/test/test_protocols.js | 1392 ++++++++++++++++++++++++++++++++ lang/js/test/test_schemas.js | 11 + 14 files changed, 3073 insertions(+), 30 deletions(-) create mode 100644 lang/js/lib/protocols.js create mode 100644 lang/js/test/mocha.opts create mode 100644 lang/js/test/test_protocols.js diff --git a/CHANGES.txt b/CHANGES.txt index fa0a9fa0402..aa84b9ece5c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -13,6 +13,8 @@ Trunk (not yet released) AVRO-1793. Python2: Retain stack trace and original exception when failing to parse schemas. Contributed by Jakob Homan (jghoman). + AVRO-1778: JavaScript: Add IPC/RPC support. (mtth) + BUG FIXES Avro 1.8.0 (22 January 2016) diff --git a/lang/js/build.sh b/lang/js/build.sh index c551f9dac11..08823fcba42 100755 --- a/lang/js/build.sh +++ b/lang/js/build.sh @@ -22,7 +22,7 @@ cd `dirname "$0"` case "$1" in test) npm install - npm test + npm run cover ;; dist) npm pack diff --git a/lang/js/doc/API.md b/lang/js/doc/API.md index a6dd63e5204..2639ea1d353 100644 --- a/lang/js/doc/API.md +++ b/lang/js/doc/API.md @@ -21,6 +21,7 @@ limitations under the License. + [Avro types](#avro-types) + [Records](#records) + [Files and streams](#files-and-streams) ++ [IPC & RPC](#ipc--rpc) ## Parsing schemas @@ -758,9 +759,197 @@ The encoding equivalent of `RawDecoder`. + `data` {Buffer} Serialized bytes. +# IPC & RPC + +Avro also defines a way of executing remote procedure calls. We expose this via +an API modeled after node.js' core [`EventEmitter`][event-emitter]. + +#### Class `Protocol` + +`Protocol` instances are obtained by [`parse`](#parseschema-opts)-ing a +[protocol declaration][protocol-declaration] and provide a way of sending +remote messages (for example to another machine, or another process on the same +machine). For this reason, instances of this class are very similar to +`EventEmitter`s, exposing both [`emit`](#protocolemitname-req-emitter-cb) and +[`on`](#protocolonname-handler) methods. + +Being able to send remote messages (and to do so efficiently) introduces a few +differences however: + ++ The types used in each event (for both the emitted message and its response) + must be defined upfront in the protocol's declaration. ++ The arguments emitted with each event must match the ones defined in the + protocol. Similarly, handlers are guaranteed to be called only with these + matching arguments. ++ Events are one-to-one: they have exactly one response (unless they are + declared as one-way, in which case they have none). + +##### `protocol.emit(name, req, emitter, cb)` + ++ `name` {String} Name of the message to emit. If this message is sent to a + `Protocol` instance with no handler defined for this name, an "unsupported + message" error will be returned. ++ `req` {Object} Request value, must correspond to the message's declared + request type. ++ `emitter` {MessageEmitter} Emitter used to send the message. See + [`createEmitter`](#protocolcreateemittertransport-opts-cb) for how to obtain + one. ++ `cb(err, res)` {Function} Function called with the remote call's response + (and eventual error) when available. This can be omitted when the message is + one way. + +Send a message. This is always done asynchronously. + +##### `protocol.on(name, handler)` + ++ `name` {String} Message name to add the handler for. An error will be thrown + if this name isn't defined in the protocol. At most one handler can exist for + a given name (any previously defined handler will be overwritten). ++ `handler(req, listener, cb)` {Function} Handler, called each time a message + with matching name is received. The `listener` argument will be the + corresponding `MessageListener` instance. The final callback argument + `cb(err, res)` should be called to send the response back to the emitter + (except when the message is one way, in which case `cb` will be `undefined`). + +Add a handler for a given message. + +##### `protocol.createEmitter(transport, [opts,] [cb])` + ++ `transport` {Duplex|Object|Function} The transport used to communicate with + the remote listener. Multiple argument types are supported, see below. ++ `opts` {Object} Options. + + `IdType` {LogicalType} Metadata logical type. + + `bufferSize` {Number} Internal serialization buffer size (in bytes). + Defaults to 2048. + + `frameSize` {Number} Size used when [framing messages][framing-messages]. + Defaults to 2048. ++ `cb(pending)` {Function} End of transmission callback. + +Generate a [`MessageEmitter`](#class-messageemitter) for this protocol. This +emitter can then be used to communicate with a remote server of compatible +protocol. + +There are two major types of transports: + ++ Stateful + + A pair of binary streams `{readable, writable}`. + + As a convenience passing a single duplex stream is also supported and + equivalent to passing `{readable: duplex, writable: duplex}`. + ++ Stateless + + Stream factory `fn(cb)` which should return a writable stream and call its + callback argument with a readable stream (when available). + +##### `protocol.createListener(transport, [opts,] [cb])` + ++ `transport` {Duplex|Object|Function} Similar to [`createEmitter`](#)'s + corresponding argument, except that readable and writable roles are reversed + for stateless transports. ++ `opts` {Object} Identical to `createEmitter`'s options. + + `IdType` {LogicalType} Metadata logical type. + + `bufferSize` {Number} Internal serialization buffer size (in bytes). + Defaults to 2048. + + `frameSize` {Number} Size used when [framing messages][framing-messages]. + Defaults to 2048. ++ `cb(pending)` {Function} End of transmission callback. + +Generate a [`MessageListener`](#class-messagelistener) for this protocol. This +listener can be used to respond to messages emitted from compatible protocols. + +##### `protocol.subprotocol()` + +Returns a copy of the original protocol, which inherits all its handlers. + +##### `protocol.getMessages()` + +Retrieve all the messages defined in the protocol. Each message is an object +with the following (read-only) properties: + ++ `name` {String} ++ `requestType` {Type} ++ `responseType` {Type} ++ `errorType` {Type} ++ `oneWay` {Boolean} + +##### `protocol.getName()` + +Returns the protocol's fully qualified name. + +##### `protocol.getType(name)` + ++ `name` {String} A type's fully qualified name. + +Convenience function to retrieve a type defined inside this protocol. Returns +`undefined` if no type exists for the given name. + + +#### Class `MessageEmitter` + +Instance of this class are [`EventEmitter`s][event-emitter], with the following +events: + +##### Event `'handshake'` + ++ `request` {Object} Handshake request. ++ `response` {Object} Handshake response. + +Emitted when the server's handshake response is received. + +##### Event `'eot'` + ++ `pending` {Number} Number of interrupted requests. This will always be zero, + unless the emitter was destroyed with `noWait` set. + +End of transmission event, emitted after the client is destroyed and there are +no more pending requests. + +##### `emitter.destroy([noWait])` + ++ `noWait` {Boolean} Cancel any pending requests. By default pending requests + will still be honored. + +Disable the emitter. + + +#### Class `MessageListener` + +Listeners are the receiving-side equivalent of `MessageEmitter`s and are also +[`EventEmitter`s][event-emitter], with the following events: + +##### Event `'handshake'` + ++ `request` {Object} Handshake request. ++ `response` {Object} Handshake response. + +Emitted right before the server sends a handshake response. + +##### Event `'eot'` + ++ `pending` {Number} Number of cancelled pending responses. This will always be + zero, unless the listener was destroyed with `noWait` set. + +End of transmission event, emitted after the listener is destroyed and there are +no more responses to send. + +##### `listener.destroy([noWait])` + ++ `noWait` {Boolean} Don't wait for all pending responses to have been sent. + +Disable this listener and release underlying streams. In general you shouldn't +need to call this: stateless listeners will be destroyed automatically when a +response is sent, and stateful listeners are best destroyed from the client's +side. + + [canonical-schema]: https://avro.apache.org/docs/current/spec.html#Parsing+Canonical+Form+for+Schemas [schema-resolution]: https://avro.apache.org/docs/current/spec.html#Schema+Resolution [sort-order]: https://avro.apache.org/docs/current/spec.html#order [fingerprint]: https://avro.apache.org/docs/current/spec.html#Schema+Fingerprints [custom-long]: Advanced-usage#custom-long-types [logical-types]: Advanced-usage#logical-types +[framing-messages]: https://avro.apache.org/docs/current/spec.html#Message+Framing +[event-emitter]: https://nodejs.org/api/events.html#events_class_events_eventemitter +[protocol-declaration]: https://avro.apache.org/docs/current/spec.html#Protocol+Declaration diff --git a/lang/js/doc/Advanced-usage.md b/lang/js/doc/Advanced-usage.md index 23cab5fab77..4344bb4aa35 100644 --- a/lang/js/doc/Advanced-usage.md +++ b/lang/js/doc/Advanced-usage.md @@ -20,6 +20,7 @@ limitations under the License. + [Schema evolution](#schema-evolution) + [Logical types](#logical-types) + [Custom long types](#custom-long-types) ++ [Remote procedure calls](#remote-procedure-calls) ## Schema evolution @@ -352,8 +353,131 @@ and unpacking routine (for example when using a native C++ addon), we can disable this behavior by setting `LongType.using`'s `noUnpack` argument to `true`. + +# Remote procedure calls + +`avro-js` provides an efficient and "type-safe" API for communicating with +remote node processes via [`Protocol`s](Api#class-protocol). + +To enable this, we first declare the types involved inside an [Avro +protocol][protocol-declaration]. For example, consider the following simple +protocol which supports two calls (saved as `./math.avpr`): + +```json +{ + "protocol": "Math", + "doc": "A sample interface for performing math.", + "messages": { + "multiply": { + "doc": "A call for multiplying doubles.", + "request": [ + {"name": "numbers", "type": {"type": "array", "items": "double"}} + ], + "response": "double" + }, + "add": { + "doc": "A call which adds integers, optionally after some delay.", + "request": [ + {"name": "numbers", "type": {"type": "array", "items": "int"}}, + {"name": "delay", "type": "float", "default": 0} + ], + "response": "int" + } + } +} +``` + +Servers and clients then share the same protocol and respectively: + ++ Implement interface calls (servers): + + ```javascript + var protocol = avro.parse('./math.avpr') + .on('add', function (req, ee, cb) { + var sum = req.numbers.reduce(function (agg, el) { return agg + el; }, 0); + setTimeout(function () { cb(null, sum); }, 1000 * req.delay); + }) + .on('multiply', function (req, ee, cb) { + var prod = req.numbers.reduce(function (agg, el) { return agg * el; }, 1); + cb(null, prod); + }); + ``` + ++ Call the interface (clients): + + ```javascript + var protocol = avro.parse('./math.avpr'); + var ee; // Message emitter, see below for various instantiation examples. + + protocol.emit('add', {numbers: [1, 3, 5], delay: 2}, ee, function (err, res) { + console.log(res); // 9! + }); + protocol.emit('multiply', {numbers: [4, 2]}, ee, function (err, res) { + console.log(res); // 8! + }); + ``` + +`avro-js` supports communication between any two node processes connected by +binary streams. See below for a few different common use-cases. + +## Persistent streams + +E.g. UNIX sockets, TCP sockets, WebSockets, (and even stdin/stdout). + +### Client + +```javascript +var net = require('net'); + +var ee = protocol.createEmitter(net.createConnection({port: 8000})); +``` + +### Server + +```javascript +var net = require('net'); + +net.createServer() + .on('connection', function (con) { protocol.createListener(con); }) + .listen(8000); +``` + +## Transient streams + +For example HTTP requests/responses. + +### Client + +```javascript +var http = require('http'); + +var ee = protocol.createEmitter(function (cb) { + return http.request({ + port: 3000, + headers: {'content-type': 'avro/binary'}, + method: 'POST' + }).on('response', function (res) { cb(res); }); +}); +``` + +### Server + +Using [express][] for example: + +```javascript +var app = require('express')(); + +app.post('/', function (req, res) { + protocol.createListener(function (cb) { cb(res); return req; }); +}); + +app.listen(3000); +``` + + [parse-api]: API#parseschema-opts [create-resolver-api]: API#typecreateresolverwritertype [logical-type-api]: API#class-logicaltypeattrs-opts-types [decimal-type]: https://avro.apache.org/docs/current/spec.html#Decimal [schema-resolution]: https://avro.apache.org/docs/current/spec.html#Schema+Resolution +[protocol-declaration]: https://avro.apache.org/docs/current/spec.html#Protocol+Declaration diff --git a/lang/js/lib/files.js b/lang/js/lib/files.js index b9c6da0a645..c96da686fb2 100644 --- a/lang/js/lib/files.js +++ b/lang/js/lib/files.js @@ -21,7 +21,8 @@ 'use strict'; -var schemas = require('./schemas'), +var protocols = require('./protocols'), + schemas = require('./schemas'), utils = require('./utils'), fs = require('fs'), stream = require('stream'), @@ -66,7 +67,10 @@ var Tap = utils.Tap; * */ function parse(schema, opts) { - return schemas.createType(loadSchema(schema), opts); + var attrs = loadSchema(schema); + return attrs.protocol ? + protocols.createProtocol(attrs, opts) : + schemas.createType(attrs, opts); } diff --git a/lang/js/lib/index.js b/lang/js/lib/index.js index 0eab2ad74e4..666dd5671bb 100644 --- a/lang/js/lib/index.js +++ b/lang/js/lib/index.js @@ -29,11 +29,14 @@ */ var files = require('./files'), + protocols = require('./protocols'), schemas = require('./schemas'), deprecated = require('../etc/deprecated/validator'); module.exports = { + Type: schemas.Type, + Protocol: protocols.Protocol, parse: files.parse, createFileDecoder: files.createFileDecoder, createFileEncoder: files.createFileEncoder, diff --git a/lang/js/lib/protocols.js b/lang/js/lib/protocols.js new file mode 100644 index 00000000000..6344f4789d0 --- /dev/null +++ b/lang/js/lib/protocols.js @@ -0,0 +1,1271 @@ +/* jshint node: true */ + +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +'use strict'; + +/** + * This module implements Avro's IPC/RPC logic. + * + * This is done the Node.js way, mimicking the `EventEmitter` class. + * + */ + +var schemas = require('./schemas'), + utils = require('./utils'), + events = require('events'), + stream = require('stream'), + util = require('util'); + + +var BOOLEAN_TYPE = schemas.createType('boolean'); +var STRING_TYPE = schemas.createType('string'); +var SYSTEM_ERROR_TYPE = schemas.createType(['string']); + +var HANDSHAKE_REQUEST_TYPE = schemas.createType({ + namespace: 'org.apache.avro.ipc', + name: 'HandshakeRequest', + type: 'record', + fields: [ + {name: 'clientHash', type: {name: 'MD5', type: 'fixed', size: 16}}, + {name: 'clientProtocol', type: ['null', 'string'], 'default': null}, + {name: 'serverHash', type: 'org.apache.avro.ipc.MD5'}, + { + name: 'meta', + type: ['null', {type: 'map', values: 'bytes'}], + 'default': null + } + ] +}); + +var HANDSHAKE_RESPONSE_TYPE = schemas.createType({ + namespace: 'org.apache.avro.ipc', + name: 'HandshakeResponse', + type: 'record', + fields: [ + { + name: 'match', + type: { + name: 'HandshakeMatch', + type: 'enum', + symbols: ['BOTH', 'CLIENT', 'NONE'] + } + }, + {name: 'serverProtocol', type: ['null', 'string'], 'default': null}, + { + name: 'serverHash', + type: ['null', {name: 'MD5', type: 'fixed', size: 16}], + 'default': null + }, + { + name: 'meta', + type: ['null', {type: 'map', values: 'bytes'}], + 'default': null + } + ] +}); + +var HandshakeRequest = HANDSHAKE_REQUEST_TYPE.getRecordConstructor(); +var HandshakeResponse = HANDSHAKE_RESPONSE_TYPE.getRecordConstructor(); +var Tap = utils.Tap; +var f = util.format; + + +/** + * Protocol generation function. + * + * This should be used instead of the protocol constructor. The protocol's + * constructor performs no logic to better support efficient protocol copy. + * + */ +function createProtocol(attrs, opts) { + opts = opts || {}; + + var name = attrs.protocol; + if (!name) { + throw new Error('missing protocol name'); + } + opts.namespace = attrs.namespace; + if (opts.namespace && !~name.indexOf('.')) { + name = f('%s.%s', opts.namespace, name); + } + + if (attrs.types) { + attrs.types.forEach(function (obj) { schemas.createType(obj, opts); }); + } + var messages = {}; + if (attrs.messages) { + Object.keys(attrs.messages).forEach(function (key) { + messages[key] = new Message(key, attrs.messages[key], opts); + }); + } + + return new Protocol(name, messages, opts.registry || {}); +} + +/** + * An Avro protocol. + * + * It contains a cache for all remote protocols encountered by its emitters and + * listeners. Note that a protocol can be listening to multiple listeners at a + * given time. This can be a mix of stateful or stateless listeners. + * + */ +function Protocol(name, messages, types, ptcl) { + this._name = name; + this._messages = messages; + this._types = types; + this._parent = ptcl; + + // Cache a string instead of the buffer to avoid retaining an entire slab. + this._hashString = utils.getHash(this.toString()).toString('binary'); + + // Listener callbacks. Note the prototype used for handlers when this is a + // subprotocol. This lets us easily implement the desired fallback behavior. + var self = this; + this._handlers = Object.create(ptcl ? ptcl._handlers : null); + this._onListenerCall = function (name, req, cb) { + var handler = self._handlers[name]; + if (!handler) { + cb(new Error(f('unsupported message: %s', name))); + } else { + handler.call(self, req, this, cb); + } + }; + + // Resolvers are split since we want emitters to still be able to talk to + // servers with more messages (which would be incompatible the other way). + this._emitterResolvers = ptcl ? ptcl._emitterResolvers : {}; + this._listenerResolvers = ptcl ? ptcl._listenerResolvers : {}; +} + +Protocol.prototype.subprotocol = function () { + return new Protocol(this._name, this._messages, this._types, this); +}; + +Protocol.prototype.emit = function (name, req, emitter, cb) { + cb = cb || throwError; // To provide a more helpful error message. + + if ( + !(emitter instanceof MessageEmitter) || + emitter._ptcl._hashString !== this._hashString + ) { + asyncAvroCb(this, cb, 'invalid emitter'); + return; + } + + var message = this._messages[name]; + if (!message) { + asyncAvroCb(this, cb, f('unknown message: %s', name)); + return; + } + + emitter._emit(message, req, cb); +}; + +Protocol.prototype.createEmitter = function (transport, opts, cb) { + if (!cb && typeof opts == 'function') { + cb = opts; + opts = undefined; + } + + var emitter; + if (typeof transport == 'function') { + emitter = new StatelessEmitter(this, transport, opts); + } else { + var readable, writable; + if (isStream(transport)) { + readable = writable = transport; + } else { + readable = transport.readable; + writable = transport.writable; + } + emitter = new StatefulEmitter(this, readable, writable, opts); + } + if (cb) { + emitter.once('eot', cb); + } + return emitter; +}; + +Protocol.prototype.on = function (name, handler) { + if (!this._messages[name]) { + throw new Error(f('unknown message: %s', name)); + } + this._handlers[name] = handler; + return this; +}; + +Protocol.prototype.createListener = function (transport, opts, cb) { + if (!cb && typeof opts == 'function') { + cb = opts; + opts = undefined; + } + + var listener; + if (typeof transport == 'function') { + listener = new StatelessListener(this, transport, opts); + } else { + var readable, writable; + if (isStream(transport)) { + readable = writable = transport; + } else { + readable = transport.readable; + writable = transport.writable; + } + listener = new StatefulListener(this, readable, writable, opts); + } + if (cb) { + listener.once('eot', cb); + } + return listener.on('_call', this._onListenerCall); +}; + +Protocol.prototype.getType = function (name) { return this._types[name]; }; + +Protocol.prototype.getName = function () { return this._name; }; + +Protocol.prototype.getMessages = function () { return this._messages; }; + +Protocol.prototype.toString = function () { + var namedTypes = []; + Object.keys(this._types).forEach(function (name) { + var type = this._types[name]; + if (type.getName()) { + namedTypes.push(type); + } + }, this); + + return schemas.stringify({ + protocol: this._name, + types: namedTypes.length ? namedTypes : undefined, + messages: this._messages + }); +}; + +Protocol.prototype.inspect = function () { + return f('', this._name); +}; + +/** + * Base message emitter class. + * + * See below for the two available variants. + * + */ +function MessageEmitter(ptcl, opts) { + events.EventEmitter.call(this); + + this._ptcl = ptcl; + this._resolvers = ptcl._emitterResolvers; + this._serverHashString = ptcl._hashString; + this._idType = IdType.createMetadataType(opts.IdType); + this._bufferSize = opts.bufferSize || 2048; + this._frameSize = opts.frameSize || 2048; + + this.once('_eot', function (pending) { this.emit('eot', pending); }); +} +util.inherits(MessageEmitter, events.EventEmitter); + +MessageEmitter.prototype._generateResolvers = function ( + hashString, serverPtcl +) { + var resolvers = {}; + var emitterMessages = this._ptcl._messages; + var serverMessages = serverPtcl._messages; + Object.keys(emitterMessages).forEach(function (name) { + var cm = emitterMessages[name]; + var sm = serverMessages[name]; + if (!sm) { + throw new Error(f('missing server message: %s', name)); + } + resolvers[name] = { + responseType: cm.responseType.createResolver(sm.responseType), + errorType: cm.errorType.createResolver(sm.errorType) + }; + }); + this._resolvers[hashString] = resolvers; +}; + +MessageEmitter.prototype._createHandshakeRequest = function ( + hashString, noPtcl +) { + return new HandshakeRequest( + getHash(this._ptcl), + noPtcl ? null : {string: this._ptcl.toString()}, + new Buffer(hashString, 'binary') + ); +}; + +MessageEmitter.prototype._finalizeHandshake = function (tap, handshakeReq) { + var res = HANDSHAKE_RESPONSE_TYPE._read(tap); + this.emit('handshake', handshakeReq, res); + + if (handshakeReq.clientProtocol && res.match === 'NONE') { + // If the emitter's protocol was included in the original request, this is + // not a failure which a retry will fix. + var buf = res.meta && res.meta.map.error; + throw new Error(buf ? buf.toString() : 'handshake error'); + } + + var hashString; + if (res.serverHash && res.serverProtocol) { + // This means the request didn't include the correct server hash. Note that + // we use the handshake response's hash rather than our computed one in + // case the server computes it differently. + hashString = res.serverHash['org.apache.avro.ipc.MD5'].toString('binary'); + if (!canResolve(this, hashString)) { + this._generateResolvers( + hashString, + createProtocol(JSON.parse(res.serverProtocol.string)) + ); + } + // Make this hash the new default. + this._serverHashString = hashString; + } else { + hashString = handshakeReq.serverHash.toString('binary'); + } + + // We return the server's hash for stateless emitters. It might be that the + // default hash changes in between requests, in which case using the default + // one will fail. + return {match: res.match, serverHashString: hashString}; +}; + +MessageEmitter.prototype._encodeRequest = function (tap, message, req) { + safeWrite(tap, STRING_TYPE, message.name); + safeWrite(tap, message.requestType, req); +}; + +MessageEmitter.prototype._decodeArguments = function ( + tap, hashString, message +) { + var resolvers = getResolvers(this, hashString, message); + var args = [null, null]; + if (tap.readBoolean()) { + args[0] = resolvers.errorType._read(tap); + } else { + args[1] = resolvers.responseType._read(tap); + } + if (!tap.isValid()) { + throw new Error('truncated message'); + } + return args; +}; + +/** + * Factory-based emitter. + * + * This emitter doesn't keep a persistent connection to the server and requires + * prepending a handshake to each message emitted. Usage examples include + * talking to an HTTP server (where the factory returns an HTTP request). + * + * Since each message will use its own writable/readable stream pair, the + * advantage of this emitter is that it is able to keep track of which response + * corresponds to each request without relying on messages' metadata. In + * particular, this means these emitters are compatible with any server + * implementation. + * + */ +function StatelessEmitter(ptcl, writableFactory, opts) { + opts = opts || {}; + MessageEmitter.call(this, ptcl, opts); + + this._writableFactory = writableFactory; + this._id = 1; + this._pending = {}; + this._destroyed = false; + this._interrupted = false; +} +util.inherits(StatelessEmitter, MessageEmitter); + +StatelessEmitter.prototype._emit = function (message, req, cb) { + // We enclose the server's hash inside this message's closure since the + // emitter might be emitting several message concurrently and the hash might + // change before the response returns (unlikely but possible if the emitter + // talks to multiple servers at once or the server changes protocol). + var serverHashString = this._serverHashString; + var id = this._id++; + var self = this; + + this._pending[id] = cb; + if (this._destroyed) { + asyncAvroCb(undefined, done, 'emitter destroyed'); + return; + } + emit(false); + + function emit(retry) { + var tap = new Tap(new Buffer(self._bufferSize)); + + var handshakeReq = self._createHandshakeRequest(serverHashString, !retry); + safeWrite(tap, HANDSHAKE_REQUEST_TYPE, handshakeReq); + try { + safeWrite(tap, self._idType, id); + self._encodeRequest(tap, message, req); + } catch (err) { + asyncAvroCb(undefined, done, err); + return; + } + + var writable = self._writableFactory(function onReadable(readable) { + if (self._interrupted) { + // In case this function is called asynchronously (e.g. when sending + // HTTP requests), it might be that we have ended since. + return; + } + + readable + .pipe(new MessageDecoder(true)) + .on('error', done) + // This will happen when the readable stream ends before a single + // message has been decoded (e.g. on invalid response). + .on('data', function (buf) { + readable.unpipe(this); // Single message per readable stream. + if (self._interrupted) { + return; + } + + var tap = new Tap(buf); + try { + var info = self._finalizeHandshake(tap, handshakeReq); + serverHashString = info.serverHashString; + if (info.match === 'NONE') { + emit(true); // Retry, attaching emitter protocol this time. + return; + } + self._idType._read(tap); // Skip metadata. + var args = self._decodeArguments(tap, serverHashString, message); + } catch (err) { + done(err); + return; + } + done.apply(undefined, args); + }); + }); + + var encoder = new MessageEncoder(self._frameSize); + encoder.pipe(writable); + encoder.end(tap.getValue()); + } + + function done(err, res) { + var cb = self._pending[id]; + delete self._pending[id]; + cb.call(self._ptcl, err, res); + if (self._destroyed) { + self.destroy(); + } + } +}; + +StatelessEmitter.prototype.destroy = function (noWait) { + this._destroyed = true; + + var pendingIds = Object.keys(this._pending); + if (noWait) { + this._interrupted = true; + pendingIds.forEach(function (id) { + this._pending[id]({string: 'interrupted'}); + delete this._pending[id]; + }, this); + } + + if (noWait || !pendingIds.length) { + this.emit('_eot', pendingIds.length); + } +}; + +/** + * Multiplexing emitter. + * + * These emitters reuse the same streams (both readable and writable) for all + * messages. This avoids a lot of overhead (e.g. creating new connections, + * re-issuing handshakes) but requires the server to include compatible + * metadata in each response (namely forwarding each request's ID into its + * response). + * + * A custom metadata format can be specified via the `idType` option. The + * default is compatible with this package's default server (i.e. listener) + * implementation. + * + */ +function StatefulEmitter(ptcl, readable, writable, opts) { + opts = opts || {}; + MessageEmitter.call(this, ptcl, opts); + + this._readable = readable; + this._writable = writable; + this._id = 1; + this._pending = {}; + this._started = false; + this._destroyed = false; + this._ended = false; // Readable input ended. + this._decoder = new MessageDecoder(); + this._encoder = new MessageEncoder(this._frameSize); + + var handshakeReq = null; + var self = this; + + process.nextTick(function () { + self._readable.pipe(self._decoder) + .on('error', function (err) { self.emit('error', err); }) + .on('data', onHandshakeData) + .on('end', function () { + self._ended = true; + self.destroy(); + }); + + self._encoder.pipe(self._writable); + emitHandshake(true); + }); + + function emitHandshake(noPtcl) { + handshakeReq = self._createHandshakeRequest( + self._serverHashString, + noPtcl + ); + self._encoder.write(handshakeReq.$toBuffer()); + } + + function onHandshakeData(buf) { + var tap = new Tap(buf); + try { + var info = self._finalizeHandshake(tap, handshakeReq); + } catch (err) { + self.emit('error', err); + self.destroy(); // This isn't a recoverable error. + return; + } + + if (info.match !== 'NONE') { + self._decoder + .removeListener('data', onHandshakeData) + .on('data', onMessageData); + self._started = true; + self.emit('_start'); // Send any pending messages. + } else { + emitHandshake(false); + } + } + + function onMessageData(buf) { + var tap = new Tap(buf); + try { + var id = self._idType._read(tap); + if (!id) { + throw new Error('missing ID'); + } + } catch (err) { + self.emit('error', new Error('invalid metadata: ' + err.message)); + return; + } + + var info = self._pending[id]; + if (info === undefined) { + self.emit('error', new Error('orphan response: ' + id)); + return; + } + + try { + var args = self._decodeArguments( + tap, + self._serverHashString, + info.message + ); + } catch (err) { + info.cb({string: 'invalid response: ' + err.message}); + return; + } + delete self._pending[id]; + info.cb.apply(self._ptcl, args); + if (self._destroyed) { + self.destroy(); + } + } +} +util.inherits(StatefulEmitter, MessageEmitter); + +StatefulEmitter.prototype._emit = function (message, req, cb) { + if (this._destroyed) { + asyncAvroCb(this._ptcl, cb, 'emitter destroyed'); + return; + } + + var self = this; + if (!this._started) { + this.once('_start', function () { self._emit(message, req, cb); }); + return; + } + + var tap = new Tap(new Buffer(this._bufferSize)); + var id = this._id++; + try { + safeWrite(tap, this._idType, -id); + this._encodeRequest(tap, message, req); + } catch (err) { + asyncAvroCb(this._ptcl, cb, err); + return; + } + + if (!message.oneWay) { + this._pending[id] = {message: message, cb: cb}; + } + this._encoder.write(tap.getValue()); +}; + +StatefulEmitter.prototype.destroy = function (noWait) { + this._destroyed = true; + if (!this._started) { + this.emit('_start'); // Error out any pending calls. + } + + var pendingIds = Object.keys(this._pending); + if (pendingIds.length && !(noWait || this._ended)) { + return; // Wait for pending requests. + } + pendingIds.forEach(function (id) { + var cb = this._pending[id].cb; + delete this._pending[id]; + cb({string: 'interrupted'}); + }, this); + + this._readable.unpipe(this._decoder); + this._encoder.unpipe(this._writable); + this.emit('_eot', pendingIds.length); +}; + +/** + * The server-side emitter equivalent. + * + * In particular it is responsible for handling handshakes appropriately. + * + */ +function MessageListener(ptcl, opts) { + events.EventEmitter.call(this); + opts = opts || {}; + + this._ptcl = ptcl; + this._resolvers = ptcl._listenerResolvers; + this._emitterHashString = null; + this._idType = IdType.createMetadataType(opts.IdType); + this._bufferSize = opts.bufferSize || 2048; + this._frameSize = opts.frameSize || 2048; + this._decoder = new MessageDecoder(); + this._encoder = new MessageEncoder(this._frameSize); + this._destroyed = false; + this._pending = 0; + + this.once('_eot', function (pending) { this.emit('eot', pending); }); +} +util.inherits(MessageListener, events.EventEmitter); + +MessageListener.prototype._generateResolvers = function ( + hashString, emitterPtcl +) { + var resolvers = {}; + var clientMessages = emitterPtcl._messages; + var serverMessages = this._ptcl._messages; + Object.keys(clientMessages).forEach(function (name) { + var sm = serverMessages[name]; + if (!sm) { + throw new Error(f('missing server message: %s', name)); + } + var cm = clientMessages[name]; + resolvers[name] = { + requestType: sm.requestType.createResolver(cm.requestType) + }; + }); + this._resolvers[hashString] = resolvers; +}; + +MessageListener.prototype._validateHandshake = function (reqTap, resTap) { + // Reads handshake request and write corresponding response out. If an error + // occurs when parsing the request, a response with match NONE will be sent. + // Also emits 'handshake' event with both the request and the response. + var validationErr = null; + try { + var handshakeReq = HANDSHAKE_REQUEST_TYPE._read(reqTap); + var serverHashString = handshakeReq.serverHash.toString('binary'); + } catch (err) { + validationErr = err; + } + + if (!validationErr) { + this._emitterHashString = handshakeReq.clientHash.toString('binary'); + if (!canResolve(this, this._emitterHashString)) { + var emitterPtclString = handshakeReq.clientProtocol; + if (emitterPtclString) { + try { + this._generateResolvers( + this._emitterHashString, + createProtocol(JSON.parse(emitterPtclString.string)) + ); + } catch (err) { + validationErr = err; + } + } else { + validationErr = new Error('unknown client protocol hash'); + } + } + } + + // We use the handshake response's meta field to transmit an eventual error + // to the client. This will let us display a more useful message later on. + var serverMatch = serverHashString === this._ptcl._hashString; + var handshakeRes = new HandshakeResponse( + validationErr ? 'NONE' : serverMatch ? 'BOTH' : 'CLIENT', + serverMatch ? null : {string: this._ptcl.toString()}, + serverMatch ? null : {'org.apache.avro.ipc.MD5': getHash(this._ptcl)}, + validationErr ? {map: {error: new Buffer(validationErr.message)}} : null + ); + + this.emit('handshake', handshakeReq, handshakeRes); + safeWrite(resTap, HANDSHAKE_RESPONSE_TYPE, handshakeRes); + return validationErr === null; +}; + +MessageListener.prototype._decodeRequest = function (tap, message) { + var resolvers = getResolvers(this, this._emitterHashString, message); + var val = resolvers.requestType._read(tap); + if (!tap.isValid()) { + throw new Error('invalid request'); + } + return val; +}; + +MessageListener.prototype._encodeSystemError = function (tap, err) { + safeWrite(tap, BOOLEAN_TYPE, true); + safeWrite(tap, SYSTEM_ERROR_TYPE, avroError(err)); +}; + +MessageListener.prototype._encodeArguments = function ( + tap, message, err, res +) { + var noError = err === null; + var pos = tap.pos; + safeWrite(tap, BOOLEAN_TYPE, !noError); + try { + if (noError) { + safeWrite(tap, message.responseType, res); + } else { + if (err instanceof Error) { + // Convenience to allow emitter to use JS errors inside handlers. + err = avroError(err); + } + safeWrite(tap, message.errorType, err); + } + } catch (err) { + tap.pos = pos; + this._encodeSystemError(tap, err); + } +}; + +MessageListener.prototype.destroy = function (noWait) { + if (!this._destroyed) { + // Stop listening. This will also correctly push back any unused bytes into + // the readable stream (via `MessageDecoder`'s `unpipe` handler). + this._readable.unpipe(this._decoder); + } + + this._destroyed = true; + if (noWait || !this._pending) { + this._encoder.unpipe(this._writable); + this.emit('_eot', this._pending); + } +}; + +/** + * Listener for stateless transport. + * + * This listener expect a handshake to precede each message. + * + */ +function StatelessListener(ptcl, readableFactory, opts) { + MessageListener.call(this, ptcl, opts); + + this._tap = new Tap(new Buffer(this._bufferSize)); + this._message = undefined; + + var self = this; + this._readable = readableFactory(function (writable) { + // The encoder will buffer writes that happen before this function is + // called, so we don't need to do any special handling. + self._writable = self._encoder + .pipe(writable) + .on('finish', onEnd); + }); + + this._readable.pipe(this._decoder) + .on('data', onRequestData) + .on('end', onEnd); + + function onRequestData(buf) { + self._pending++; + self.destroy(); // Only one message per stateless listener. + + var reqTap = new Tap(buf); + if (!self._validateHandshake(reqTap, self._tap)) { + onResponse(new Error('invalid handshake')); + return; + } + + try { + self._idType._read(reqTap); // Skip metadata. + var name = STRING_TYPE._read(reqTap); + self._message = self._ptcl._messages[name]; + if (!self._message) { + throw new Error(f('unknown message: %s', name)); + } + var req = self._decodeRequest(reqTap, self._message); + } catch (err) { + onResponse(err); + return; + } + + self.emit('_call', name, req, onResponse); + } + + function onResponse(err, res) { + safeWrite(self._tap, self._idType, 0); + if (!self._message) { + self._encodeSystemError(self._tap, err); + } else { + self._encodeArguments(self._tap, self._message, err, res); + } + self._pending--; + self._encoder.end(self._tap.getValue()); + } + + function onEnd() { self.destroy(); } +} +util.inherits(StatelessListener, MessageListener); + +/** + * Stateful transport listener. + * + * A handshake is done when the listener is first opened, then all messages are + * sent without. + * + */ +function StatefulListener(ptcl, readable, writable, opts) { + MessageListener.call(this, ptcl, opts); + + this._readable = readable; + this._writable = writable; + + var self = this; + + this._readable + .pipe(this._decoder) + .on('data', onHandshakeData) + .on('end', function () { self.destroy(); }); + + this._encoder + .pipe(this._writable) + .on('finish', function () { self.destroy(); }); + + function onHandshakeData(buf) { + var reqTap = new Tap(buf); + var resTap = new Tap(new Buffer(self._bufferSize)); + if (self._validateHandshake(reqTap, resTap)) { + self._decoder + .removeListener('data', onHandshakeData) + .on('data', onRequestData); + } + self._encoder.write(resTap.getValue()); + } + + function onRequestData(buf) { + var reqTap = new Tap(buf); + var resTap = new Tap(new Buffer(self._bufferSize)); + var id = 0; + try { + id = -self._idType._read(reqTap) | 0; + if (!id) { + throw new Error('missing ID'); + } + } catch (err) { + self.emit('error', new Error('invalid metadata: ' + err.message)); + return; + } + + self._pending++; + try { + var name = STRING_TYPE._read(reqTap); + var message = self._ptcl._messages[name]; + if (!message) { + throw new Error('unknown message: ' + name); + } + var req = self._decodeRequest(reqTap, message); + } catch (err) { + onResponse(err); + return; + } + + if (message.oneWay) { + self.emit('_call', name, req); + self._pending--; + } else { + self.emit('_call', name, req, onResponse); + } + + function onResponse(err, res) { + self._pending--; + safeWrite(resTap, self._idType, id); + if (!message) { + self._encodeSystemError(resTap, err); + } else { + self._encodeArguments(resTap, message, err, res); + } + self._encoder.write(resTap.getValue(), undefined, function () { + if (!self._pending && self._destroyed) { + self.destroy(); // For real this time. + } + }); + } + } +} +util.inherits(StatefulListener, MessageListener); + +// Helpers. + +/** + * An Avro message. + * + */ +function Message(name, attrs, opts) { + this.name = name; + + this.requestType = schemas.createType({ + name: name, + type: 'request', + fields: attrs.request + }, opts); + + if (!attrs.response) { + throw new Error('missing response'); + } + this.responseType = schemas.createType(attrs.response, opts); + + var errors = attrs.errors || []; + errors.unshift('string'); + this.errorType = schemas.createType(errors, opts); + + this.oneWay = !!attrs['one-way']; + if (this.oneWay) { + if ( + !(this.responseType instanceof schemas.types.NullType) || + errors.length > 1 + ) { + throw new Error('unapplicable one-way parameter'); + } + } +} + +Message.prototype.toJSON = function () { + var obj = { + request: this.requestType.getFields(), + response: this.responseType + }; + var errorTypes = this.errorType.getTypes(); + if (errorTypes.length > 1) { + obj.errors = schemas.createType(errorTypes.slice(1)); + } + return obj; +}; + +/** + * "Framing" stream. + * + * @param frameSize {Number} (Maximum) size in bytes of each frame. The last + * frame might be shorter. + * + */ +function MessageEncoder(frameSize) { + stream.Transform.call(this); + this._frameSize = frameSize | 0; + if (this._frameSize <= 0) { + throw new Error('invalid frame size'); + } +} +util.inherits(MessageEncoder, stream.Transform); + +MessageEncoder.prototype._transform = function (buf, encoding, cb) { + var frames = []; + var length = buf.length; + var start = 0; + var end; + do { + end = start + this._frameSize; + if (end > length) { + end = length; + } + frames.push(intBuffer(end - start)); + frames.push(buf.slice(start, end)); + } while ((start = end) < length); + frames.push(intBuffer(0)); + cb(null, Buffer.concat(frames)); +}; + +/** + * "Un-framing" stream. + * + * @param noEmpty {Boolean} Emit an error if the decoder ends before emitting a + * single frame. + * + * This stream should only be used by being piped/unpiped to. Otherwise there + * is a risk that too many bytes get consumed from the source stream (i.e. + * data corresponding to a partial message might be lost). + * + */ +function MessageDecoder(noEmpty) { + stream.Transform.call(this); + this._buf = new Buffer(0); + this._bufs = []; + this._length = 0; + this._empty = !!noEmpty; + + this + .on('finish', function () { this.push(null); }) + .on('unpipe', function (src) { + if (~this._length && !src._readableState.ended) { + // Not ideal to rely on this to check whether we can unshift, but the + // official documentation mentions it (in the context of the read + // buffers) so it should be stable. Alternatives are more complex, + // costly (e.g. attaching a handler on pipe), and not as fool-proof + // (the stream might have ended earlier). + this._bufs.push(this._buf); + src.unshift(Buffer.concat(this._bufs)); + } + }); +} +util.inherits(MessageDecoder, stream.Transform); + +MessageDecoder.prototype._transform = function (buf, encoding, cb) { + buf = Buffer.concat([this._buf, buf]); + var frameLength; + while ( + buf.length >= 4 && + buf.length >= (frameLength = buf.readInt32BE(0)) + 4 + ) { + if (frameLength) { + this._bufs.push(buf.slice(4, frameLength + 4)); + this._length += frameLength; + } else { + var frame = Buffer.concat(this._bufs, this._length); + this._empty = false; + this._length = 0; + this._bufs = []; + this.push(frame); + } + buf = buf.slice(frameLength + 4); + } + this._buf = buf; + cb(); +}; + +MessageDecoder.prototype._flush = function () { + if (this._length || this._buf.length) { + this._length = -1; // Don't unshift data on incoming unpipe. + this.emit('error', new Error('trailing data')); + } else if (this._empty) { + this.emit('error', new Error('no message decoded')); + } +}; + +/** + * Default ID generator, using Avro messages' metadata field. + * + * This is required for stateful emitters to work and can be overridden to read + * or write arbitrary metadata. Note that the message contents are + * (intentionally) not available when updating this metadata. + * + */ +function IdType(attrs, opts) { + schemas.types.LogicalType.call(this, attrs, opts); +} +util.inherits(IdType, schemas.types.LogicalType); + +IdType.prototype._fromValue = function (val) { + var buf = val.id; + return buf && buf.length === 4 ? buf.readInt32BE(0) : 0; +}; + +IdType.prototype._toValue = function (any) { + return {id: intBuffer(any | 0)}; +}; + +IdType.createMetadataType = function (Type) { + Type = Type || IdType; + return new Type({type: 'map', values: 'bytes'}); +}; + +/** + * Returns a buffer containing an integer's big-endian representation. + * + * @param n {Number} Integer. + * + */ +function intBuffer(n) { + var buf = new Buffer(4); + buf.writeInt32BE(n); + return buf; +} + +/** + * Write and maybe resize. + * + * @param tap {Tap} Tap written to. + * @param type {Type} Avro type. + * @param val {...} Corresponding Avro value. + * + */ +function safeWrite(tap, type, val) { + var pos = tap.pos; + type._write(tap, val); + + if (!tap.isValid()) { + var buf = new Buffer(tap.pos); + tap.buf.copy(buf, 0, 0, pos); + tap.buf = buf; + tap.pos = pos; + type._write(tap, val); + } +} + +/** + * Default callback when not provided. + * + */ +function throwError(err) { + if (!err) { + return; + } + if (typeof err == 'object' && err.string) { + err = err.string; + } + if (typeof err == 'string') { + err = new Error(err); + } + throw err; +} + +/** + * Convert an error message into a format suitable for RPC. + * + * @param err {Error|String} Error message. It will be converted into valid + * format for Avro. + * + */ +function avroError(err) { + if (err instanceof Error) { + err = err.message; + } + return {string: err}; +} + +/** + * Asynchronous error handling. + * + * @param cb {Function} Callback. + * @param err {...} Error, passed as first argument to `cb.` If an `Error` + * instance or a string, it will be converted into valid format for Avro. + * @param res {...} Response. Passed as second argument to `cb`. + * + */ +function asyncAvroCb(ctx, cb, err, res) { + process.nextTick(function () { cb.call(ctx, avroError(err), res); }); +} + +/** + * Convenience function to get a protocol's hash. + * + * @param ptcl {Protocol} Any protocol. + * + */ +function getHash(ptcl) { + return new Buffer(ptcl._hashString, 'binary'); +} + +/** + * Whether a emitter or listener can resolve messages from a hash string. + * + * @param emitter {MessageEmitter|MessageListener} + * @param hashString {String} + * + */ +function canResolve(emitter, hashString) { + var resolvers = emitter._resolvers[hashString]; + return !!resolvers || hashString === emitter._ptcl._hashString; +} + +/** + * Retrieve resolvers for a given hash string. + * + * @param emitter {MessageEmitter|MessageListener} + * @param hashString {String} + * @param message {Message} + * + */ +function getResolvers(emitter, hashString, message) { + if (hashString === emitter._ptcl._hashString) { + return message; + } + var resolvers = emitter._resolvers[hashString]; + return resolvers && resolvers[message.name]; +} + +/** + * Check whether something is a stream. + * + * @param any {Object} Any object. + * + */ +function isStream(any) { + // This is a hacky way of checking that the transport is a stream-like + // object. We unfortunately can't use `instanceof Stream` checks since + // some libraries (e.g. websocket-stream) return streams which don't + // inherit from it. + return !!any.pipe; +} + + +module.exports = { + HANDSHAKE_REQUEST_TYPE: HANDSHAKE_REQUEST_TYPE, + HANDSHAKE_RESPONSE_TYPE: HANDSHAKE_RESPONSE_TYPE, + IdType: IdType, + Message: Message, + Protocol: Protocol, + createProtocol: createProtocol, + emitters: { + StatefulEmitter: StatefulEmitter, + StatelessEmitter: StatelessEmitter + }, + listeners: { + StatefulListener: StatefulListener, + StatelessListener: StatelessListener + }, + streams: { + MessageDecoder: MessageDecoder, + MessageEncoder: MessageEncoder + }, + throwError: throwError +}; diff --git a/lang/js/lib/schemas.js b/lang/js/lib/schemas.js index 325d77acb2f..429ace45e7a 100644 --- a/lang/js/lib/schemas.js +++ b/lang/js/lib/schemas.js @@ -23,7 +23,6 @@ var utils = require('./utils'), buffer = require('buffer'), // For `SlowBuffer`. - crypto = require('crypto'), util = require('util'); // Convenience imports. @@ -45,6 +44,7 @@ var TYPES = { 'map': MapType, 'null': NullType, 'record': RecordType, + 'request': RecordType, 'string': StringType, 'union': UnionType }; @@ -307,31 +307,11 @@ Type.prototype.getName = function (noRef) { }; Type.prototype.getSchema = function (noDeref) { - // Since JS objects are unordered, this implementation (unfortunately) - // relies on engines returning properties in the same order that they are - // inserted in. This is not in the JS spec, but can be "somewhat" safely - // assumed (more here: http://stackoverflow.com/q/5525795/1062617). - return (function (type, registry) { - return JSON.stringify(type, function (key, value) { - if (value instanceof Field) { - return {name: value._name, type: value._type}; - } else if (value && value.name) { - var name = value.name; - if (noDeref || registry[name]) { - return name; - } - registry[name] = true; - } - return value; - }); - })(this, {}); + return stringify(this, noDeref); }; Type.prototype.getFingerprint = function (algorithm) { - algorithm = algorithm || 'md5'; - var hash = crypto.createHash(algorithm); - hash.end(this.getSchema()); - return hash.read(); + return utils.getHash(this.getSchema(), algorithm); }; Type.prototype.inspect = function () { @@ -1434,7 +1414,9 @@ function RecordType(attrs, opts) { var resolutions = resolveNames(attrs, opts.namespace); this._name = resolutions.name; this._aliases = resolutions.aliases; - Type.call(this, opts.registry); + this._type = attrs.type; + // Requests shouldn't be registered since their name is only a placeholder. + Type.call(this, this._type === 'request' ? undefined : opts.registry); if (!(attrs.fields instanceof Array)) { throw new Error(f('non-array %s fields', this._name)); @@ -2155,6 +2137,37 @@ function readArraySize(tap) { return n; } +/** + * Correctly stringify an object which contains types. + * + * @param obj {Object} The object to stringify. Typically, a type itself or an + * object containing types. Any types inside will be expanded only once then + * referenced by name. + * @param noDeref {Boolean} Always reference types by name when possible, + * rather than expand it the first time it is encountered. + * + */ +function stringify(obj, noDeref) { + // Since JS objects are unordered, this implementation (unfortunately) + // relies on engines returning properties in the same order that they are + // inserted in. This is not in the JS spec, but can be "somewhat" safely + // assumed (more here: http://stackoverflow.com/q/5525795/1062617). + return (function (registry) { + return JSON.stringify(obj, function (key, value) { + if (value instanceof Field) { + return {name: value._name, type: value._type}; + } else if (value && value.name) { + var name = value.name; + if (noDeref || registry[name]) { + return name; + } + registry[name] = true; + } + return value; + }); + })({}); +} + /** * Check whether a long can be represented without precision loss. * @@ -2192,6 +2205,7 @@ function throwInvalidError(path, val, type) { module.exports = { createType: createType, resolveNames: resolveNames, // Protocols use the same name resolution logic. + stringify: stringify, types: (function () { // Export the base types along with all concrete implementations. var obj = {Type: Type, LogicalType: LogicalType}; diff --git a/lang/js/lib/utils.js b/lang/js/lib/utils.js index 2627c1aa5f1..c453bdd6ebe 100644 --- a/lang/js/lib/utils.js +++ b/lang/js/lib/utils.js @@ -21,6 +21,9 @@ 'use strict'; +var crypto = require('crypto'); + + /** * Uppercase the first letter of a string. * @@ -38,6 +41,20 @@ function capitalize(s) { return s.charAt(0).toUpperCase() + s.slice(1); } */ function compare(n1, n2) { return n1 === n2 ? 0 : (n1 < n2 ? -1 : 1); } +/** + * Compute a string's hash. + * + * @param str {String} The string to hash. + * @param algorithm {String} The algorithm used. Defaults to MD5. + * + */ +function getHash(str, algorithm) { + algorithm = algorithm || 'md5'; + var hash = crypto.createHash(algorithm); + hash.end(str); + return hash.read(); +} + /** * Find index of value in array. * @@ -278,6 +295,12 @@ function Tap(buf, pos) { */ Tap.prototype.isValid = function () { return this.pos <= this.buf.length; }; +/** + * Returns the contents of the tap up to the current position. + * + */ +Tap.prototype.getValue = function () { return this.buf.slice(0, this.pos); }; + // Read, skip, write methods. // // These should fail silently when the buffer overflows. Note this is only @@ -623,6 +646,7 @@ module.exports = { abstractFunction: abstractFunction, capitalize: capitalize, compare: compare, + getHash: getHash, toMap: toMap, singleIndexOf: singleIndexOf, hasDuplicates: hasDuplicates, diff --git a/lang/js/package.json b/lang/js/package.json index fda5325d6de..672faff6094 100644 --- a/lang/js/package.json +++ b/lang/js/package.json @@ -34,8 +34,9 @@ "crypto": "./etc/browser/crypto.js" }, "scripts": { - "test": "mocha --ui tdd --reporter dot", - "clean": "rm -rf node_modules" + "cover": "istanbul cover _mocha", + "test": "mocha", + "clean": "rm -rf coverage node_modules" }, "dependencies": { "underscore": "*" diff --git a/lang/js/test/mocha.opts b/lang/js/test/mocha.opts new file mode 100644 index 00000000000..1ed06f8f6d0 --- /dev/null +++ b/lang/js/test/mocha.opts @@ -0,0 +1,2 @@ +--ui tdd +--reporter dot diff --git a/lang/js/test/test_files.js b/lang/js/test/test_files.js index c0a334b81f1..4f7c5474e44 100644 --- a/lang/js/test/test_files.js +++ b/lang/js/test/test_files.js @@ -22,6 +22,7 @@ 'use strict'; var files = require('../lib/files'), + protocols = require('../lib/protocols'), schemas = require('../lib/schemas'), assert = require('assert'), fs = require('fs'), @@ -43,7 +44,7 @@ suite('files', function () { var parse = files.parse; - test('object', function () { + test('type object', function () { var obj = { type: 'record', name: 'Person', @@ -52,6 +53,11 @@ suite('files', function () { assert(parse(obj) instanceof types.RecordType); }); + test('protocol object', function () { + var obj = {protocol: 'Foo'}; + assert(parse(obj) instanceof protocols.Protocol); + }); + test('schema instance', function () { var type = parse({ type: 'record', diff --git a/lang/js/test/test_protocols.js b/lang/js/test/test_protocols.js new file mode 100644 index 00000000000..08ef784d02e --- /dev/null +++ b/lang/js/test/test_protocols.js @@ -0,0 +1,1392 @@ +/* jshint node: true, mocha: true */ + +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +'use strict'; + +var protocols = require('../lib/protocols'), + utils = require('../lib/utils'), + assert = require('assert'), + stream = require('stream'), + util = require('util'); + + +var HANDSHAKE_REQUEST_TYPE = protocols.HANDSHAKE_REQUEST_TYPE; +var HANDSHAKE_RESPONSE_TYPE = protocols.HANDSHAKE_RESPONSE_TYPE; +var createProtocol = protocols.createProtocol; + + +suite('protocols', function () { + + suite('Protocol', function () { + + test('get name and types', function () { + var p = createProtocol({ + namespace: 'foo', + protocol: 'HelloWorld', + types: [ + { + name: 'Greeting', + type: 'record', + fields: [{name: 'message', type: 'string'}] + }, + { + name: 'Curse', + type: 'error', + fields: [{name: 'message', type: 'string'}] + } + ], + messages: { + hello: { + request: [{name: 'greeting', type: 'Greeting'}], + response: 'Greeting', + errors: ['Curse'] + }, + hi: { + request: [{name: 'hey', type: 'string'}], + response: 'null', + 'one-way': true + } + } + }); + assert.equal(p.getName(), 'foo.HelloWorld'); + assert.equal(p.getType('foo.Greeting').getName(true), 'record'); + }); + + test('missing message', function () { + var ptcl = createProtocol({namespace: 'com.acme', protocol: 'Hello'}); + assert.throws(function () { + ptcl.on('add', function () {}); + }, /unknown/); + }); + + test('missing name', function () { + assert.throws(function () { + createProtocol({namespace: 'com.acme', messages: {}}); + }); + }); + + test('missing type', function () { + assert.throws(function () { + createProtocol({ + namespace: 'com.acme', + protocol: 'HelloWorld', + messages: { + hello: { + request: [{name: 'greeting', type: 'Greeting'}], + response: 'Greeting' + } + } + }); + }); + }); + + test('get messages', function () { + var ptcl; + ptcl = createProtocol({protocol: 'Empty'}); + assert.deepEqual(ptcl.getMessages(), {}); + ptcl = createProtocol({ + protocol: 'Ping', + messages: { + ping: { + request: [], + response: 'string' + } + } + }); + var messages = ptcl.getMessages(); + assert.equal(Object.keys(messages).length, 1); + assert(messages.ping !== undefined); + }); + + test('create listener', function (done) { + var ptcl = createProtocol({protocol: 'Empty'}); + var transport = new stream.PassThrough(); + var ee = ptcl.createListener(transport, function (pending) { + assert.equal(pending, 0); + done(); + }); + ee.destroy(); + }); + + test('subprotocol', function () { + var ptcl = createProtocol({namespace: 'com.acme', protocol: 'Hello'}); + var subptcl = ptcl.subprotocol(); + assert.strictEqual(subptcl._emitterResolvers, ptcl._emitterResolvers); + assert.strictEqual(subptcl._listenerResolvers, ptcl._listenerResolvers); + }); + + test('invalid emitter', function (done) { + var ptcl = createProtocol({protocol: 'Empty'}); + ptcl.emit('hi', {}, null, function (err) { + assert(/invalid emitter/.test(err.string)); + done(); + }); + }); + + test('inspect', function () { + var p = createProtocol({ + namespace: 'hello', + protocol: 'World', + }); + assert.equal(p.inspect(), ''); + }); + + }); + + suite('Message', function () { + + var Message = protocols.Message; + + test('empty errors', function () { + var m = new Message('Hi', { + request: [{name: 'greeting', type: 'string'}], + response: 'int' + }); + assert.deepEqual(m.errorType.toString(), '["string"]'); + }); + + test('missing response', function () { + assert.throws(function () { + new Message('Hi', { + request: [{name: 'greeting', type: 'string'}] + }); + }); + }); + + test('invalid one-way', function () { + // Non-null response. + assert.throws(function () { + new Message('Hi', { + request: [{name: 'greeting', type: 'string'}], + response: 'string', + 'one-way': true + }); + }); + // Non-empty errors. + assert.throws(function () { + new Message('Hi', { + request: [{name: 'greeting', type: 'string'}], + response: 'null', + errors: ['int'], + 'one-way': true + }); + }); + }); + + }); + + suite('MessageDecoder', function () { + + var MessageDecoder = protocols.streams.MessageDecoder; + + test('ok', function (done) { + var parts = [ + new Buffer([0, 1]), + new Buffer([2]), + new Buffer([]), + new Buffer([3, 4, 5]), + new Buffer([]) + ]; + var messages = []; + var readable = createReadableStream(parts.map(frame), true); + var writable = createWritableStream(messages, true) + .on('finish', function () { + assert.deepEqual( + messages, + [new Buffer([0, 1, 2]), new Buffer([3, 4, 5])] + ); + done(); + }); + readable.pipe(new MessageDecoder()).pipe(writable); + }); + + test('trailing data', function (done) { + var parts = [ + new Buffer([0, 1]), + new Buffer([2]), + new Buffer([]), + new Buffer([3]) + ]; + var messages = []; + var readable = createReadableStream(parts.map(frame), true); + var writable = createWritableStream(messages, true); + readable + .pipe(new MessageDecoder()) + .on('error', function () { + assert.deepEqual(messages, [new Buffer([0, 1, 2])]); + done(); + }) + .pipe(writable); + }); + + test('empty', function (done) { + var readable = createReadableStream([], true); + readable + .pipe(new MessageDecoder(true)) + .on('error', function () { done(); }); + }); + + }); + + suite('MessageEncoder', function () { + + var MessageEncoder = protocols.streams.MessageEncoder; + + test('invalid frame size', function () { + assert.throws(function () { new MessageEncoder(); }); + }); + + test('ok', function (done) { + var messages = [ + new Buffer([0, 1]), + new Buffer([2]) + ]; + var frames = []; + var readable = createReadableStream(messages, true); + var writable = createWritableStream(frames, true); + readable + .pipe(new MessageEncoder(64)) + .pipe(writable) + .on('finish', function () { + assert.deepEqual( + frames, + [ + new Buffer([0, 0, 0, 2, 0, 1, 0, 0, 0, 0]), + new Buffer([0, 0, 0, 1, 2, 0, 0, 0, 0]) + ] + ); + done(); + }); + }); + + test('all zeros', function (done) { + var messages = [new Buffer([0, 0, 0, 0])]; + var frames = []; + var readable = createReadableStream(messages, true); + var writable = createWritableStream(frames, true); + readable + .pipe(new MessageEncoder(64)) + .pipe(writable) + .on('finish', function () { + assert.deepEqual( + frames, + [new Buffer([0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0])] + ); + done(); + }); + }); + + test('short frame size', function (done) { + var messages = [ + new Buffer([0, 1, 2]), + new Buffer([2]) + ]; + var frames = []; + var readable = createReadableStream(messages, true); + var writable = createWritableStream(frames, true); + readable + .pipe(new MessageEncoder(2)) + .pipe(writable) + .on('finish', function () { + assert.deepEqual( + frames, + [ + new Buffer([0, 0, 0, 2, 0, 1, 0, 0, 0, 1, 2, 0, 0, 0, 0]), + new Buffer([0, 0, 0, 1, 2, 0, 0, 0, 0]) + ] + ); + done(); + }); + }); + + }); + + suite('StatefulEmitter', function () { + + test('ok handshake', function (done) { + var buf = HANDSHAKE_RESPONSE_TYPE.toBuffer({match: 'BOTH'}); + var bufs = []; + var ptcl = createProtocol({protocol: 'Empty'}); + var handshake = false; + ptcl.createEmitter(createTransport([buf], bufs)) + .on('handshake', function (req, res) { + handshake = true; + assert(res.match === 'BOTH'); + assert.deepEqual( + Buffer.concat(bufs), + HANDSHAKE_REQUEST_TYPE.toBuffer({ + clientHash: new Buffer(ptcl._hashString, 'binary'), + serverHash: new Buffer(ptcl._hashString, 'binary') + }) + ); + this.destroy(); + }) + .on('eot', function () { + assert(handshake); + done(); + }); + }); + + test('no server match handshake', function (done) { + var ptcl = createProtocol({protocol: 'Empty'}); + var resBufs = [ + { + match: 'NONE', + serverHash: {'org.apache.avro.ipc.MD5': new Buffer(16)}, + serverProtocol: {string: ptcl.toString()}, + }, + {match: 'BOTH'} + ].map(function (val) { return HANDSHAKE_RESPONSE_TYPE.toBuffer(val); }); + var reqBufs = []; + var handshakes = 0; + ptcl.createEmitter(createTransport(resBufs, reqBufs)) + .on('handshake', function (req, res) { + if (handshakes++) { + assert(res.match === 'BOTH'); + this.destroy(); + } else { + assert(res.match === 'NONE'); + } + }) + .on('eot', function () { + assert.equal(handshakes, 2); + done(); + }); + }); + + test('incompatible protocol', function (done) { + var ptcl = createProtocol({protocol: 'Empty'}); + var hash = new Buffer(16); // Pretend the hash was different. + var resBufs = [ + { + match: 'NONE', + serverHash: {'org.apache.avro.ipc.MD5': hash}, + serverProtocol: {string: ptcl.toString()}, + }, + { + match: 'NONE', + serverHash: {'org.apache.avro.ipc.MD5': hash}, + serverProtocol: {string: ptcl.toString()}, + meta: {map: {error: new Buffer('abcd')}} + } + ].map(function (val) { return HANDSHAKE_RESPONSE_TYPE.toBuffer(val); }); + var error = false; + ptcl.createEmitter(createTransport(resBufs, [])) + .on('error', function (err) { + error = true; + assert.equal(err.message, 'abcd'); + }) + .on('eot', function () { + assert(error); + done(); + }); + }); + + test('handshake error', function (done) { + var resBufs = [ + new Buffer([4, 0, 0]), // Invalid handshakes. + new Buffer([4, 0, 0]) + ]; + var ptcl = createProtocol({protocol: 'Empty'}); + var error = false; + ptcl.createEmitter(createTransport(resBufs, [])) + .on('error', function (err) { + error = true; + assert.equal(err.message, 'handshake error'); + }) + .on('eot', function () { + assert(error); + done(); + }); + }); + + test('orphan response', function (done) { + var ptcl = createProtocol({protocol: 'Empty'}); + var idType = protocols.IdType.createMetadataType(); + var resBufs = [ + new Buffer([0, 0, 0]), // OK handshake. + idType.toBuffer(23) + ]; + var error = false; + ptcl.createEmitter(createTransport(resBufs, [])) + .on('error', function (err) { + error = true; + assert(/orphan response:/.test(err.message)); + }) + .on('eot', function () { + assert(error); + done(); + }); + }); + + test('ended readable', function (done) { + var bufs = []; + var ptcl = createProtocol({protocol: 'Empty'}); + ptcl.createEmitter(createTransport([], bufs)) + .on('eot', function () { + assert.equal(bufs.length, 1); // A single handshake was sent. + done(); + }); + }); + + test('interrupted', function (done) { + var ptcl = createProtocol({ + protocol: 'Empty', + messages: { + id: {request: [{name: 'id', type: 'int'}], response: 'int'} + } + }); + var resBufs = [ + new Buffer([0, 0, 0]), // OK handshake. + ]; + var interrupted = 0; + var transport = createTransport(resBufs, []); + var ee = ptcl.createEmitter(transport, function () { + assert.equal(interrupted, 2); + done(); + }); + + ptcl.emit('id', {id: 123}, ee, cb); + ptcl.emit('id', {id: 123}, ee, cb); + + function cb(err) { + assert.deepEqual(err, {string: 'interrupted'}); + interrupted++; + } + }); + + test('missing client message', function (done) { + var ptcl1 = createProtocol({ + protocol: 'Ping', + messages: { + ping: {request: [], response: 'string'} + } + }); + var ptcl2 = createProtocol({ + protocol: 'Ping', + messages: { + ping: {request: [], response: 'string'}, + pong: {request: [], response: 'string'} + } + }).on('ping', function (req, ee, cb) { cb(null, 'ok'); }); + var transports = createPassthroughTransports(); + ptcl2.createListener(transports[1]); + var ee = ptcl1.createEmitter(transports[0]); + ptcl1.emit('ping', {}, ee, function (err, res) { + assert.equal(res, 'ok'); + done(); + }); + }); + + test('missing server message', function (done) { + var ptcl1 = createProtocol({ + protocol: 'Ping', + messages: { + ping: {request: [], response: 'string'} + } + }); + var ptcl2 = createProtocol({protocol: 'Empty'}); + var transports = createPassthroughTransports(); + ptcl2.createListener(transports[1]); + ptcl1.createEmitter(transports[0]) + .on('error', function (err) { + assert(/missing server message: ping/.test(err.message)); + done(); + }); + }); + + test('trailing data', function (done) { + var ptcl = createProtocol({ + protocol: 'Ping', + messages: { + ping: {request: [], response: 'string'} + } + }); + var transports = createPassthroughTransports(); + ptcl.createEmitter(transports[0]) + .on('error', function (err) { + assert(/trailing data/.test(err.message)); + done(); + }); + transports[0].readable.end(new Buffer([2, 3])); + }); + + test('invalid metadata', function (done) { + var ptcl = createProtocol({ + protocol: 'Ping', + messages: { + ping: {request: [], response: 'string'} + } + }); + var transports = createPassthroughTransports(); + ptcl.createListener(transports[1]); + ptcl.createEmitter(transports[0]) + .on('error', function (err) { + assert(/invalid metadata:/.test(err.message)); + done(); + }) + .on('handshake', function () { + transports[0].readable.write(frame(new Buffer([2, 3]))); + transports[0].readable.write(frame(new Buffer(0))); + }); + }); + + test('invalid response', function (done) { + var ptcl = createProtocol({ + protocol: 'Ping', + messages: { + ping: {request: [], response: 'string'} + } + }); + var transports = createPassthroughTransports(); + var ml = ptcl.createListener(transports[1]); + var me = ptcl.createEmitter(transports[0]) + .on('handshake', function () { + ml.destroy(); + + ptcl.emit('ping', {}, me, function (err) { + assert(/invalid response:/.test(err.string)); + done(); + }); + + var idType = protocols.IdType.createMetadataType(); + var bufs = [ + idType.toBuffer(1), // Metadata. + new Buffer([3]) // Invalid response. + ]; + transports[0].readable.write(frame(Buffer.concat(bufs))); + transports[0].readable.write(frame(new Buffer(0))); + }); + }); + + test('one way', function (done) { + var beats = 0; + var ptcl = createProtocol({ + protocol: 'Heartbeat', + messages: { + beat: {request: [], response: 'null', 'one-way': true} + } + }).on('beat', function (req, ee, cb) { + assert.strictEqual(cb, undefined); + if (++beats === 2) { + done(); + } + }); + var transports = createPassthroughTransports(); + ptcl.createListener(transports[1]); + var ee = ptcl.createEmitter(transports[0]); + ptcl.emit('beat', {}, ee); + ptcl.emit('beat', {}, ee); + }); + + }); + + suite('StatelessEmitter', function () { + + test('interrupted before response data', function (done) { + var ptcl = createProtocol({ + protocol: 'Ping', + messages: {ping: {request: [], response: 'boolean'}} + }); + var readable = stream.PassThrough() + .on('end', done); + var writable = createWritableStream([]); + var ee = ptcl.createEmitter(function (cb) { + cb(readable); + return writable; + }); + ptcl.emit('ping', {}, ee, function (err) { + assert(/interrupted/.test(err.string)); + readable.write(frame(new Buffer(2))); + readable.end(frame(new Buffer(0))); + }); + ee.destroy(true); + }); + + }); + + suite('StatefulListener', function () { + + test('end readable', function (done) { + var ptcl = createProtocol({protocol: 'Empty'}); + var transports = createPassthroughTransports(); + ptcl.createListener(transports[0]) + .on('eot', function (pending) { + assert.equal(pending, 0); + done(); + }); + transports[0].readable.end(); + }); + + test('finish writable', function (done) { + var ptcl = createProtocol({protocol: 'Empty'}); + var transports = createPassthroughTransports(); + ptcl.createListener(transports[0]) + .on('eot', function (pending) { + assert.equal(pending, 0); + done(); + }); + transports[0].writable.end(); + }); + + test('invalid handshake', function (done) { + var ptcl = createProtocol({protocol: 'Empty'}); + var transport = createTransport( + [new Buffer([4])], // Invalid handshake. + [] + ); + ptcl.createListener(transport) + .on('handshake', function (req, res) { + assert(!req.$isValid()); + assert.equal(res.match, 'NONE'); + done(); + }); + }); + + test('missing server message', function (done) { + var ptcl1 = createProtocol({protocol: 'Empty'}); + var ptcl2 = createProtocol({ + protocol: 'Heartbeat', + messages: {beat: {request: [], response: 'boolean'}} + }); + var hash = new Buffer(ptcl2._hashString, 'binary'); + var req = { + clientHash: hash, + clientProtocol: {string: ptcl2.toString()}, + serverHash: hash + }; + var transport = createTransport( + [HANDSHAKE_REQUEST_TYPE.toBuffer(req)], + [] + ); + ptcl1.createListener(transport) + .on('handshake', function (req, res) { + assert(req.$isValid()); + assert.equal(res.match, 'NONE'); + var msg = res.meta.map.error.toString(); + assert(/missing server message/.test(msg)); + done(); + }); + }); + + test('invalid metadata', function (done) { + var ptcl = createProtocol({ + protocol: 'Heartbeat', + messages: {beat: {request: [], response: 'boolean'}} + }); + var transports = createPassthroughTransports(); + ptcl.createListener(transports[1]) + .on('error', function (err) { + assert(/invalid metadata/.test(err.message)); + done(); + }); + ptcl.createEmitter(transports[0]) + .on('handshake', function () { + // Handshake is complete now. + var writable = transports[0].writable; + writable.write(frame(new Buffer([0]))); // Empty metadata. + writable.write(frame(new Buffer(0))); + }); + }); + + test('unknown message', function (done) { + var ptcl = createProtocol({ + protocol: 'Heartbeat', + messages: {beat: {request: [], response: 'boolean'}} + }); + var transports = createPassthroughTransports(); + var ee = ptcl.createListener(transports[1]) + .on('eot', function () { + transports[1].writable.end(); + }); + ptcl.createEmitter(transports[0]) + .on('handshake', function () { + // Handshake is complete now. + this.destroy(); + var idType = ee._idType; + var bufs = []; + transports[0].readable + .pipe(new protocols.streams.MessageDecoder()) + .on('data', function (buf) { bufs.push(buf); }) + .on('end', function () { + assert.equal(bufs.length, 1); + var tap = new utils.Tap(bufs[0]); + idType._read(tap); + assert(tap.buf[tap.pos++]); // Error byte. + tap.pos++; // Union marker. + assert(/unknown message/.test(tap.readString())); + done(); + }); + [ + idType.toBuffer(-1), + new Buffer([4, 104, 105]), // `hi` message. + new Buffer(0) // End of frame. + ].forEach(function (buf) { + transports[0].writable.write(frame(buf)); + }); + transports[0].writable.end(); + }); + }); + + test('invalid request', function (done) { + var ptcl = createProtocol({ + protocol: 'Heartbeat', + messages: {beat: { + request: [{name: 'id', type: 'string'}], + response: 'boolean' + }} + }); + var transports = createPassthroughTransports(); + var ee = ptcl.createListener(transports[1]) + .on('eot', function () { transports[1].writable.end(); }); + ptcl.createEmitter(transports[0]) + .on('handshake', function () { + // Handshake is complete now. + this.destroy(); + var idType = ee._idType; + var bufs = []; + transports[0].readable + .pipe(new protocols.streams.MessageDecoder()) + .on('data', function (buf) { bufs.push(buf); }) + .on('end', function () { + assert.equal(bufs.length, 1); + var tap = new utils.Tap(bufs[0]); + idType._read(tap); + assert.equal(tap.buf[tap.pos++], 1); // Error byte. + assert.equal(tap.buf[tap.pos++], 0); // Union marker. + assert(/invalid request/.test(tap.readString())); + done(); + }); + [ + idType.toBuffer(-1), + new Buffer([8, 98, 101, 97, 116]), // `beat` message. + new Buffer([8]), // Invalid Avro string encoding. + new Buffer(0) // End of frame. + ].forEach(function (buf) { + transports[0].writable.write(frame(buf)); + }); + transports[0].writable.end(); + }); + }); + + test('destroy', function (done) { + var ptcl = createProtocol({ + protocol: 'Heartbeat', + messages: {beat: {request: [], response: 'boolean'}} + }).on('beat', function (req, ee, cb) { + ee.destroy(); + setTimeout(function () { cb(null, true); }, 10); + }); + var transports = createPassthroughTransports(); + var responded = false; + ptcl.createListener(transports[1]) + .on('eot', function () { + assert(responded); // Works because the transport is sync. + done(); + }); + ptcl.emit('beat', {}, ptcl.createEmitter(transports[0]), function () { + responded = true; + }); + }); + + }); + + suite('StatelessListener', function () { + + test('unknown message', function (done) { + var ptcl = createProtocol({ + protocol: 'Heartbeat', + messages: {beat: {request: [], response: 'boolean'}} + }); + var readable = new stream.PassThrough(); + var writable = new stream.PassThrough(); + var ee = ptcl.createListener(function (cb) { + cb(writable); + return readable; + }); + var bufs = []; + writable.pipe(new protocols.streams.MessageDecoder()) + .on('data', function (buf) { bufs.push(buf); }) + .on('end', function () { + assert.equal(bufs.length, 1); + var tap = new utils.Tap(bufs[0]); + tap.pos = 4; // Skip handshake response. + ee._idType._read(tap); // Skip metadata. + assert.equal(tap.buf[tap.pos++], 1); // Error. + assert.equal(tap.buf[tap.pos++], 0); // Union flag. + assert(/unknown message/.test(tap.readString())); + done(); + }); + var hash = new Buffer(ptcl._hashString, 'binary'); + var req = { + clientHash: hash, + clientProtocol: null, + serverHash: hash + }; + var encoder = new protocols.streams.MessageEncoder(64); + encoder.pipe(readable); + encoder.end(Buffer.concat([ + HANDSHAKE_REQUEST_TYPE.toBuffer(req), + new Buffer([0]), // Empty metadata. + new Buffer([4, 104, 105]) // `id` message. + ])); + }); + + test('late writable', function (done) { + var ptcl = createProtocol({ + protocol: 'Heartbeat', + messages: {beat: {request: [], response: 'boolean'}} + }).on('beat', function (req, ee, cb) { + cb(null, true); + }); + var readable = new stream.PassThrough(); + var writable = new stream.PassThrough(); + ptcl.createListener(function (cb) { + setTimeout(function () { cb(readable); }, 10); + return writable; + }); + var ee = ptcl.createEmitter(function (cb) { + cb(readable); + return writable; + }); + ptcl.emit('beat', {}, ee, function (err, res) { + assert.strictEqual(err, null); + assert.equal(res, true); + done(); + }); + }); + + }); + + suite('emit', function () { + + suite('stateful', function () { + + run(function (emitterPtcl, listenerPtcl, cb) { + var pt1 = new stream.PassThrough(); + var pt2 = new stream.PassThrough(); + var opts = {bufferSize: 48}; + cb( + emitterPtcl.createEmitter({readable: pt1, writable: pt2}, opts), + listenerPtcl.createListener({readable: pt2, writable: pt1}, opts) + ); + }); + + }); + + suite('stateless', function () { + + run(function (emitterPtcl, listenerPtcl, cb) { + cb(emitterPtcl.createEmitter(writableFactory)); + + function writableFactory(emitterCb) { + var reqPt = new stream.PassThrough() + .on('finish', function () { + listenerPtcl.createListener(function (listenerCb) { + var resPt = new stream.PassThrough() + .on('finish', function () { emitterCb(resPt); }); + listenerCb(resPt); + return reqPt; + }); + }); + return reqPt; + } + }); + + }); + + function run(setupFn) { + + test('single', function (done) { + var ptcl = createProtocol({ + protocol: 'Math', + messages: { + negate: { + request: [{name: 'n', type: 'int'}], + response: 'int' + } + } + }); + setupFn(ptcl, ptcl, function (ee) { + ee.on('eot', function () { done(); }); + ptcl.on('negate', function (req, ee, cb) { cb(null, -req.n); }); + ptcl.emit('negate', {n: 20}, ee, function (err, res) { + assert.equal(this, ptcl); + assert.strictEqual(err, null); + assert.equal(res, -20); + this.emit('negate', {n: 'hi'}, ee, function (err) { + assert(/invalid "int"/.test(err.string)); + ee.destroy(); + }); + }); + }); + }); + + test('invalid request', function (done) { + var ptcl = createProtocol({ + protocol: 'Math', + messages: { + negate: { + request: [{name: 'n', type: 'int'}], + response: 'int' + } + } + }).on('negate', function () { assert(false); }); + setupFn(ptcl, ptcl, function (ee) { + ee.on('eot', function () { done(); }); + ptcl.emit('negate', {n: 'a'}, ee, function (err) { + assert(/invalid "int"/.test(err.string), null); + ee.destroy(); + }); + }); + }); + + test('error response', function (done) { + var msg = 'must be non-negative'; + var ptcl = createProtocol({ + protocol: 'Math', + messages: { + sqrt: { + request: [{name: 'n', type: 'float'}], + response: 'float' + } + } + }).on('sqrt', function (req, ee, cb) { + var n = req.n; + if (n < 0) { + cb({string: msg}); + } else { + cb(null, Math.sqrt(n)); + } + }); + setupFn(ptcl, ptcl, function (ee) { + ptcl.emit('sqrt', {n: 100}, ee, function (err, res) { + assert(Math.abs(res - 10) < 1e-5); + ptcl.emit('sqrt', {n: - 10}, ee, function (err) { + assert.equal(this, ptcl); + assert.equal(err.string, msg); + done(); + }); + }); + }); + }); + + test('invalid response', function (done) { + var ptcl = createProtocol({ + protocol: 'Math', + messages: { + sqrt: { + request: [{name: 'n', type: 'float'}], + response: 'float' + } + } + }).on('sqrt', function (req, ee, cb) { + var n = req.n; + if (n < 0) { + cb(null, 'complex'); // Invalid response. + } else { + cb(null, Math.sqrt(n)); + } + }); + setupFn(ptcl, ptcl, function (ee) { + ptcl.emit('sqrt', {n: - 10}, ee, function (err) { + // The server error message is propagated to the client. + assert(/invalid "float"/.test(err.string)); + ptcl.emit('sqrt', {n: 100}, ee, function (err, res) { + // And the server doesn't die (we can make a new request). + assert(Math.abs(res - 10) < 1e-5); + done(); + }); + }); + }); + }); + + test('invalid error', function (done) { + var ptcl = createProtocol({ + protocol: 'Math', + messages: { + sqrt: { + request: [{name: 'n', type: 'float'}], + response: 'float' + } + } + }).on('sqrt', function (req, ee, cb) { + var n = req.n; + if (n < 0) { + cb({error: 'complex'}); // Invalid error. + } else { + cb(null, Math.sqrt(n)); + } + }); + setupFn(ptcl, ptcl, function (ee) { + ptcl.emit('sqrt', {n: - 10}, ee, function (err) { + assert(/invalid \["string"\]/.test(err.string)); + ptcl.emit('sqrt', {n: 100}, ee, function (err, res) { + // The server still doesn't die (we can make a new request). + assert(Math.abs(res - 10) < 1e-5); + done(); + }); + }); + }); + }); + + test('out of order', function (done) { + var ptcl = createProtocol({ + protocol: 'Delay', + messages: { + wait: { + request: [ + {name: 'ms', type: 'float'}, + {name: 'id', type: 'string'} + ], + response: 'string' + } + } + }).on('wait', function (req, ee, cb) { + var delay = req.ms; + if (delay < 0) { + cb(new Error('delay must be non-negative')); + return; + } + setTimeout(function () { cb(null, req.id); }, delay); + }); + var ids = []; + setupFn(ptcl, ptcl, function (ee) { + ee.on('eot', function (pending) { + assert.equal(pending, 0); + assert.deepEqual(ids, [null, 'b', 'a']); + done(); + }); + ptcl.emit('wait', {ms: 100, id: 'a'}, ee, function (err, res) { + assert.strictEqual(err, null); + ids.push(res); + }); + ptcl.emit('wait', {ms: 10, id: 'b'}, ee, function (err, res) { + assert.strictEqual(err, null); + ids.push(res); + ee.destroy(); + }); + ptcl.emit('wait', {ms: -100, id: 'c'}, ee, function (err, res) { + assert(/non-negative/.test(err.string)); + ids.push(res); + }); + }); + }); + + test('compatible protocols', function (done) { + var emitterPtcl = createProtocol({ + protocol: 'emitterProtocol', + messages: { + age: { + request: [{name: 'name', type: 'string'}], + response: 'long' + } + } + }); + var listenerPtcl = createProtocol({ + protocol: 'serverProtocol', + messages: { + age: { + request: [ + {name: 'name', type: 'string'}, + {name: 'address', type: ['null', 'string'], 'default': null} + ], + response: 'int' + }, + id: { + request: [{name: 'name', type: 'string'}], + response: 'long' + } + } + }); + setupFn( + emitterPtcl, + listenerPtcl, + function (ee) { + listenerPtcl.on('age', function (req, ee, cb) { + assert.equal(req.name, 'Ann'); + cb(null, 23); + }); + emitterPtcl.emit('age', {name: 'Ann'}, ee, function (err, res) { + assert.strictEqual(err, null); + assert.equal(res, 23); + done(); + }); + } + ); + }); + + test('cached compatible protocols', function (done) { + var ptcl1 = createProtocol({ + protocol: 'emitterProtocol', + messages: { + age: { + request: [{name: 'name', type: 'string'}], + response: 'long' + } + } + }); + var ptcl2 = createProtocol({ + protocol: 'serverProtocol', + messages: { + age: { + request: [ + {name: 'name', type: 'string'}, + {name: 'address', type: ['null', 'string'], 'default': null} + ], + response: 'int' + }, + id: { + request: [{name: 'name', type: 'string'}], + response: 'long' + } + } + }).on('age', function (req, ee, cb) { cb(null, 48); }); + setupFn( + ptcl1, + ptcl2, + function (ee1) { + ptcl1.emit('age', {name: 'Ann'}, ee1, function (err, res) { + assert.equal(res, 48); + setupFn( + ptcl1, + ptcl2, + function (ee2) { // ee2 has the server's protocol. + ptcl1.emit('age', {name: 'Bob'}, ee2, function (err, res) { + assert.equal(res, 48); + done(); + }); + } + ); + }); + } + ); + }); + + test('incompatible protocols', function (done) { + var emitterPtcl = createProtocol({ + protocol: 'emitterProtocol', + messages: { + age: {request: [{name: 'name', type: 'string'}], response: 'long'} + } + }); + var listenerPtcl = createProtocol({ + protocol: 'serverProtocol', + messages: { + age: {request: [{name: 'name', type: 'int'}], response: 'long'} + } + }).on('age', function (req, ee, cb) { cb(null, 0); }); + setupFn( + emitterPtcl, + listenerPtcl, + function (ee) { + ee.on('error', function () {}); // For stateful protocols. + emitterPtcl.emit('age', {name: 'Ann'}, ee, function (err) { + assert(err); + done(); + }); + } + ); + }); + + test('unknown message', function (done) { + var ptcl = createProtocol({protocol: 'Empty'}); + setupFn(ptcl, ptcl, function (ee) { + ptcl.emit('echo', {}, ee, function (err) { + assert(/unknown/.test(err.string)); + done(); + }); + }); + }); + + test('unsupported message', function (done) { + var ptcl = createProtocol({ + protocol: 'Echo', + messages: { + echo: { + request: [{name: 'id', type: 'string'}], + response: 'string' + } + } + }); + setupFn(ptcl, ptcl, function (ee) { + ptcl.emit('echo', {id: ''}, ee, function (err) { + assert(/unsupported/.test(err.string)); + done(); + }); + }); + }); + + test('destroy emitter noWait', function (done) { + var ptcl = createProtocol({ + protocol: 'Delay', + messages: { + wait: { + request: [{name: 'ms', type: 'int'}], + response: 'string' + } + } + }).on('wait', function (req, ee, cb) { + setTimeout(function () { cb(null, 'ok'); }, req.ms); + }); + var interrupted = 0; + var eoted = false; + setupFn(ptcl, ptcl, function (ee) { + ee.on('eot', function (pending) { + eoted = true; + assert.equal(interrupted, 2); + assert.equal(pending, 2); + done(); + }); + ptcl.emit('wait', {ms: 75}, ee, interruptedCb); + ptcl.emit('wait', {ms: 50}, ee, interruptedCb); + ptcl.emit('wait', {ms: 10}, ee, function (err, res) { + assert.equal(res, 'ok'); + ee.destroy(true); + }); + + function interruptedCb(err) { + assert(/interrupted/.test(err.string)); + interrupted++; + } + }); + }); + + test('destroy emitter', function (done) { + var ptcl = createProtocol({ + protocol: 'Math', + messages: { + negate: { + request: [{name: 'n', type: 'int'}], + response: 'int' + } + } + }); + setupFn(ptcl, ptcl, function (ee) { + ptcl.on('negate', function (req, ee, cb) { cb(null, -req.n); }); + ptcl.emit('negate', {n: 20}, ee, function (err, res) { + assert.strictEqual(err, null); + assert.equal(res, -20); + ee.destroy(); + this.emit('negate', {n: 'hi'}, ee, function (err) { + assert(/destroyed/.test(err.string)); + done(); + }); + }); + }); + }); + + } + + }); + + test('throw error', function () { + assert(!tryCatch(null)); + assert.equal(tryCatch(new Error('hi')), 'hi'); + assert.equal(tryCatch('hi'), 'hi'); + assert.equal(tryCatch({string: 'hi'}), 'hi'); + + function tryCatch(err) { + try { + protocols.throwError(err); + } catch (err_) { + return err_.message; + } + } + }); + +}); + +// Helpers. + +// Message framing. +function frame(buf) { + var framed = new Buffer(buf.length + 4); + framed.writeInt32BE(buf.length); + buf.copy(framed, 4); + return framed; +} + +function createReadableTransport(bufs, frameSize) { + return createReadableStream(bufs) + .pipe(new protocols.streams.MessageEncoder(frameSize || 64)); +} + +function createWritableTransport(bufs) { + var decoder = new protocols.streams.MessageDecoder(); + decoder.pipe(createWritableStream(bufs)); + return decoder; +} + +function createTransport(readBufs, writeBufs) { + return toDuplex( + createReadableTransport(readBufs), + createWritableTransport(writeBufs) + ); +} + +function createPassthroughTransports() { + var pt1 = stream.PassThrough(); + var pt2 = stream.PassThrough(); + return [{readable: pt1, writable: pt2}, {readable: pt2, writable: pt1}]; +} + +// Simplified stream constructor API isn't available in earlier node versions. + +function createReadableStream(bufs) { + var n = 0; + function Stream() { stream.Readable.call(this); } + util.inherits(Stream, stream.Readable); + Stream.prototype._read = function () { + this.push(bufs[n++] || null); + }; + var readable = new Stream(); + return readable; +} + +function createWritableStream(bufs) { + function Stream() { stream.Writable.call(this); } + util.inherits(Stream, stream.Writable); + Stream.prototype._write = function (buf, encoding, cb) { + bufs.push(buf); + cb(); + }; + return new Stream(); +} + +// Combine two (binary) streams into a single duplex one. This is very basic +// and doesn't handle a lot of cases (e.g. where `_read` doesn't return +// something). +function toDuplex(readable, writable) { + function Stream() { + stream.Duplex.call(this); + this.on('finish', function () { writable.end(); }); + } + util.inherits(Stream, stream.Duplex); + Stream.prototype._read = function () { + this.push(readable.read()); + }; + Stream.prototype._write = function (buf, encoding, cb) { + writable.write(buf); + cb(); + }; + return new Stream(); +} diff --git a/lang/js/test/test_schemas.js b/lang/js/test/test_schemas.js index cd9a7273895..b6d197bb239 100644 --- a/lang/js/test/test_schemas.js +++ b/lang/js/test/test_schemas.js @@ -1926,6 +1926,17 @@ suite('types', function () { assert.deepEqual(person.age, 12); assert.deepEqual(person.time, date); assert.throws(function () { derived.toBuffer({age: -1, date: date}); }); + + var invalid = {age: -1, time: date}; + assert.throws(function () { derived.toBuffer(invalid); }); + var hasError = false; + derived.isValid(invalid, {errorHook: function (path, any, type) { + hasError = true; + assert.deepEqual(path, ['age']); + assert.equal(any, -1); + assert(type instanceof AgeType); + }}); + assert(hasError); }); test('recursive', function () { From ec9e1e14b3137324b3201c0a439a91253fa64c9d Mon Sep 17 00:00:00 2001 From: Kevin Schultz Date: Wed, 9 Dec 2015 16:01:59 -0500 Subject: [PATCH 034/116] AVRO-1493: Java: Schema fingerprint vary by locale --- CHANGES.txt | 5 ++++- .../src/main/java/org/apache/avro/Schema.java | 9 ++++---- .../apache/avro/TestSchemaNormalization.java | 21 +++++++++++++++++++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index aa84b9ece5c..cadc982b950 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -17,6 +17,9 @@ Trunk (not yet released) BUG FIXES + AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are + now consistent regardless of the environment's locale. + Avro 1.8.0 (22 January 2016) INCOMPATIBLE CHANGES @@ -50,7 +53,7 @@ Avro 1.8.0 (22 January 2016) (Ryan Blue via cutting) AVRO-570. Python: Add connector for tethered mapreduce. - (Jeremy Lewi and Steven Willis via cutting) + (Jeremy Lewi and Steven Willis via cutting) AVRO-834. Java: Data File corruption recovery tool. (scottcarey and tomwhite) diff --git a/lang/java/avro/src/main/java/org/apache/avro/Schema.java b/lang/java/avro/src/main/java/org/apache/avro/Schema.java index 9a201ce45fa..600f7aaffe4 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/Schema.java +++ b/lang/java/avro/src/main/java/org/apache/avro/Schema.java @@ -32,6 +32,7 @@ import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; @@ -93,7 +94,7 @@ public enum Type { RECORD, ENUM, ARRAY, MAP, UNION, FIXED, STRING, BYTES, INT, LONG, FLOAT, DOUBLE, BOOLEAN, NULL; private String name; - private Type() { this.name = this.name().toLowerCase(); } + private Type() { this.name = this.name().toLowerCase(Locale.ENGLISH); } public String getName() { return name; } }; @@ -377,7 +378,7 @@ public static class Field extends JsonProperties { public enum Order { ASCENDING, DESCENDING, IGNORE; private String name; - private Order() { this.name = this.name().toLowerCase(); } + private Order() { this.name = this.name().toLowerCase(Locale.ENGLISH); } }; private final String name; // name of the field. @@ -749,7 +750,7 @@ public EnumSchema(Name name, String doc, throw new SchemaParseException("Duplicate enum symbol: "+symbol); } public List getEnumSymbols() { return symbols; } - public boolean hasEnumSymbol(String symbol) { + public boolean hasEnumSymbol(String symbol) { return ordinals.containsKey(symbol); } public int getEnumOrdinal(String symbol) { return ordinals.get(symbol); } public boolean equals(Object o) { @@ -1269,7 +1270,7 @@ static Schema parse(JsonNode schema, Names names) { Field.Order order = Field.Order.ASCENDING; JsonNode orderNode = field.get("order"); if (orderNode != null) - order = Field.Order.valueOf(orderNode.getTextValue().toUpperCase()); + order = Field.Order.valueOf(orderNode.getTextValue().toUpperCase(Locale.ENGLISH)); JsonNode defaultValue = field.get("default"); if (defaultValue != null && (Type.FLOAT.equals(fieldSchema.getType()) diff --git a/lang/java/avro/src/test/java/org/apache/avro/TestSchemaNormalization.java b/lang/java/avro/src/test/java/org/apache/avro/TestSchemaNormalization.java index 405d74d1f74..f8c04130d89 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/TestSchemaNormalization.java +++ b/lang/java/avro/src/test/java/org/apache/avro/TestSchemaNormalization.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.ArrayList; import java.util.Formatter; +import java.util.Locale; import org.junit.Test; import org.junit.runner.RunWith; @@ -68,6 +69,26 @@ public static class TestFingerprint { } } + // see AVRO-1493 + @RunWith(Parameterized.class) + public static class TestFingerprintInternationalization { + String input, expectedOutput; + public TestFingerprintInternationalization(String i, String o) { input=i; expectedOutput=o; } + + @Parameters public static List cases() throws IOException + { return CaseFinder.find(data(),"fingerprint",new ArrayList()); } + + @Test public void testCanonicalization() throws Exception { + Locale originalDefaultLocale = Locale.getDefault(); + Locale.setDefault(Locale.forLanguageTag("tr")); + Schema s = Schema.parse(input); + long carefulFP = altFingerprint(SchemaNormalization.toParsingForm(s)); + assertEquals(carefulFP, Long.parseLong(expectedOutput)); + assertEqHex(carefulFP, SchemaNormalization.parsingFingerprint64(s)); + Locale.setDefault(originalDefaultLocale); + } + } + private static String DATA_FILE = (System.getProperty("share.dir", "../../../share") + "/test/data/schema-tests.txt"); From 1bc650dd6dbe7e87c59553e13f037481ee50abb6 Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Sun, 21 Feb 2016 18:16:07 -0800 Subject: [PATCH 035/116] AVRO-1799: Fix GenericRecord#toString ByteBuffer bug. Reading the ByteBuffer to return a string representaton modified the buffer's position. The solution is to duplicate the buffer before reading its content. --- CHANGES.txt | 2 ++ .../src/main/java/org/apache/avro/generic/GenericData.java | 2 +- .../test/java/org/apache/avro/generic/TestGenericData.java | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index cadc982b950..00d9deb24af 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -20,6 +20,8 @@ Trunk (not yet released) AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are now consistent regardless of the environment's locale. + AVRO-1799: Fix GenericRecord#toString ByteBuffer handling. (blue) + Avro 1.8.0 (22 January 2016) INCOMPATIBLE CHANGES diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java index 7c70631df52..2b01de408c0 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java +++ b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java @@ -547,7 +547,7 @@ protected void toString(Object datum, StringBuilder buffer) { buffer.append("\""); } else if (isBytes(datum)) { buffer.append("{\"bytes\": \""); - ByteBuffer bytes = (ByteBuffer)datum; + ByteBuffer bytes = ((ByteBuffer) datum).duplicate(); writeEscapedString(StandardCharsets.ISO_8859_1.decode(bytes), buffer); buffer.append("\"}"); } else if (((datum instanceof Float) && // quote Nan & Infinity diff --git a/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericData.java b/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericData.java index 68c33b61632..b8b59e244c7 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericData.java +++ b/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericData.java @@ -321,7 +321,9 @@ public void testToStringIsJson() throws JsonParseException, IOException { @Test public void testToStringEscapesControlCharsInBytes() throws Exception { GenericData data = GenericData.get(); - assertEquals("{\"bytes\": \"a\\nb\"}", data.toString(ByteBuffer.wrap(new byte[] {'a', '\n', 'b'}))); + ByteBuffer bytes = ByteBuffer.wrap(new byte[] {'a', '\n', 'b'}); + assertEquals("{\"bytes\": \"a\\nb\"}", data.toString(bytes)); + assertEquals("{\"bytes\": \"a\\nb\"}", data.toString(bytes)); } @Test public void testToStringFixed() throws Exception { From cb3e24b5bb3ec9049a0e7258003e09f1bddfad6f Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Sun, 6 Mar 2016 19:09:58 -0800 Subject: [PATCH 036/116] AVRO-1667: Fix parser grammar flattening for recursive cases. Contributed by Zoltan Farkas. Recursive records use a Fixup class to copy sequences of parser Symbols because the final sequence isn't yet known. But these weren't being copied when the sequences being fixed up were copied, which caused the final grammar to have nulls in some cases. --- CHANGES.txt | 3 + .../org/apache/avro/io/parsing/Symbol.java | 16 +++- .../apache/avro/io/parsing/SymbolTest.java | 75 +++++++++++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 lang/java/avro/src/test/java/org/apache/avro/io/parsing/SymbolTest.java diff --git a/CHANGES.txt b/CHANGES.txt index 00d9deb24af..e1a2611ddc5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -22,6 +22,9 @@ Trunk (not yet released) AVRO-1799: Fix GenericRecord#toString ByteBuffer handling. (blue) + AVRO-1667: Fix parser grammar flattening for recursive cases. + (Zoltan Farkas via blue) + Avro 1.8.0 (22 January 2016) INCOMPATIBLE CHANGES diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java index 08a9d14ec3f..80ae6442b47 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java @@ -68,7 +68,7 @@ public enum Kind { * problem, we initialize the symbol with an array of nulls. Later we * fill the symbols. Not clean, but works. The other option is to not have * this field a final. But keeping it final and thus keeping symbol immutable - * gives some confort. See various generators how we generate records. + * gives some comfort. See various generators how we generate records. */ public final Symbol[] production; /** @@ -190,6 +190,10 @@ static void flatten(Symbol[] in, int start, List l = map2.get(s); if (l == null) { System.arraycopy(p, 0, out, j, p.length); + // Copy any fixups that will be applied to p to add missing symbols + for (List fixups : map2.values()) { + copyFixups(fixups, out, j, p); + } } else { l.add(new Fixup(out, j)); } @@ -200,6 +204,16 @@ static void flatten(Symbol[] in, int start, } } + private static void copyFixups(List fixups, Symbol[] out, int outPos, + Symbol[] toCopy) { + for (int i = 0, n = fixups.size(); i < n; i += 1) { + Fixup fixup = fixups.get(i); + if (fixup.symbols == toCopy) { + fixups.add(new Fixup(out, fixup.pos + outPos)); + } + } + } + /** * Returns the amount of space required to flatten the given * sub-array of symbols. diff --git a/lang/java/avro/src/test/java/org/apache/avro/io/parsing/SymbolTest.java b/lang/java/avro/src/test/java/org/apache/avro/io/parsing/SymbolTest.java new file mode 100644 index 00000000000..ac372bb178f --- /dev/null +++ b/lang/java/avro/src/test/java/org/apache/avro/io/parsing/SymbolTest.java @@ -0,0 +1,75 @@ +/* + * Copyright 2016 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.avro.io.parsing; + + +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Set; +import junit.framework.Assert; +import org.apache.avro.Schema; +import org.junit.Test; + +/** + * Unit test to verify that recursive schemas are flattened correctly. + * See AVRO-1667. + */ +public class SymbolTest { + + private static final String SCHEMA = "{\"type\":\"record\",\"name\":\"SampleNode\"," + + "\"namespace\":\"org.spf4j.ssdump2.avro\",\n" + + " \"fields\":[\n" + + " {\"name\":\"count\",\"type\":\"int\",\"default\":0},\n" + + " {\"name\":\"subNodes\",\"type\":\n" + + " {\"type\":\"array\",\"items\":{\n" + + " \"type\":\"record\",\"name\":\"SamplePair\",\n" + + " \"fields\":[\n" + + " {\"name\":\"method\",\"type\":\n" + + " {\"type\":\"record\",\"name\":\"Method\",\n" + + " \"fields\":[\n" + + " {\"name\":\"declaringClass\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},\n" + + " {\"name\":\"methodName\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}\n" + + " ]}},\n" + + " {\"name\":\"node\",\"type\":\"SampleNode\"}]}}}]}"; + + @Test + public void testSomeMethod() throws IOException { + Schema schema = new Schema.Parser().parse(SCHEMA); + + Symbol root = Symbol.root(new ResolvingGrammarGenerator() + .generate(schema, schema, new HashMap())); + validateNonNull(root, new HashSet()); + } + + private static void validateNonNull(final Symbol symb, Set seen) { + if (seen.contains(symb)) { + return; + } else { + seen.add(symb); + } + if (symb.production != null) { + for (Symbol s : symb.production) { + if (s == null) { + Assert.fail("invalid parsing tree should not contain nulls"); + } + if (s.kind != Symbol.Kind.ROOT) { + validateNonNull(s, seen); + } + } + } + } +} From 9d3bcfa2f7a39ec6136baab18286a3d6006e4df7 Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Sat, 9 Apr 2016 15:46:28 -0700 Subject: [PATCH 037/116] AVRO-1824: C++: Update required packages in docs. Contributed by William S. Fulton. --- CHANGES.txt | 2 ++ lang/c++/MainPage.dox | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index e1a2611ddc5..b44745f22d0 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -15,6 +15,8 @@ Trunk (not yet released) AVRO-1778: JavaScript: Add IPC/RPC support. (mtth) + AVRO-1824: C++: Fix docs for building Avro C++. (William S. Fulton via blue) + BUG FIXES AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are diff --git a/lang/c++/MainPage.dox b/lang/c++/MainPage.dox index d5e00d6d871..7a882609a68 100644 --- a/lang/c++/MainPage.dox +++ b/lang/c++/MainPage.dox @@ -68,8 +68,9 @@ For Ubuntu Linux, for example, you can have these by doing \li g++ \li libboost-dev \li libboost-filesystem-dev -\li libboost-system-dev +\li libboost-iostreams-dev \li libboost-program-options-dev +\li libboost-system-dev For Windows native builds, you need to install the following: \ul From 6dbaf6af9bd32fa31dfefdde199f16d9892127ee Mon Sep 17 00:00:00 2001 From: "Thiruvalluvan M. G" Date: Wed, 13 Apr 2016 10:53:29 +0530 Subject: [PATCH 038/116] AVRO-1784. C++: Should have a json encoder that pretty prints --- CHANGES.txt | 2 + lang/c++/api/Encoder.hh | 7 ++- lang/c++/impl/json/JsonDom.cc | 4 +- lang/c++/impl/json/JsonDom.hh | 5 +- lang/c++/impl/json/JsonIO.cc | 19 ------ lang/c++/impl/json/JsonIO.hh | 78 +++++++++++++++++++++++- lang/c++/impl/parsing/JsonCodec.cc | 97 ++++++++++++++++-------------- lang/c++/test/CodecTests.cc | 14 ++++- 8 files changed, 154 insertions(+), 72 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index b44745f22d0..1399a9477ca 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -89,6 +89,8 @@ Avro 1.8.0 (22 January 2016) AVRO-1767. JS: Fall back to unwrapped union values. (Matthieu Monsch via blue) + AVRO-1784. C++: Should have a json encoder that pretty prints. (John McClean via thiru) + OPTIMIZATIONS AVRO-1760. Java: Thread scalability problem with the use of SynchronizedMap diff --git a/lang/c++/api/Encoder.hh b/lang/c++/api/Encoder.hh index a5dce71e35f..e13fa697bb8 100644 --- a/lang/c++/api/Encoder.hh +++ b/lang/c++/api/Encoder.hh @@ -156,10 +156,15 @@ AVRO_DECL EncoderPtr validatingEncoder(const ValidSchema& schema, const EncoderPtr& base); /** - * Returns an encoder that can encode Avro standard for JSON. + * Returns an encoder that encodes Avro standard for JSON. */ AVRO_DECL EncoderPtr jsonEncoder(const ValidSchema& schema); +/** + * Returns an encoder that encodes Avro standard for pretty printed JSON. + */ +AVRO_DECL EncoderPtr jsonPrettyEncoder(const ValidSchema& schema); + } // namespace avro #endif diff --git a/lang/c++/impl/json/JsonDom.cc b/lang/c++/impl/json/JsonDom.cc index 4c70b32206d..3f52f363b3c 100644 --- a/lang/c++/impl/json/JsonDom.cc +++ b/lang/c++/impl/json/JsonDom.cc @@ -110,7 +110,7 @@ Entity loadEntity(const uint8_t* text, size_t len) return loadEntity(*in); } -void writeEntity(JsonGenerator& g, const Entity& n) +void writeEntity(JsonGenerator& g, const Entity& n) { switch (n.type()) { case etNull: @@ -166,7 +166,7 @@ void Entity::ensureType(EntityType type) const std::string Entity::toString() const { std::auto_ptr out = memoryOutputStream(); - JsonGenerator g; + JsonGenerator g; g.init(*out); writeEntity(g, *this); g.flush(); diff --git a/lang/c++/impl/json/JsonDom.hh b/lang/c++/impl/json/JsonDom.hh index ae99d4fe8b5..7de4fbcde36 100644 --- a/lang/c++/impl/json/JsonDom.hh +++ b/lang/c++/impl/json/JsonDom.hh @@ -44,6 +44,9 @@ typedef std::vector Array; typedef std::map Object; class AVRO_DECL JsonParser; +class JsonNullFormatter; + +template class AVRO_DECL JsonGenerator; enum EntityType { @@ -144,7 +147,7 @@ AVRO_DECL Entity loadEntity(InputStream& in); AVRO_DECL Entity loadEntity(const char* text); AVRO_DECL Entity loadEntity(const uint8_t* text, size_t len); -void writeEntity(JsonGenerator& g, const Entity& n); +void writeEntity(JsonGenerator& g, const Entity& n); } } diff --git a/lang/c++/impl/json/JsonIO.cc b/lang/c++/impl/json/JsonIO.cc index f21e822de4d..2e7d82fc4db 100644 --- a/lang/c++/impl/json/JsonIO.cc +++ b/lang/c++/impl/json/JsonIO.cc @@ -16,7 +16,6 @@ * limitations under the License. */ -#include "boost/math/special_functions/fpclassify.hpp" #include "JsonIO.hh" namespace avro { @@ -351,24 +350,6 @@ JsonParser::Token JsonParser::tryLiteral(const char exp[], size_t n, Token tk) return tk; } -void JsonGenerator::encodeNumber(double t) { - sep(); - std::ostringstream oss; - if (boost::math::isfinite(t)) { - oss << t; - } else if (boost::math::isnan(t)) { - oss << "NaN"; - } else if (t == std::numeric_limits::infinity()) { - oss << "Infinity"; - } else { - oss << "-Infinity"; - } - const std::string& s = oss.str(); - out_.writeBytes(reinterpret_cast(&s[0]), s.size()); - sep2(); -} - - } } diff --git a/lang/c++/impl/json/JsonIO.hh b/lang/c++/impl/json/JsonIO.hh index 1406d7a9614..a5ada2db8ba 100644 --- a/lang/c++/impl/json/JsonIO.hh +++ b/lang/c++/impl/json/JsonIO.hh @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "Config.hh" @@ -132,8 +133,58 @@ public: } }; +struct AVRO_DECL JsonNullFormatter { + JsonNullFormatter(StreamWriter&) { } + + void handleObjectStart() {} + void handleObjectEnd() {} + void handleValueEnd() {} + void handleColon() {} +}; + +class AVRO_DECL JsonPrettyFormatter { + StreamWriter& out_; + size_t level_; + std::vector indent_; + + static const int CHARS_PER_LEVEL = 2; + + void printIndent() { + size_t charsToIndent = level_ * CHARS_PER_LEVEL; + if (indent_.size() < charsToIndent) { + indent_.resize(charsToIndent * 2, ' '); + } + out_.writeBytes(&(indent_[0]), charsToIndent); + } +public: + JsonPrettyFormatter(StreamWriter& out) : out_(out), level_(0), indent_(10, ' ') { } + + void handleObjectStart() { + out_.write('\n'); + ++level_; + printIndent(); + } + + void handleObjectEnd() { + out_.write('\n'); + --level_; + printIndent(); + } + + void handleValueEnd() { + out_.write('\n'); + printIndent(); + } + + void handleColon() { + out_.write(' '); + } +}; + +template class AVRO_DECL JsonGenerator { StreamWriter out_; + F formatter_; enum State { stStart, stArray0, @@ -210,6 +261,7 @@ class AVRO_DECL JsonGenerator { void sep() { if (top == stArrayN) { out_.write(','); + formatter_.handleValueEnd(); } else if (top == stArray0) { top = stArrayN; } @@ -222,7 +274,7 @@ class AVRO_DECL JsonGenerator { } public: - JsonGenerator() : top(stStart) { } + JsonGenerator() : formatter_(out_), top(stStart) { } void init(OutputStream& os) { out_.reset(os); @@ -258,13 +310,30 @@ public: sep2(); } - void encodeNumber(double t); + void encodeNumber(double t) { + sep(); + std::ostringstream oss; + if (boost::math::isfinite(t)) { + oss << t; + } else if (boost::math::isnan(t)) { + oss << "NaN"; + } else if (t == std::numeric_limits::infinity()) { + oss << "Infinity"; + } else { + oss << "-Infinity"; + } + const std::string& s = oss.str(); + out_.writeBytes(reinterpret_cast(&s[0]), s.size()); + sep2(); + } + void encodeString(const std::string& s) { if (top == stMap0) { top = stKey; } else if (top == stMapN) { out_.write(','); + formatter_.handleValueEnd(); top = stKey; } else if (top == stKey) { top = stMapN; @@ -274,6 +343,7 @@ public: doEncodeString(s); if (top == stKey) { out_.write(':'); + formatter_.handleColon(); } } @@ -293,11 +363,13 @@ public: stateStack.push(top); top = stArray0; out_.write('['); + formatter_.handleObjectStart(); } void arrayEnd() { top = stateStack.top(); stateStack.pop(); + formatter_.handleObjectEnd(); out_.write(']'); sep2(); } @@ -307,11 +379,13 @@ public: stateStack.push(top); top = stMap0; out_.write('{'); + formatter_.handleObjectStart(); } void objectEnd() { top = stateStack.top(); stateStack.pop(); + formatter_.handleObjectEnd(); out_.write('}'); sep2(); } diff --git a/lang/c++/impl/parsing/JsonCodec.cc b/lang/c++/impl/parsing/JsonCodec.cc index f18a1c9f4dc..ead44cab5bc 100644 --- a/lang/c++/impl/parsing/JsonCodec.cc +++ b/lang/c++/impl/parsing/JsonCodec.cc @@ -54,6 +54,7 @@ using std::istringstream; using avro::json::JsonParser; using avro::json::JsonGenerator; +using avro::json::JsonNullFormatter; class JsonGrammarGenerator : public ValidatingGrammarGenerator { ProductionPtr doGenerate(const NodePtr& n, @@ -464,11 +465,11 @@ size_t JsonDecoder

    ::decodeUnionIndex() return result; } - +template class JsonHandler { - JsonGenerator& generator_; + JsonGenerator& generator_; public: - JsonHandler(JsonGenerator& g) : generator_(g) { } + JsonHandler(JsonGenerator& g) : generator_(g) { } size_t handle(const Symbol& s) { switch (s.kind()) { case Symbol::sRecordStart: @@ -487,10 +488,10 @@ class JsonHandler { } }; -template +template class JsonEncoder : public Encoder { - JsonGenerator out_; - JsonHandler handler_; + JsonGenerator out_; + JsonHandler handler_; P parser_; void init(OutputStream& os); @@ -518,49 +519,49 @@ class JsonEncoder : public Encoder { parser_(JsonGrammarGenerator().generate(schema), NULL, handler_) { } }; -template -void JsonEncoder

    ::init(OutputStream& os) +template +void JsonEncoder::init(OutputStream& os) { out_.init(os); } -template -void JsonEncoder

    ::flush() +template +void JsonEncoder::flush() { parser_.processImplicitActions(); out_.flush(); } -template -void JsonEncoder

    ::encodeNull() +template +void JsonEncoder::encodeNull() { parser_.advance(Symbol::sNull); out_.encodeNull(); } -template -void JsonEncoder

    ::encodeBool(bool b) +template +void JsonEncoder::encodeBool(bool b) { parser_.advance(Symbol::sBool); out_.encodeBool(b); } -template -void JsonEncoder

    ::encodeInt(int32_t i) +template +void JsonEncoder::encodeInt(int32_t i) { parser_.advance(Symbol::sInt); out_.encodeNumber(i); } -template -void JsonEncoder

    ::encodeLong(int64_t l) +template +void JsonEncoder::encodeLong(int64_t l) { parser_.advance(Symbol::sLong); out_.encodeNumber(l); } -template -void JsonEncoder

    ::encodeFloat(float f) +template +void JsonEncoder::encodeFloat(float f) { parser_.advance(Symbol::sFloat); if (f == std::numeric_limits::infinity()) { @@ -574,8 +575,8 @@ void JsonEncoder

    ::encodeFloat(float f) } } -template -void JsonEncoder

    ::encodeDouble(double d) +template +void JsonEncoder::encodeDouble(double d) { parser_.advance(Symbol::sDouble); if (d == std::numeric_limits::infinity()) { @@ -589,74 +590,74 @@ void JsonEncoder

    ::encodeDouble(double d) } } -template -void JsonEncoder

    ::encodeString(const std::string& s) +template +void JsonEncoder::encodeString(const std::string& s) { parser_.advance(Symbol::sString); out_.encodeString(s); } -template -void JsonEncoder

    ::encodeBytes(const uint8_t *bytes, size_t len) +template +void JsonEncoder::encodeBytes(const uint8_t *bytes, size_t len) { parser_.advance(Symbol::sBytes); out_.encodeBinary(bytes, len); } -template -void JsonEncoder

    ::encodeFixed(const uint8_t *bytes, size_t len) +template +void JsonEncoder::encodeFixed(const uint8_t *bytes, size_t len) { parser_.advance(Symbol::sFixed); parser_.assertSize(len); out_.encodeBinary(bytes, len); } -template -void JsonEncoder

    ::encodeEnum(size_t e) +template +void JsonEncoder::encodeEnum(size_t e) { parser_.advance(Symbol::sEnum); const string& s = parser_.nameForIndex(e); out_.encodeString(s); } -template -void JsonEncoder

    ::arrayStart() +template +void JsonEncoder::arrayStart() { parser_.advance(Symbol::sArrayStart); out_.arrayStart(); } -template -void JsonEncoder

    ::arrayEnd() +template +void JsonEncoder::arrayEnd() { parser_.popRepeater(); parser_.advance(Symbol::sArrayEnd); out_.arrayEnd(); } -template -void JsonEncoder

    ::mapStart() +template +void JsonEncoder::mapStart() { parser_.advance(Symbol::sMapStart); out_.objectStart(); } -template -void JsonEncoder

    ::mapEnd() +template +void JsonEncoder::mapEnd() { parser_.popRepeater(); parser_.advance(Symbol::sMapEnd); out_.objectEnd(); } -template -void JsonEncoder

    ::setItemCount(size_t count) +template +void JsonEncoder::setItemCount(size_t count) { parser_.setRepeatCount(count); } -template -void JsonEncoder

    ::startItem() +template +void JsonEncoder::startItem() { parser_.processImplicitActions(); if (parser_.top() != Symbol::sRepeater) { @@ -664,8 +665,8 @@ void JsonEncoder

    ::startItem() } } -template -void JsonEncoder

    ::encodeUnionIndex(size_t e) +template +void JsonEncoder::encodeUnionIndex(size_t e) { parser_.advance(Symbol::sUnion); @@ -689,7 +690,13 @@ DecoderPtr jsonDecoder(const ValidSchema& s) EncoderPtr jsonEncoder(const ValidSchema& schema) { return boost::make_shared > >(schema); + parsing::SimpleParser >, avro::json::JsonNullFormatter> >(schema); +} + +EncoderPtr jsonPrettyEncoder(const ValidSchema& schema) +{ + return boost::make_shared >, avro::json::JsonPrettyFormatter> >(schema); } } // namespace avro diff --git a/lang/c++/test/CodecTests.cc b/lang/c++/test/CodecTests.cc index 61d29a29a07..c0ca1e05b72 100644 --- a/lang/c++/test/CodecTests.cc +++ b/lang/c++/test/CodecTests.cc @@ -60,7 +60,7 @@ static const unsigned int count = 10; /** * A bunch of tests that share quite a lot of infrastructure between them. - * The basic idea is to generate avro data for according to a schema and + * The basic idea is to generate avro data according to a schema and * then read back and compare the data with the original. But quite a few * variations are possible: * 1. While reading back, one can skip different data elements @@ -1385,6 +1385,15 @@ struct JsonCodec { } }; +struct JsonPrettyCodec { + static EncoderPtr newEncoder(const ValidSchema& schema) { + return jsonPrettyEncoder(schema); + } + static DecoderPtr newDecoder(const ValidSchema& schema) { + return jsonDecoder(schema); + } +}; + struct BinaryEncoderResolvingDecoderFactory : public BinaryEncoderFactory { static DecoderPtr newDecoder(const ValidSchema& schema) { return resolvingDecoder(schema, schema, binaryDecoder()); @@ -1415,6 +1424,7 @@ void add_tests(boost::unit_test::test_suite& ts) ADD_TESTS(ts, BinaryCodecFactory, testCodec, data); ADD_TESTS(ts, ValidatingCodecFactory, testCodec, data); ADD_TESTS(ts, JsonCodec, testCodec, data); + ADD_TESTS(ts, JsonPrettyCodec, testCodec, data); ADD_TESTS(ts, BinaryEncoderResolvingDecoderFactory, testCodec, data); ADD_TESTS(ts, ValidatingCodecFactory, testReaderFail, data2); ADD_TESTS(ts, ValidatingCodecFactory, testWriterFail, data2); @@ -1500,6 +1510,7 @@ static void testLimitsJsonCodec() "]}"; ValidSchema schema = parsing::makeValidSchema(s); testLimits(jsonEncoder(schema), jsonDecoder(schema)); + testLimits(jsonPrettyEncoder(schema), jsonDecoder(schema)); } struct JsonData { @@ -1522,7 +1533,6 @@ static void testJson(const JsonData& data) { ValidSchema schema = parsing::makeValidSchema(data.schema); EncoderPtr e = jsonEncoder(schema); - } } // namespace avro From 7251072c317cea12cb4bf6056d7149d82516db73 Mon Sep 17 00:00:00 2001 From: "Thiruvalluvan M. G" Date: Wed, 13 Apr 2016 11:32:28 +0530 Subject: [PATCH 039/116] AVRO-1701: Fix for "warning: comparison between 'const enum testgen_r::ExampleEnum' and 'const enum testgen::ExampleEnum" --- CHANGES.txt | 2 ++ lang/c++/test/AvrogencppTests.cc | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 1399a9477ca..ca8e207b219 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -17,6 +17,8 @@ Trunk (not yet released) AVRO-1824: C++: Fix docs for building Avro C++. (William S. Fulton via blue) + AVRO-1701: Fix for "warning: comparison between 'const enum testgen_r::ExampleEnum' and 'const enum testgen::ExampleEnum'" (peter liu via thiru) + BUG FIXES AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are diff --git a/lang/c++/test/AvrogencppTests.cc b/lang/c++/test/AvrogencppTests.cc index 2312676e935..26d015599f6 100644 --- a/lang/c++/test/AvrogencppTests.cc +++ b/lang/c++/test/AvrogencppTests.cc @@ -121,7 +121,13 @@ void checkRecord(const T1& r1, const T2& r2) BOOST_CHECK_EQUAL(r1.bytes.size(), r2.bytes.size()); BOOST_CHECK_EQUAL_COLLECTIONS(r1.bytes.begin(), r1.bytes.end(), r2.bytes.begin(), r2.bytes.end()); - BOOST_CHECK_EQUAL(r1.myenum, r2.myenum); + /** + * Usually, comparing two different enums is not reliable. But here it fine because we + * know the generated code and are merely checking if Avro did the right job. + * Also, converting enum into unsigned int is not always safe. There are cases there could be + * truncation. Again, we have a controlled situation and it is safe here. + */ + BOOST_CHECK_EQUAL(static_cast(r1.myenum), static_cast(r2.myenum)); } void checkDefaultValues(const testgen_r::RootRecord& r) From 60450656cb3bdddb73a322d24be27aeb854738b8 Mon Sep 17 00:00:00 2001 From: "Thiruvalluvan M. G" Date: Sat, 16 Apr 2016 08:46:05 +0530 Subject: [PATCH 040/116] AVRO-1829. C++ documentation improvements --- CHANGES.txt | 2 ++ lang/c++/MainPage.dox | 32 ++++++++++++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index ca8e207b219..dd4181001c6 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -29,6 +29,8 @@ Trunk (not yet released) AVRO-1667: Fix parser grammar flattening for recursive cases. (Zoltan Farkas via blue) + AVRO-1829. C++ documentation improvements (William S Fulton via thiru) + Avro 1.8.0 (22 January 2016) INCOMPATIBLE CHANGES diff --git a/lang/c++/MainPage.dox b/lang/c++/MainPage.dox index 7a882609a68..3830f1efeb4 100644 --- a/lang/c++/MainPage.dox +++ b/lang/c++/MainPage.dox @@ -24,7 +24,7 @@

    Avro is a data serialization system. See http://avro.apache.org/docs/current/ for background information.

    -

    Avro C++ is a C++ library which implementats parts of the Avro Specification. The library includes the following functionality:

    +

    Avro C++ is a C++ library which implements parts of the Avro Specification. The library includes the following functionality:

    • Assembling schemas programmatically.
    • A schema parser, which can parse Avro schema (written in JSON) into a Schema object. @@ -33,21 +33,21 @@ for background information.

    • A binary encoder, which encodes into binary Avro data.
    • A JSON encoder, which encodes into JSON Avro data.
    • A validating encoder, an encoder proxy, which validates the call sequence to the encoder before sending the calls to another encoder. -
    • A binary decoder, which decodes binay Avro data. +
    • A binary decoder, which decodes binary Avro data.
    • A JSON decoder, which decodes JSON Avro data.
    • A validating decoder, a decoder proxy, which validates the call sequence to the decoder before sending the calls to another decoder.
    • A resolving decoder, which accepts calls for according to a reader's schema but decodes data corresponding to a different (writer's) schema doing schema resolution according to resolution rules in the Avro specification.
  • Streams for storing and reading data, which Encoders and Decoders use.
  • Support for Avro DataFile. -
  • A code generator, which generates C++ classes fnd functions to encode and decode them. The code generator produces a C++ header file from a given schema file. +
  • A code generator, which generates C++ classes and functions to encode and decode them. The code generator produces a C++ header file from a given schema file. Presently there is no support for the following specified in Avro specification.
    • Avro RPC
    -Note: Prior to Avro release 1.5, some of the functionality mentioned above was avilable through a somewhat different API and set tools. They are partially incompatible to the present ones. They continue to be available but will be deprecated and discontinued sometime in the future. The documentation on that API can be found at http://avro.apache.org/docs/1.4.0/api/cpp/html/index.html +Note: Prior to Avro release 1.5, some of the functionality mentioned above was available through a somewhat different API and set tools. They are partially incompatible to the present ones. They continue to be available but will be deprecated and discontinued sometime in the future. The documentation on that API can be found at http://avro.apache.org/docs/1.4.0/api/cpp/html/index.html

    Installing Avro C++

    Supported platforms and pre-requisites

    @@ -56,7 +56,7 @@ One should be able to build Avro C++ on (1) any UNIX flavor including cygwin for In order to build Avro C++, one needs the following:
    • A C++ compiler and runtime libraries. -
    • Boost library version 1.38 or later. Apart from the header-only libraries of Boost, Avro C++ requires filesystem, system and program_options libraries. Please see http://www.boost.org or your platform's documentation for details on how to set up Boost for your platform. +
    • Boost library version 1.38 or later. Apart from the header-only libraries of Boost, Avro C++ requires filesystem, iostreams, system and program_options libraries. Please see http://www.boost.org or your platform's documentation for details on how to set up Boost for your platform.
    • CMake build tool version 2.6 or later. Please see http://www.cmake.org or your platform's documentation for details on how to set up CMake for your system.
    • Python. If not already present, please consult your platform-specific documentation on how to install Python on your system.
    @@ -94,7 +94,7 @@ Please see the main documentation if you want to build anything more than Avro C

    On native Windows

      -
    1. Ensure that Cmake's bin directory and Boost's lib directory are in the path. +
    2. Ensure that CMake's bin directory and Boost's lib directory are in the path.
    3. Expand the tarball into a directory.
    4. Change to lang/c++ subdirectory.
    5. Create a subdirectory, say, build.win, and change to that directory. @@ -135,7 +135,7 @@ avrogencpp -i cpx.json -o cpx.hh -n c The -i flag specifies the input schema file and -o flag specifies the output header file to generate. The generated C++ code will be -in the namespace specifed with -n flag. +in the namespace specified with -n flag.

      The generated file, among other things will have the following: @@ -168,7 +168,7 @@ Now let's see how we can use the code generated to encode data into avro and dec In line 9, we construct a memory output stream. By this we indicate that we want to send the encoded Avro data into memory. In line 10, we construct a binary encoder, whereby we mean the output should be encoded using the Avro -binary standard. In line 11, we attach the output stream to the encoder. At any given time an incoder can write to only one output stream. +binary standard. In line 11, we attach the output stream to the encoder. At any given time an encoder can write to only one output stream.

      In line 14, we write the contents of c1 into the output stream using the encoder. Now the output stream contains the binary representation of @@ -192,7 +192,7 @@ and avro::jsonDecoder() instead of avro::binaryDecoder() in line 18. On the other hand, if you want to write the contents to a file instead of memory, you should use avro::fileOutputStream() instead of -avro::memoryOutputStream() in ine 9 and avro::fileInputStream() +avro::memoryOutputStream() in line 9 and avro::fileInputStream() instead of avro::memoryInputStream() in line 17.

      @@ -210,7 +210,7 @@ stored in a JSON file:

      \includelineno schemaload.cc

      -This reads the file, and parses the JSON schema into an in-meory schema +This reads the file, and parses the JSON schema into an in-memory schema object of type avro::ValidSchema. If, for some reason, the schema is not valid, the cpxSchema object will not be set, and an exception will be thrown. @@ -225,7 +225,7 @@ sections. Suppose you want to encode objects of type std::complex from C++ standard library using the schema defined in cpx.json. -Since std::complex was not generated by Avro, it does't know how to encode or decode objects of that +Since std::complex was not generated by Avro, it doesn't know how to encode or decode objects of that type. You have to tell Avro how to do that. The recommended way to tell Avro how to encode or decode is to specialize @@ -259,7 +259,7 @@ the validating encoders and decoder. Here is how: Here, instead of using the plain binary encoder, you use a validating encoder backed by a binary encoder. Similarly, instead of using the plain binary decoder, you use a validating decoder backed by a binary decoder. Now, -if you use std::complex intead of std::complex +if you use std::complex instead of std::complex the validating encoder and decoder will throw exception stating that you are trying to encode or decode float instead of double.

      @@ -273,9 +273,9 @@ fronting them with a validating encoder or validating decoder is wasteful.

      Generic data objects

      A third way to encode and decode data is to use Avro's generic datum. -Avro's generic datum allows you to read any arbitray data corresponding to +Avro's generic datum allows you to read any arbitrary data corresponding to an arbitrary schema into a generic object. One need not know anything -about the schema or data at complie time. +about the schema or data at compile time. Here is an example how one can use the generic datum. @@ -310,7 +310,7 @@ avrogencpp -i imaginary.json -o imaginary.hh -n i \includelineno resolving.cc In this example, writer and reader deal with different schemas, -both are recornd with the same name cpx. The writer schema has two fields and +both have a record with the name 'cpx'. The writer schema has two fields and the reader's has just one. We generated code for writer's schema in a namespace c and the reader's in i. @@ -326,7 +326,7 @@ complex resolutions are allowed by Avro specification.

      Using Avro data files

      Avro specification specifies a format for data files. Avro C++ implements -the sepcification. The code below demonstrates how one can use the +the specification. The code below demonstrates how one can use the Avro data file to store and retrieve a collection of objects corresponding to a given schema. From ec8a091819a25bccf03adc868449f57f9c076d19 Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Sat, 16 Apr 2016 14:10:45 -0700 Subject: [PATCH 041/116] AVRO-1821: Fix possible memory leak of Schemas in ReflectData. Contributed by Byran Harclerode. --- CHANGES.txt | 3 ++ lang/java/avro/pom.xml | 5 +++ .../org/apache/avro/reflect/ReflectData.java | 10 +++--- .../apache/avro/reflect/TestReflectData.java | 35 +++++++++++++++++++ 4 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflectData.java diff --git a/CHANGES.txt b/CHANGES.txt index dd4181001c6..f656de36c3c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -31,6 +31,9 @@ Trunk (not yet released) AVRO-1829. C++ documentation improvements (William S Fulton via thiru) + AVRO-1821: Java: Fix possible memory leak in ReflectData accessor cache. + (Bryan Harclerode via blue) + Avro 1.8.0 (22 January 2016) INCOMPATIBLE CHANGES diff --git a/lang/java/avro/pom.xml b/lang/java/avro/pom.xml index 48a3d428cc1..bc7b19146da 100644 --- a/lang/java/avro/pom.xml +++ b/lang/java/avro/pom.xml @@ -198,6 +198,11 @@ joda-time true + + org.hamcrest + hamcrest-all + test + diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java index 827e1faf504..9e13e7ccc1e 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java +++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java @@ -38,6 +38,8 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import com.google.common.cache.CacheBuilder; +import com.google.common.collect.MapMaker; import org.apache.avro.AvroRemoteException; import org.apache.avro.AvroRuntimeException; import org.apache.avro.AvroTypeException; @@ -52,6 +54,7 @@ import org.apache.avro.generic.IndexedRecord; import org.apache.avro.io.BinaryData; import org.apache.avro.util.ClassUtils; +import org.apache.avro.util.WeakIdentityHashMap; import org.apache.avro.io.DatumReader; import org.apache.avro.io.DatumWriter; import org.apache.avro.specific.FixedSize; @@ -230,13 +233,12 @@ public boolean validate(Schema schema, Object datum) { static final ConcurrentHashMap, ClassAccessorData> ACCESSOR_CACHE = new ConcurrentHashMap, ClassAccessorData>(); - private static class ClassAccessorData { + static class ClassAccessorData { private final Class clazz; private final Map byName = new HashMap(); - private final IdentityHashMap bySchema = - new IdentityHashMap(); - + final Map bySchema = new MapMaker().weakKeys().makeMap(); + private ClassAccessorData(Class c) { clazz = c; for(Field f : getFields(c, false)) { diff --git a/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflectData.java b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflectData.java new file mode 100644 index 00000000000..46645c22a8c --- /dev/null +++ b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflectData.java @@ -0,0 +1,35 @@ +package org.apache.avro.reflect; + +import org.apache.avro.Schema; +import org.junit.Test; +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.Collections; +import java.util.Map; + +import static org.hamcrest.Matchers.lessThan; +import static org.junit.Assert.assertThat; + +public class TestReflectData { + @Test + @SuppressWarnings("unchecked") + public void testWeakSchemaCaching() throws Exception { + int numSchemas = 1000000; + for (int i = 0; i < numSchemas; i++) { + // Create schema + Schema schema = Schema.createRecord("schema", null, null, false); + schema.setFields(Collections.emptyList()); + + ReflectData.get().getRecordState(new Object(), schema); + } + + // Reflect the number of schemas currently in the cache + ReflectData.ClassAccessorData classData = ReflectData.ACCESSOR_CACHE + .get(Object.class); + + System.gc(); // Not guaranteed, but seems to be reliable enough + + assertThat("ReflectData cache should release references", + classData.bySchema.size(), lessThan(numSchemas)); + } +} From 44ce5eb8a2180409237c81b9a53b64708262a690 Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Sat, 16 Apr 2016 14:28:51 -0700 Subject: [PATCH 042/116] AVRO-1823: Java: Do not swallow IOException while reading magic bytes. Contributed by Koji Noguchi. --- CHANGES.txt | 3 +++ .../src/main/java/org/apache/avro/file/DataFileStream.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index f656de36c3c..c7fa2dc7728 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -19,6 +19,9 @@ Trunk (not yet released) AVRO-1701: Fix for "warning: comparison between 'const enum testgen_r::ExampleEnum' and 'const enum testgen::ExampleEnum'" (peter liu via thiru) + AVRO-1823: Java: Do not swallow IOException while reading magic bytes. + (Koji Noguchi via blue) + BUG FIXES AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java index a19762bc270..458a7df587d 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java +++ b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java @@ -99,7 +99,7 @@ void initialize(InputStream in) throws IOException { try { vin.readFixed(magic); // read magic } catch (IOException e) { - throw new IOException("Not a data file."); + throw new IOException("Not a data file.", e); } if (!Arrays.equals(DataFileConstants.MAGIC, magic)) throw new IOException("Not a data file."); From ce64ff7ba8f51a8f54c910407b89cb99b12f79df Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Sat, 16 Apr 2016 14:57:46 -0700 Subject: [PATCH 043/116] AVRO-1821 ADDENDUM: Fix checkstyle violations. --- .../avro/src/main/java/org/apache/avro/reflect/ReflectData.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java index 9e13e7ccc1e..5af55b77938 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java +++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java @@ -38,7 +38,6 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import com.google.common.cache.CacheBuilder; import com.google.common.collect.MapMaker; import org.apache.avro.AvroRemoteException; import org.apache.avro.AvroRuntimeException; @@ -54,7 +53,6 @@ import org.apache.avro.generic.IndexedRecord; import org.apache.avro.io.BinaryData; import org.apache.avro.util.ClassUtils; -import org.apache.avro.util.WeakIdentityHashMap; import org.apache.avro.io.DatumReader; import org.apache.avro.io.DatumWriter; import org.apache.avro.specific.FixedSize; From 039272b89c6f08f1bd56721ead3d79618b70f797 Mon Sep 17 00:00:00 2001 From: Al B Date: Wed, 6 Apr 2016 12:41:10 +0100 Subject: [PATCH 044/116] AVRO-1642: Java: Do not generate invalid all-args constructor. Contributed by Prateek Rungta and Barry Jones. --- CHANGES.txt | 3 + .../compiler/specific/SpecificCompiler.java | 57 ++++++++++ .../specific/templates/java/classic/record.vm | 9 ++ .../{ => specific}/TestSpecificCompiler.java | 100 +++++++++++++++++- 4 files changed, 167 insertions(+), 2 deletions(-) rename lang/java/compiler/src/test/java/org/apache/avro/compiler/{ => specific}/TestSpecificCompiler.java (65%) diff --git a/CHANGES.txt b/CHANGES.txt index c7fa2dc7728..b25e781d4db 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -37,6 +37,9 @@ Trunk (not yet released) AVRO-1821: Java: Fix possible memory leak in ReflectData accessor cache. (Bryan Harclerode via blue) + AVRO-1642: Java: Do not generate invalid all-args constructor. + (Prateek Rungta and Barry Jones via blue) + Avro 1.8.0 (22 January 2016) INCOMPATIBLE CHANGES diff --git a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java index c1fa08a8d8d..6faf3687287 100644 --- a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java +++ b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java @@ -61,6 +61,27 @@ * Java reserved keywords are mangled to preserve compilation. */ public class SpecificCompiler { + + /* + * From Section 4.10 of the Java VM Specification: + * A method descriptor is valid only if it represents method parameters with a total length of 255 or less, + * where that length includes the contribution for this in the case of instance or interface method invocations. + * The total length is calculated by summing the contributions of the individual parameters, where a parameter + * of type long or double contributes two units to the length and a parameter of any other type contributes one unit. + * + * Arguments of type Double/Float contribute 2 "parameter units" to this limit, all other types contribute 1 + * "parameter unit". All instance methods for a class are passed a reference to the instance (`this), and hence, + * they are permitted at most `JVM_METHOD_ARG_LIMIT-1` "parameter units" for their arguments. + * + * @see JVM Spec: Section 4.10 + */ + private static final int JVM_METHOD_ARG_LIMIT = 255; + + /* + * Note: This is protected instead of private only so it's visible for testing. + */ + protected static final int MAX_FIELD_PARAMETER_UNIT_COUNT = JVM_METHOD_ARG_LIMIT - 1; + public static enum FieldVisibility { PUBLIC, PUBLIC_DEPRECATED, PRIVATE } @@ -71,8 +92,16 @@ public static enum FieldVisibility { private String templateDir; private FieldVisibility fieldVisibility = FieldVisibility.PUBLIC_DEPRECATED; private boolean createSetters = true; + private boolean createAllArgsConstructor = true; private String outputCharacterEncoding; + /* + * Used in the record.vm template. + */ + public boolean isCreateAllArgsConstructor() { + return createAllArgsConstructor; + } + /* Reserved words for accessor/mutator methods */ private static final Set ACCESSOR_MUTATOR_RESERVED_WORDS = new HashSet(Arrays.asList(new String[] { @@ -357,6 +386,33 @@ static String makePath(String name, String space) { } } + /** + * Returns the number of parameter units required by fields for the + * AllArgsConstructor. + * + * @param record a Record schema + */ + protected int calcAllArgConstructorParameterUnits(Schema record) { + + if (record.getType() != Schema.Type.RECORD) + throw new RuntimeException("This method must only be called for record schemas."); + + return record.getFields().size(); + } + + protected void validateRecordForCompilation(Schema record) { + this.createAllArgsConstructor = + calcAllArgConstructorParameterUnits(record) <= MAX_FIELD_PARAMETER_UNIT_COUNT; + + if (!this.createAllArgsConstructor) + new Slf4jLogChute().log(LogChute.WARN_ID, "Record '" + record.getFullName() + + "' contains more than " + MAX_FIELD_PARAMETER_UNIT_COUNT + + " parameters which exceeds the JVM " + + "spec for the number of permitted constructor arguments. Clients must " + + "rely on the builder pattern to create objects instead. For more info " + + "see JIRA ticket AVRO-1642."); + } + OutputFile compile(Schema schema) { schema = addStringType(schema); // annotate schema as needed String output = ""; @@ -366,6 +422,7 @@ OutputFile compile(Schema schema) { switch (schema.getType()) { case RECORD: + validateRecordForCompilation(schema); output = renderTemplate(templateDir+"record.vm", context); break; case ENUM: diff --git a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm index 1cd17e61501..5673fa4b6d8 100644 --- a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm +++ b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm @@ -66,6 +66,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or * one should use newBuilder(). */ public ${this.mangle($schema.getName())}() {} +#if ($this.isCreateAllArgsConstructor()) /** * All-args constructor. @@ -79,6 +80,14 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or this.${this.mangle($field.name())} = ${this.mangle($field.name())}; #end } +#else + /** + * This schema contains more than 254 fields which exceeds the maximum number + * of permitted constructor parameters in the JVM. An all-args constructor + * will not be generated. Please use newBuilder() to instantiate + * objects instead. + */ +#end #end #end diff --git a/lang/java/compiler/src/test/java/org/apache/avro/compiler/TestSpecificCompiler.java b/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java similarity index 65% rename from lang/java/compiler/src/test/java/org/apache/avro/compiler/TestSpecificCompiler.java rename to lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java index 7c4fcc2a89f..7605724ffef 100644 --- a/lang/java/compiler/src/test/java/org/apache/avro/compiler/TestSpecificCompiler.java +++ b/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java @@ -15,7 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.avro.compiler; +package org.apache.avro.compiler.specific; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -31,10 +31,13 @@ import java.io.IOException; import java.net.URISyntaxException; import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import org.apache.avro.AvroTestUtil; import org.apache.avro.Schema; -import org.apache.avro.compiler.specific.SpecificCompiler; +import org.apache.avro.SchemaBuilder; import org.apache.avro.generic.GenericData.StringType; import org.junit.After; import org.junit.Before; @@ -42,6 +45,10 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; +import javax.tools.JavaCompiler; +import javax.tools.StandardJavaFileManager; +import javax.tools.ToolProvider; + @RunWith(JUnit4.class) public class TestSpecificCompiler { private final String schemaSrcPath = "src/test/resources/simple_record.avsc"; @@ -65,6 +72,40 @@ public void tearDow() { } } + /** Uses the system's java compiler to actually compile the generated code. */ + static void assertCompilesWithJavaCompiler(Collection outputs) + throws IOException { + if (outputs.isEmpty()) + return; // Nothing to compile! + + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + StandardJavaFileManager fileManager = + compiler.getStandardFileManager(null, null, null); + + File dstDir = AvroTestUtil.tempFile(TestSpecificCompiler.class, "realCompiler"); + List javaFiles = new ArrayList(); + for (SpecificCompiler.OutputFile o : outputs) { + javaFiles.add(o.writeToDestination(null, dstDir)); + } + + JavaCompiler.CompilationTask cTask = compiler.getTask(null, fileManager, + null, null, null, fileManager.getJavaFileObjects( + javaFiles.toArray(new File[javaFiles.size()]))); + boolean compilesWithoutError = cTask.call(); + assertTrue(compilesWithoutError); + } + + private static Schema createSampleRecordSchema(int numStringFields, int numDoubleFields) { + SchemaBuilder.FieldAssembler sb = SchemaBuilder.record("sample.record").fields(); + for (int i = 0; i < numStringFields; i++) { + sb.name("sf_" + i).type().stringType().noDefault(); + } + for (int i = 0; i < numDoubleFields; i++) { + sb.name("df_" + i).type().doubleType().noDefault(); + } + return sb.endRecord(); + } + private SpecificCompiler createCompiler() throws IOException { Schema.Parser parser = new Schema.Parser(); Schema schema = parser.parse(this.src); @@ -102,6 +143,61 @@ public void testPublicFieldVisibility() throws IOException { } } + @Test + public void testCreateAllArgsConstructor() throws Exception { + SpecificCompiler compiler = createCompiler(); + compiler.compileToDestination(this.src, this.outputDir); + assertTrue(this.outputFile.exists()); + BufferedReader reader = new BufferedReader(new FileReader(this.outputFile)); + String line = null; + boolean foundAllArgsConstructor = false; + while (!foundAllArgsConstructor && (line = reader.readLine()) != null) { + foundAllArgsConstructor = line.contains("All-args constructor"); + } + assertTrue(foundAllArgsConstructor); + } + + @Test + public void testMaxValidParameterCounts() throws Exception { + Schema validSchema1 = createSampleRecordSchema(SpecificCompiler.MAX_FIELD_PARAMETER_UNIT_COUNT, 0); + assertCompilesWithJavaCompiler(new SpecificCompiler(validSchema1).compile()); + + Schema validSchema2 = createSampleRecordSchema(SpecificCompiler.MAX_FIELD_PARAMETER_UNIT_COUNT - 2, 1); + assertCompilesWithJavaCompiler(new SpecificCompiler(validSchema1).compile()); + } + + @Test + public void testInvalidParameterCounts() throws Exception { + Schema invalidSchema1 = createSampleRecordSchema(SpecificCompiler.MAX_FIELD_PARAMETER_UNIT_COUNT + 1, 0); + SpecificCompiler compiler = new SpecificCompiler(invalidSchema1); + assertCompilesWithJavaCompiler(compiler.compile()); + + Schema invalidSchema2 = createSampleRecordSchema(SpecificCompiler.MAX_FIELD_PARAMETER_UNIT_COUNT, 10); + compiler = new SpecificCompiler(invalidSchema2); + assertCompilesWithJavaCompiler(compiler.compile()); + } + + @Test + public void testMaxParameterCounts() throws Exception { + Schema validSchema1 = createSampleRecordSchema(SpecificCompiler.MAX_FIELD_PARAMETER_UNIT_COUNT, 0); + assertTrue(new SpecificCompiler(validSchema1).compile().size() > 0); + + Schema validSchema2 = createSampleRecordSchema(SpecificCompiler.MAX_FIELD_PARAMETER_UNIT_COUNT - 2, 1); + assertTrue(new SpecificCompiler(validSchema2).compile().size() > 0); + + Schema validSchema3 = createSampleRecordSchema(SpecificCompiler.MAX_FIELD_PARAMETER_UNIT_COUNT - 1, 1); + assertTrue(new SpecificCompiler(validSchema3).compile().size() > 0); + + Schema validSchema4 = createSampleRecordSchema(SpecificCompiler.MAX_FIELD_PARAMETER_UNIT_COUNT + 1, 0); + assertTrue(new SpecificCompiler(validSchema4).compile().size() > 0); + } + + @Test(expected=RuntimeException.class) + public void testCalcAllArgConstructorParameterUnitsFailure() { + Schema nonRecordSchema = SchemaBuilder.array().items().booleanType(); + new SpecificCompiler().calcAllArgConstructorParameterUnits(nonRecordSchema); + } + @Test public void testPublicDeprecatedFieldVisibility() throws IOException { SpecificCompiler compiler = createCompiler(); From f10aacc3f646d4609d56aa632d091b55fa491dcc Mon Sep 17 00:00:00 2001 From: Niels Basjes Date: Sun, 17 Apr 2016 23:10:19 +0200 Subject: [PATCH 045/116] AVRO-1825: Allow running build.sh dist under git --- CHANGES.txt | 2 ++ build.sh | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index b25e781d4db..9f76911055f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -22,6 +22,8 @@ Trunk (not yet released) AVRO-1823: Java: Do not swallow IOException while reading magic bytes. (Koji Noguchi via blue) + AVRO-1825: Allow running build.sh dist under git (nielsbasjes) + BUG FIXES AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are diff --git a/build.sh b/build.sh index 1758b8440a7..37b3017ec70 100755 --- a/build.sh +++ b/build.sh @@ -87,7 +87,17 @@ case "$target" in DOC_DIR=avro-doc-$VERSION rm -rf build/${SRC_DIR} - svn export --force . build/${SRC_DIR} + if [ -d .svn ]; + then + svn export --force . build/${SRC_DIR} + elif [ -d .git ]; + then + mkdir -p build/${SRC_DIR} + git archive HEAD | tar -x -C build/${SRC_DIR} + else + echo "Not SVN and not GIT .. cannot continue" + exit -1; + fi #runs RAT on artifacts mvn -N -P rat antrun:run From 29f509f91b4b7687f9abe239f731011a74c04835 Mon Sep 17 00:00:00 2001 From: Niels Basjes Date: Sun, 17 Apr 2016 23:18:43 +0200 Subject: [PATCH 046/116] AVRO-1826: build.sh rat fails over extra license files and many others. --- CHANGES.txt | 2 ++ pom.xml | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 9f76911055f..c60a81cc9f1 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -42,6 +42,8 @@ Trunk (not yet released) AVRO-1642: Java: Do not generate invalid all-args constructor. (Prateek Rungta and Barry Jones via blue) + AVRO-1826: build.sh rat fails over extra license files and many others (nielsbasjes). + Avro 1.8.0 (22 January 2016) INCOMPATIBLE CHANGES diff --git a/pom.xml b/pom.xml index f9a5322b8f1..7311deb52d7 100644 --- a/pom.xml +++ b/pom.xml @@ -225,8 +225,23 @@ **/.git/** **/.gitignore - **/*.log + build/** + doc/build/** + lang/java/archetypes/** + lang/java/**/target/** + lang/js/node_modules/** + lang/csharp/build/doc/html/** + lang/c++/doc/html/** + lang/c++/build/** + lang/perl/pm_to_blib + lang/perl/blib/**/.exists + lang/py/build/** + lang/py3/avro_python3.egg-info/** + lang/ruby/Gemfile.lock + lang/ruby/avro.gemspec + lang/ruby/.gem/** + lang/ruby/pkg/** lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Position.java lang/java/tools/src/test/compiler/output/Player.java @@ -254,14 +269,24 @@ lang/csharp/Avro.sln BUILD.txt - share/VERSION.txt + **/VERSION.txt + **/dependency-reduced-pom.xml lang/perl/.shipit + lang/perl/inc/Module/Install/*.pm + lang/perl/inc/Module/Install.pm + lang/perl/Makefile* + lang/perl/META.yml + lang/perl/MYMETA.yml + lang/py/userlogs/** lang/c/src/avro-c.pc.in lang/ruby/Manifest lang/java/tools/userlogs/** lang/java/mapred/userlogs/** lang/java/archetypes/avro-service-archetype/src/test/integration/projects/basic/goal.txt - lang/java/tools/dependency-reduced-pom.xml + lang/js/test/mocha.opts + lang/csharp/TestResult.xml + lang/csharp/src/apache/*/obj/**/*.csproj.FilesWrittenAbsolute.txt + lang/js/coverage/** CHANGES.txt DIST_README.txt @@ -282,6 +307,10 @@ lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/static/protovis-r3.2.js lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/static/g.bar.js lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/static/jquery-1.4.2.min.js + + lang/java/tools/src/main/resources/META-INF/cddl-1.0.text + lang/java/tools/src/main/resources/META-INF/cddl-1.1.text + lang/java/tools/src/main/resources/META-INF/mpl-2.0.text From b010898beeaa1d3203634a3acf7bfad15a7b5789 Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Sun, 17 Apr 2016 15:10:03 -0700 Subject: [PATCH 047/116] AVRO-1821: Add license header to TestReflectData. --- .../apache/avro/reflect/TestReflectData.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflectData.java b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflectData.java index 46645c22a8c..bab821ac7c0 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflectData.java +++ b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflectData.java @@ -1,3 +1,21 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.apache.avro.reflect; import org.apache.avro.Schema; From d1c85231fc0d42aeb63c575707450e0b2fd0e237 Mon Sep 17 00:00:00 2001 From: "k.usachev" Date: Sun, 3 Apr 2016 14:43:07 +0300 Subject: [PATCH 048/116] AVRO-1819, AVRO-1820: Java: Add aliases, custom properties to Protocol. Contributed by Konstantin Usachev. --- CHANGES.txt | 3 ++ .../main/java/org/apache/avro/Protocol.java | 24 +++++++++++-- .../src/main/java/org/apache/avro/Schema.java | 2 +- .../org/apache/avro/TestProtocolParsing.java | 34 +++++++++++++++---- share/test/schemas/simple.avpr | 2 +- 5 files changed, 53 insertions(+), 12 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index c60a81cc9f1..b1c379915cf 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -24,6 +24,9 @@ Trunk (not yet released) AVRO-1825: Allow running build.sh dist under git (nielsbasjes) + AVRO-1819, AVRO-1820: Java: Add aliases, custom properties to Protocol. + (Konstantin Usachev via blue) + BUG FIXES AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are diff --git a/lang/java/avro/src/main/java/org/apache/avro/Protocol.java b/lang/java/avro/src/main/java/org/apache/avro/Protocol.java index 03844f67ef4..9c896d2af7a 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/Protocol.java +++ b/lang/java/avro/src/main/java/org/apache/avro/Protocol.java @@ -70,6 +70,12 @@ public class Protocol extends JsonProperties { "doc", "response","request", "errors", "one-way"); } + private static final Set FIELD_RESERVED = new HashSet(); + static { + Collections.addAll(FIELD_RESERVED, + "name", "type", "doc", "default", "aliases"); + } + /** A protocol message. */ public class Message extends JsonProperties { private String name; @@ -482,9 +488,21 @@ private Message parseMessage(String messageName, JsonNode json) { JsonNode fieldDocNode = field.get("doc"); if (fieldDocNode != null) fieldDoc = fieldDocNode.getTextValue(); - fields.add(new Field(name, Schema.parse(fieldTypeNode,types), - fieldDoc, - field.get("default"))); + Field newField = new Field(name, Schema.parse(fieldTypeNode,types), + fieldDoc, field.get("default")); + Set aliases = Schema.parseAliases(field); + if (aliases != null) { // add aliases + for (String alias : aliases) + newField.addAlias(alias); + } + + Iterator i = field.getFieldNames(); + while (i.hasNext()) { // add properties + String prop = i.next(); + if (!FIELD_RESERVED.contains(prop)) // ignore reserved + newField.addProp(prop, field.get(prop)); + } + fields.add(newField); } Schema request = Schema.createRecord(fields); diff --git a/lang/java/avro/src/main/java/org/apache/avro/Schema.java b/lang/java/avro/src/main/java/org/apache/avro/Schema.java index 600f7aaffe4..e2ba9277272 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/Schema.java +++ b/lang/java/avro/src/main/java/org/apache/avro/Schema.java @@ -1344,7 +1344,7 @@ static Schema parse(JsonNode schema, Names names) { } } - private static Set parseAliases(JsonNode node) { + static Set parseAliases(JsonNode node) { JsonNode aliasesNode = node.get("aliases"); if (aliasesNode == null) return null; diff --git a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolParsing.java b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolParsing.java index ba072253e14..208a3d97717 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolParsing.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolParsing.java @@ -18,6 +18,7 @@ package org.apache.avro; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.File; @@ -30,19 +31,18 @@ public class TestProtocolParsing { public static Protocol getSimpleProtocol() throws IOException { File file = new File("../../../share/test/schemas/simple.avpr"); - Protocol protocol = Protocol.parse(file); - return protocol; + return Protocol.parse(file); } - + @Test public void testParsing() throws IOException { Protocol protocol = getSimpleProtocol(); - + assertEquals(protocol.getDoc(), "Protocol used for testing."); assertEquals(6, protocol.getMessages().size()); - assertEquals("Pretend you're in a cave!", protocol.getMessages().get("echo").getDoc()); + assertEquals("Pretend you're in a cave!", protocol.getMessages().get("echo").getDoc()); } - + private static Message parseMessage(String message) throws Exception { return Protocol.parse("{\"protocol\": \"org.foo.Bar\"," +"\"types\": []," @@ -51,7 +51,8 @@ private static Message parseMessage(String message) throws Exception { + "}}").getMessages().values().iterator().next(); } - @Test public void oneWay() throws Exception { + @Test + public void oneWay() throws Exception { Message m; // permit one-way messages w/ null resposne m = parseMessage("\"ack\": {" @@ -84,4 +85,23 @@ public void oneWayError() throws Exception { +"\"one-way\": true}"); } + @Test + public void testMessageFieldAliases() throws IOException{ + Protocol protocol = getSimpleProtocol(); + final Message msg = protocol.getMessages().get("hello"); + assertNotNull(msg); + final Schema.Field field = msg.getRequest().getField("greeting"); + assertNotNull(field); + assertTrue(field.aliases().contains("salute")); + } + + @Test + public void testMessageCustomProperties() throws IOException{ + Protocol protocol = getSimpleProtocol(); + final Message msg = protocol.getMessages().get("hello"); + assertNotNull(msg); + final Schema.Field field = msg.getRequest().getField("greeting"); + assertNotNull(field); + assertEquals("customValue", field.getProp("customProp")); + } } diff --git a/share/test/schemas/simple.avpr b/share/test/schemas/simple.avpr index 7165ad89563..c1f2a4cb8ec 100644 --- a/share/test/schemas/simple.avpr +++ b/share/test/schemas/simple.avpr @@ -40,7 +40,7 @@ "hello": { "doc": "Send a greeting", - "request": [{"name": "greeting", "type": "string"}], + "request": [{"name": "greeting", "type": "string", "aliases" : [ "salute" ], "customProp" : "customValue"}], "response": "string" }, From 8826b38b16f8c4aa5a3df33e6dbd8a339093a38d Mon Sep 17 00:00:00 2001 From: Niels Basjes Date: Mon, 25 Apr 2016 22:54:58 +0200 Subject: [PATCH 049/116] AVRO-1834: Lower the Javadoc warnings on the generated code. --- CHANGES.txt | 2 ++ .../avro/compiler/specific/templates/java/classic/record.vm | 3 +++ .../output-string/avro/examples/baseball/Player.java | 6 ++++++ lang/java/tools/src/test/compiler/output/Player.java | 6 ++++++ 4 files changed, 17 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index b1c379915cf..bce23ce5589 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -27,6 +27,8 @@ Trunk (not yet released) AVRO-1819, AVRO-1820: Java: Add aliases, custom properties to Protocol. (Konstantin Usachev via blue) + AVRO-1834: Lower the Javadoc warnings on the generated code. (nielsbasjes) + BUG FIXES AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are diff --git a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm index 5673fa4b6d8..3c69396de5e 100644 --- a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm +++ b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm @@ -72,6 +72,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or * All-args constructor. #foreach ($field in $schema.getFields()) #if ($field.doc()) * @param ${this.mangle($field.name())} $field.doc() +#else * @param ${this.mangle($field.name())} The new value for ${field.name()} #end #end */ @@ -120,6 +121,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or /** * Gets the value of the '${this.mangle($field.name(), $schema.isError())}' field. #if ($field.doc()) * @return $field.doc() +#else * @return The value of the '${this.mangle($field.name(), $schema.isError())}' field. #end */ public ${this.javaType($field.schema())} ${this.generateGetMethod($schema, $field)}() { @@ -310,6 +312,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or * Sets the Builder instance for the '${this.mangle($field.name(), $schema.isError())}' field #if ($field.doc()) * $field.doc() #end + * @param value The builder instance that must be set. * @return This builder. */ public #if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder ${this.generateSetBuilderMethod($schema, $field)}(${this.javaUnbox($field.schema())}.Builder value) { diff --git a/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java b/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java index d092078a02d..46a0cbaa379 100644 --- a/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java +++ b/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java @@ -27,6 +27,9 @@ public Player() {} /** * All-args constructor. * @param number The number of the player + * @param first_name The new value for first_name + * @param last_name The new value for last_name + * @param position The new value for position */ public Player(java.lang.Integer number, java.lang.String first_name, java.lang.String last_name, java.util.List position) { this.number = number; @@ -77,6 +80,7 @@ public void setNumber(java.lang.Integer value) { /** * Gets the value of the 'first_name' field. + * @return The value of the 'first_name' field. */ public java.lang.String getFirstName() { return first_name; @@ -92,6 +96,7 @@ public void setFirstName(java.lang.String value) { /** * Gets the value of the 'last_name' field. + * @return The value of the 'last_name' field. */ public java.lang.String getLastName() { return last_name; @@ -107,6 +112,7 @@ public void setLastName(java.lang.String value) { /** * Gets the value of the 'position' field. + * @return The value of the 'position' field. */ public java.util.List getPosition() { return position; diff --git a/lang/java/tools/src/test/compiler/output/Player.java b/lang/java/tools/src/test/compiler/output/Player.java index 2363ed1c790..ce05afd91ee 100644 --- a/lang/java/tools/src/test/compiler/output/Player.java +++ b/lang/java/tools/src/test/compiler/output/Player.java @@ -27,6 +27,9 @@ public Player() {} /** * All-args constructor. * @param number The number of the player + * @param first_name The new value for first_name + * @param last_name The new value for last_name + * @param position The new value for position */ public Player(java.lang.Integer number, java.lang.CharSequence first_name, java.lang.CharSequence last_name, java.util.List position) { this.number = number; @@ -77,6 +80,7 @@ public void setNumber(java.lang.Integer value) { /** * Gets the value of the 'first_name' field. + * @return The value of the 'first_name' field. */ public java.lang.CharSequence getFirstName() { return first_name; @@ -92,6 +96,7 @@ public void setFirstName(java.lang.CharSequence value) { /** * Gets the value of the 'last_name' field. + * @return The value of the 'last_name' field. */ public java.lang.CharSequence getLastName() { return last_name; @@ -107,6 +112,7 @@ public void setLastName(java.lang.CharSequence value) { /** * Gets the value of the 'position' field. + * @return The value of the 'position' field. */ public java.util.List getPosition() { return position; From 0ca11231b09cf8b15a361de932e7d6998cc11f3e Mon Sep 17 00:00:00 2001 From: Niels Basjes Date: Thu, 28 Apr 2016 22:46:07 +0200 Subject: [PATCH 050/116] AVRO-1814: Generated java code fails on variables with a TLD name like 'org' --- CHANGES.txt | 2 ++ .../specific/templates/java/classic/record.vm | 11 +++++++---- .../output-string/avro/examples/baseball/Player.java | 11 +++++++---- lang/java/tools/src/test/compiler/output/Player.java | 11 +++++++---- share/test/schemas/specialtypes.avdl | 8 ++++++++ 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index bce23ce5589..5f0b83bc318 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -49,6 +49,8 @@ Trunk (not yet released) AVRO-1826: build.sh rat fails over extra license files and many others (nielsbasjes). + AVRO-1814: Generated java code fails on variables with a TLD name like 'org' (nielsbasjes) + Avro 1.8.0 (22 January 2016) INCOMPATIBLE CHANGES diff --git a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm index 3c69396de5e..d0c19683a3a 100644 --- a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm +++ b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm @@ -18,6 +18,9 @@ #if ($schema.getNamespace()) package $schema.getNamespace(); #end + +import org.apache.avro.specific.SpecificData; + @SuppressWarnings("all") #if ($schema.getDoc()) /** $schema.getDoc() */ @@ -186,7 +189,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or /** Creates a new Builder */ private Builder() { - super(#if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.SCHEMA$); + super(SCHEMA$); } /** @@ -214,7 +217,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or */ private Builder(#if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())} other) { #if ($schema.isError())super(other)#else - super(#if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.SCHEMA$)#end; + super(SCHEMA$)#end; #foreach ($field in $schema.getFields()) if (isValidValue(fields()[$field.pos()], other.${this.mangle($field.name(), $schema.isError())})) { this.${this.mangle($field.name(), $schema.isError())} = data().deepCopy(fields()[$field.pos()].schema(), other.${this.mangle($field.name(), $schema.isError())}); @@ -377,7 +380,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or @Override public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException { - WRITER$.write(this, org.apache.avro.specific.SpecificData.getEncoder(out)); + WRITER$.write(this, SpecificData.getEncoder(out)); } private static final org.apache.avro.io.DatumReader @@ -385,7 +388,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or @Override public void readExternal(java.io.ObjectInput in) throws java.io.IOException { - READER$.read(this, org.apache.avro.specific.SpecificData.getDecoder(in)); + READER$.read(this, SpecificData.getDecoder(in)); } } diff --git a/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java b/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java index 46a0cbaa379..9d7fbc82ac9 100644 --- a/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java +++ b/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java @@ -4,6 +4,9 @@ * DO NOT EDIT DIRECTLY */ package avro.examples.baseball; + +import org.apache.avro.specific.SpecificData; + @SuppressWarnings("all") /** 選手 is Japanese for player. */ @org.apache.avro.specific.AvroGenerated @@ -166,7 +169,7 @@ public static class Builder extends org.apache.avro.specific.SpecificRecordBuild /** Creates a new Builder */ private Builder() { - super(avro.examples.baseball.Player.SCHEMA$); + super(SCHEMA$); } /** @@ -198,7 +201,7 @@ private Builder(avro.examples.baseball.Player.Builder other) { * @param other The existing instance to copy. */ private Builder(avro.examples.baseball.Player other) { - super(avro.examples.baseball.Player.SCHEMA$); + super(SCHEMA$); if (isValidValue(fields()[0], other.number)) { this.number = data().deepCopy(fields()[0].schema(), other.number); fieldSetFlags()[0] = true; @@ -396,7 +399,7 @@ public Player build() { @Override public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException { - WRITER$.write(this, org.apache.avro.specific.SpecificData.getEncoder(out)); + WRITER$.write(this, SpecificData.getEncoder(out)); } private static final org.apache.avro.io.DatumReader @@ -404,7 +407,7 @@ public Player build() { @Override public void readExternal(java.io.ObjectInput in) throws java.io.IOException { - READER$.read(this, org.apache.avro.specific.SpecificData.getDecoder(in)); + READER$.read(this, SpecificData.getDecoder(in)); } } diff --git a/lang/java/tools/src/test/compiler/output/Player.java b/lang/java/tools/src/test/compiler/output/Player.java index ce05afd91ee..bf0ed62b47d 100644 --- a/lang/java/tools/src/test/compiler/output/Player.java +++ b/lang/java/tools/src/test/compiler/output/Player.java @@ -4,6 +4,9 @@ * DO NOT EDIT DIRECTLY */ package avro.examples.baseball; + +import org.apache.avro.specific.SpecificData; + @SuppressWarnings("all") /** 選手 is Japanese for player. */ @org.apache.avro.specific.AvroGenerated @@ -166,7 +169,7 @@ public static class Builder extends org.apache.avro.specific.SpecificRecordBuild /** Creates a new Builder */ private Builder() { - super(avro.examples.baseball.Player.SCHEMA$); + super(SCHEMA$); } /** @@ -198,7 +201,7 @@ private Builder(avro.examples.baseball.Player.Builder other) { * @param other The existing instance to copy. */ private Builder(avro.examples.baseball.Player other) { - super(avro.examples.baseball.Player.SCHEMA$); + super(SCHEMA$); if (isValidValue(fields()[0], other.number)) { this.number = data().deepCopy(fields()[0].schema(), other.number); fieldSetFlags()[0] = true; @@ -396,7 +399,7 @@ public Player build() { @Override public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException { - WRITER$.write(this, org.apache.avro.specific.SpecificData.getEncoder(out)); + WRITER$.write(this, SpecificData.getEncoder(out)); } private static final org.apache.avro.io.DatumReader @@ -404,7 +407,7 @@ public Player build() { @Override public void readExternal(java.io.ObjectInput in) throws java.io.IOException { - READER$.read(this, org.apache.avro.specific.SpecificData.getDecoder(in)); + READER$.read(this, SpecificData.getDecoder(in)); } } diff --git a/share/test/schemas/specialtypes.avdl b/share/test/schemas/specialtypes.avdl index 623e0168da8..1be3aabccfb 100644 --- a/share/test/schemas/specialtypes.avdl +++ b/share/test/schemas/specialtypes.avdl @@ -95,4 +95,12 @@ protocol LetsBreakIt { string value; } + record TopLevelDomainNames { + string org; + string avro; + string com; + string net; + string nl; + } + } From 27ea8ffb31e53e867083c5090993deab3220bbc7 Mon Sep 17 00:00:00 2001 From: Niels Basjes Date: Thu, 28 Apr 2016 22:57:38 +0200 Subject: [PATCH 051/116] AVRO-1835: Running tests using JDK 1.8 complains about MaxPermSize --- CHANGES.txt | 2 ++ lang/java/pom.xml | 25 ++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 5f0b83bc318..3a8f4e8c68c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -29,6 +29,8 @@ Trunk (not yet released) AVRO-1834: Lower the Javadoc warnings on the generated code. (nielsbasjes) + AVRO-1835: Running tests using JDK 1.8 complains about MaxPermSize (nielsbasjes) + BUG FIXES AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are diff --git a/lang/java/pom.xml b/lang/java/pom.xml index 53d1f664bef..da6e6e20eea 100644 --- a/lang/java/pom.xml +++ b/lang/java/pom.xml @@ -227,7 +227,8 @@ rather than the console. --> true false - -Xmx1000m -XX:MaxPermSize=200m + + ${surefire.argline} ${project.basedir}/target/ @@ -399,6 +400,28 @@ + + + + + old-jdk + + (,1.8) + + + -Xmx1000m -XX:MaxPermSize=200m + + + + new-jdk + + [1.8,) + + + -Xmx1000m + + + - + - + diff --git a/doc/examples/java-example/src/main/java/example/GenericMain.java b/doc/examples/java-example/src/main/java/example/GenericMain.java index 87a445cb94a..2d51a8d614b 100644 --- a/doc/examples/java-example/src/main/java/example/GenericMain.java +++ b/doc/examples/java-example/src/main/java/example/GenericMain.java @@ -33,39 +33,39 @@ import org.apache.avro.io.DatumWriter; public class GenericMain { - public static void main(String[] args) throws IOException { - Schema schema = new Parser().parse(new File("/home/skye/code/cloudera/avro/doc/examples/user.avsc")); - - GenericRecord user1 = new GenericData.Record(schema); - user1.put("name", "Alyssa"); - user1.put("favorite_number", 256); - // Leave favorite color null - - GenericRecord user2 = new GenericData.Record(schema); - user2.put("name", "Ben"); - user2.put("favorite_number", 7); - user2.put("favorite_color", "red"); - - // Serialize user1 and user2 to disk - File file = new File("users.avro"); - DatumWriter datumWriter = new GenericDatumWriter(schema); - DataFileWriter dataFileWriter = new DataFileWriter(datumWriter); - dataFileWriter.create(schema, file); - dataFileWriter.append(user1); - dataFileWriter.append(user2); - dataFileWriter.close(); + public static void main(String[] args) throws IOException { + Schema schema = new Parser().parse(new File("/home/skye/code/cloudera/avro/doc/examples/user.avsc")); - // Deserialize users from disk - DatumReader datumReader = new GenericDatumReader(schema); - DataFileReader dataFileReader = new DataFileReader(file, datumReader); - GenericRecord user = null; - while (dataFileReader.hasNext()) { - // Reuse user object by passing it to next(). This saves us from - // allocating and garbage collecting many objects for files with - // many items. - user = dataFileReader.next(user); - System.out.println(user); - } - - } + GenericRecord user1 = new GenericData.Record(schema); + user1.put("name", "Alyssa"); + user1.put("favorite_number", 256); + // Leave favorite color null + + GenericRecord user2 = new GenericData.Record(schema); + user2.put("name", "Ben"); + user2.put("favorite_number", 7); + user2.put("favorite_color", "red"); + + // Serialize user1 and user2 to disk + File file = new File("users.avro"); + DatumWriter datumWriter = new GenericDatumWriter(schema); + DataFileWriter dataFileWriter = new DataFileWriter(datumWriter); + dataFileWriter.create(schema, file); + dataFileWriter.append(user1); + dataFileWriter.append(user2); + dataFileWriter.close(); + + // Deserialize users from disk + DatumReader datumReader = new GenericDatumReader(schema); + DataFileReader dataFileReader = new DataFileReader(file, datumReader); + GenericRecord user = null; + while (dataFileReader.hasNext()) { + // Reuse user object by passing it to next(). This saves us from + // allocating and garbage collecting many objects for files with + // many items. + user = dataFileReader.next(user); + System.out.println(user); + } + + } } diff --git a/doc/examples/java-example/src/main/java/example/SpecificMain.java b/doc/examples/java-example/src/main/java/example/SpecificMain.java index 2b5fd0f7ffc..e068eedf91c 100644 --- a/doc/examples/java-example/src/main/java/example/SpecificMain.java +++ b/doc/examples/java-example/src/main/java/example/SpecificMain.java @@ -31,43 +31,43 @@ import example.avro.User; public class SpecificMain { - public static void main(String[] args) throws IOException { - User user1 = new User(); - user1.setName("Alyssa"); - user1.setFavoriteNumber(256); - // Leave favorite color null + public static void main(String[] args) throws IOException { + User user1 = new User(); + user1.setName("Alyssa"); + user1.setFavoriteNumber(256); + // Leave favorite color null - // Alternate constructor - User user2 = new User("Ben", 7, "red"); - - // Construct via builder - User user3 = User.newBuilder() - .setName("Charlie") - .setFavoriteColor("blue") - .setFavoriteNumber(null) - .build(); + // Alternate constructor + User user2 = new User("Ben", 7, "red"); - // Serialize user1 and user2 to disk - File file = new File("users.avro"); - DatumWriter userDatumWriter = new SpecificDatumWriter(User.class); - DataFileWriter dataFileWriter = new DataFileWriter(userDatumWriter); - dataFileWriter.create(user1.getSchema(), file); - dataFileWriter.append(user1); - dataFileWriter.append(user2); - dataFileWriter.append(user3); - dataFileWriter.close(); + // Construct via builder + User user3 = User.newBuilder() + .setName("Charlie") + .setFavoriteColor("blue") + .setFavoriteNumber(null) + .build(); - // Deserialize Users from disk - DatumReader userDatumReader = new SpecificDatumReader(User.class); - DataFileReader dataFileReader = new DataFileReader(file, userDatumReader); - User user = null; - while (dataFileReader.hasNext()) { - // Reuse user object by passing it to next(). This saves us from - // allocating and garbage collecting many objects for files with - // many items. - user = dataFileReader.next(user); - System.out.println(user); - } + // Serialize user1 and user2 to disk + File file = new File("users.avro"); + DatumWriter userDatumWriter = new SpecificDatumWriter(User.class); + DataFileWriter dataFileWriter = new DataFileWriter(userDatumWriter); + dataFileWriter.create(user1.getSchema(), file); + dataFileWriter.append(user1); + dataFileWriter.append(user2); + dataFileWriter.append(user3); + dataFileWriter.close(); - } + // Deserialize Users from disk + DatumReader userDatumReader = new SpecificDatumReader(User.class); + DataFileReader dataFileReader = new DataFileReader(file, userDatumReader); + User user = null; + while (dataFileReader.hasNext()) { + // Reuse user object by passing it to next(). This saves us from + // allocating and garbage collecting many objects for files with + // many items. + user = dataFileReader.next(user); + System.out.println(user); + } + + } } diff --git a/doc/examples/mr-example/src/main/java/example/MapReduceAvroWordCount.java b/doc/examples/mr-example/src/main/java/example/MapReduceAvroWordCount.java index 8ca6a2f3107..5f5c9191554 100644 --- a/doc/examples/mr-example/src/main/java/example/MapReduceAvroWordCount.java +++ b/doc/examples/mr-example/src/main/java/example/MapReduceAvroWordCount.java @@ -112,7 +112,7 @@ public int run(String[] args) throws Exception { FileOutputFormat.setOutputPath(job, new Path(args[1])); job.waitForCompletion(true); - + return 0; } diff --git a/doc/src/content/xdocs/mr.xml b/doc/src/content/xdocs/mr.xml index a93a1378274..7c91a241f5c 100644 --- a/doc/src/content/xdocs/mr.xml +++ b/doc/src/content/xdocs/mr.xml @@ -39,7 +39,7 @@ See the Hadoop documentation and the Avro getting started guide for introductions to these projects. This guide uses - the old MapReduce API (org.apache.hadoop.mapred) and the new + the old MapReduce API (org.apache.hadoop.mapred) and the new MapReduce API (org.apache.hadoop.mapreduce).

      @@ -91,10 +91,10 @@ </plugin>

      - If you do not configure the sourceDirectory and outputDirectory - properties, the defaults will be used. The sourceDirectory property - defaults to src/main/avro. The outputDirectory property - defaults to target/generated-sources. You can change the paths to + If you do not configure the sourceDirectory and outputDirectory + properties, the defaults will be used. The sourceDirectory property + defaults to src/main/avro. The outputDirectory property + defaults to target/generated-sources. You can change the paths to match your project layout.

      @@ -297,9 +297,9 @@ public class MapReduceColorCount extends Configured implements Tool { ColorCount reads in data files containing User records, defined in examples/user.avsc, and counts the number of instances of each favorite color. (This example draws inspiration from - the canonical WordCount MapReduce application.) This example uses the - old MapReduce API. See MapReduceAvroWordCount, found under - doc/examples/mr-example/src/main/java/example/ to see the new MapReduce + the canonical WordCount MapReduce application.) This example uses the + old MapReduce API. See MapReduceAvroWordCount, found under + doc/examples/mr-example/src/main/java/example/ to see the new MapReduce API example. The User schema is defined as follows:

      diff --git a/doc/src/content/xdocs/site.xml b/doc/src/content/xdocs/site.xml index 85d5fb97c34..30d0b48703a 100644 --- a/doc/src/content/xdocs/site.xml +++ b/doc/src/content/xdocs/site.xml @@ -24,13 +24,13 @@ This file contains an outline of the site's information content. It is used to: links to changes.html (or ../changes.html if in subdir). - Provide aliases for external URLs in the external-refs section. Eg, links to http://cocoon.apache.org/ + href="ext:cocoon"> links to http://cocoon.apache.org/ See http://forrest.apache.org/docs/linking.html for more info --> - true + true false @@ -52,8 +52,8 @@ which will be used to configure the chosen Forrest skin. true - true @@ -105,7 +105,7 @@ which will be used to configure the chosen Forrest skin. - + - p.quote { @@ -162,27 +162,27 @@ which will be used to configure the chosen Forrest skin. - + - - + + - + - - - + + + - + --> - + - + @@ -264,28 +264,28 @@ which will be used to configure the chosen Forrest skin. - + - + - - - - + + + + - + --> - + - diff --git a/lang/c++/build.sh b/lang/c++/build.sh index 8ee36f679ed..e5beaea63ea 100755 --- a/lang/c++/build.sh +++ b/lang/c++/build.sh @@ -29,9 +29,9 @@ fi if [ -f VERSION.txt ] then -VERSION=`cat VERSION.txt` + VERSION=`cat VERSION.txt` else -VERSION=`cat ../../share/VERSION.txt` + VERSION=`cat ../../share/VERSION.txt` fi BUILD=../../build @@ -42,69 +42,69 @@ BUILD_CPP=$BUILD/$AVRO_CPP DIST_DIR=../../dist/$AVRO_CPP DOC_CPP=$BUILD/$AVRO_DOC/api/cpp DIST_DIR=../../dist/cpp -TARFILE=../dist/cpp/$AVRO_CPP.tar.gz +TARFILE=../dist/cpp/$AVRO_CPP.tar.gz (mkdir -p build; cd build; cmake -G "Unix Makefiles" ..) for target in "$@" do function do_doc() { - doxygen - if [ -d doc ] - then - mkdir -p $DOC_CPP - cp -R doc/* $DOC_CPP - else - exit 1 - fi + doxygen + if [ -d doc ] + then + mkdir -p $DOC_CPP + cp -R doc/* $DOC_CPP + else + exit 1 + fi } function do_dist() { - rm -rf $BUILD_CPP/ - mkdir -p $BUILD_CPP - cp -r api AUTHORS build.sh CMakeLists.txt ChangeLog \ - LICENSE NOTICE impl jsonschemas NEWS parser README scripts test examples \ - $BUILD_CPP - find $BUILD_CPP -name '.svn' | xargs rm -rf - cp ../../share/VERSION.txt $BUILD_CPP - mkdir -p $DIST_DIR - (cd $BUILD_DIR; tar cvzf $TARFILE $AVRO_CPP && cp $TARFILE $AVRO_CPP ) - if [ ! -f $DIST_FILE ] - then - exit 1 - fi + rm -rf $BUILD_CPP/ + mkdir -p $BUILD_CPP + cp -r api AUTHORS build.sh CMakeLists.txt ChangeLog \ + LICENSE NOTICE impl jsonschemas NEWS parser README scripts test examples \ + $BUILD_CPP + find $BUILD_CPP -name '.svn' | xargs rm -rf + cp ../../share/VERSION.txt $BUILD_CPP + mkdir -p $DIST_DIR + (cd $BUILD_DIR; tar cvzf $TARFILE $AVRO_CPP && cp $TARFILE $AVRO_CPP ) + if [ ! -f $DIST_FILE ] + then + exit 1 + fi } case "$target" in - test) + test) (cd build && make && cd .. \ - && ./build/buffertest \ - && ./build/unittest \ - && ./build/CodecTests \ - && ./build/StreamTests \ - && ./build/SpecificTests \ - && ./build/AvrogencppTests \ - && ./build/DataFileTests) - ;; - - dist) - do_dist - do_doc + && ./build/buffertest \ + && ./build/unittest \ + && ./build/CodecTests \ + && ./build/StreamTests \ + && ./build/SpecificTests \ + && ./build/AvrogencppTests \ + && ./build/DataFileTests) ;; - doc) - do_doc + dist) + do_dist + do_doc ;; - clean) + doc) + do_doc + ;; + + clean) (cd build && make clean) - ;; + ;; - install) + install) (cd build && make install) ;; - *) - usage + *) + usage esac done diff --git a/lang/c/build.sh b/lang/c/build.sh index 832cc79376a..e00db691405 100755 --- a/lang/c/build.sh +++ b/lang/c/build.sh @@ -18,8 +18,8 @@ # under the License. # -set -e # exit on error -#set -x +set -e # exit on error +#set -x root_dir=$(pwd) build_dir="../../build/c" @@ -36,59 +36,59 @@ function prepare_build { function clean { if [ -d $build_dir ]; then - find $build_dir | xargs chmod 755 - rm -rf $build_dir + find $build_dir | xargs chmod 755 + rm -rf $build_dir fi } case "$1" in - interop-data-generate) - prepare_build - make -C $build_dir - $build_dir/tests/generate_interop_data "../../share/test/schemas/interop.avsc" "../../build/interop/data" - ;; + interop-data-generate) + prepare_build + make -C $build_dir + $build_dir/tests/generate_interop_data "../../share/test/schemas/interop.avsc" "../../build/interop/data" + ;; - interop-data-test) - prepare_build - make -C $build_dir - $build_dir/tests/test_interop_data "../../build/interop/data" - ;; + interop-data-test) + prepare_build + make -C $build_dir + $build_dir/tests/test_interop_data "../../build/interop/data" + ;; - test) - prepare_build - make -C $build_dir - make -C $build_dir test - clean - ;; + test) + prepare_build + make -C $build_dir + make -C $build_dir test + clean + ;; - dist) - prepare_build - cp ../../share/VERSION.txt $root_dir - make -C $build_dir docs - # This is a hack to force the built documentation to be included - # in the source package. - cp $build_dir/docs/*.html $root_dir/docs - make -C $build_dir package_source - rm $root_dir/docs/*.html - if [ ! -d $dist_dir ]; then - mkdir -p $dist_dir - fi - if [ ! -d $doc_dir ]; then - mkdir -p $doc_dir - fi - mv $build_dir/$tarball $dist_dir - cp $build_dir/docs/*.html $doc_dir - clean - ;; + dist) + prepare_build + cp ../../share/VERSION.txt $root_dir + make -C $build_dir docs + # This is a hack to force the built documentation to be included + # in the source package. + cp $build_dir/docs/*.html $root_dir/docs + make -C $build_dir package_source + rm $root_dir/docs/*.html + if [ ! -d $dist_dir ]; then + mkdir -p $dist_dir + fi + if [ ! -d $doc_dir ]; then + mkdir -p $doc_dir + fi + mv $build_dir/$tarball $dist_dir + cp $build_dir/docs/*.html $doc_dir + clean + ;; - clean) - clean - ;; + clean) + clean + ;; - *) - echo "Usage: $0 {interop-data-generate|interop-data-test|test|dist|clean}" - exit 1 + *) + echo "Usage: $0 {interop-data-generate|interop-data-test|test|dist|clean}" + exit 1 esac exit 0 diff --git a/lang/c/version.sh b/lang/c/version.sh index c0215a274f6..027c08f0f70 100755 --- a/lang/c/version.sh +++ b/lang/c/version.sh @@ -28,7 +28,7 @@ # Do each of these steps in order and libtool will do the right thing # (1) If there are changes to libavro: # libavro_micro_version++ -# libavro_interface_age++ +# libavro_interface_age++ # libavro_binary_age++ # (2) If any functions have been added: # libavro_interface_age = 0 @@ -42,9 +42,9 @@ libavro_binary_age=0 # IGNORE EVERYTHING ELSE FROM HERE DOWN......... if test $# != 1; then - echo "USAGE: $0 CMD" - echo " where CMD is one of: project, libtool, libcurrent, librevision, libage" - exit 1 + echo "USAGE: $0 CMD" + echo " where CMD is one of: project, libtool, libcurrent, librevision, libage" + exit 1 fi # http://sources.redhat.com/autobook/autobook/autobook_91.html @@ -53,29 +53,29 @@ libcurrent=$(($libavro_micro_version - $libavro_interface_age)) # The implementation number of the 'current' interface librevision=$libavro_interface_age # The difference between the newest and oldest interfaces that this library implements -# In other words, the library implements all the interface numbers in the range from +# In other words, the library implements all the interface numbers in the range from # number 'current - age' to current libage=$(($libavro_binary_age - $libavro_interface_age)) if test "$1" = "project"; then - project_ver="undef" - version_file="VERSION.txt" - if test -f $version_file; then - project_ver=$(cat $version_file) - else - version_file="../../share/VERSION.txt" - if test -f $version_file; then - project_ver=$(cat $version_file) - fi - fi - printf "%s" $project_ver + project_ver="undef" + version_file="VERSION.txt" + if test -f $version_file; then + project_ver=$(cat $version_file) + else + version_file="../../share/VERSION.txt" + if test -f $version_file; then + project_ver=$(cat $version_file) + fi + fi + printf "%s" $project_ver elif test "$1" = "libtool"; then - # useful for the -version-info flag for libtool - printf "%d:%d:%d" $libcurrent $librevision $libage + # useful for the -version-info flag for libtool + printf "%d:%d:%d" $libcurrent $librevision $libage elif test "$1" = "libcurrent"; then - printf "%d" $libcurrent + printf "%d" $libcurrent elif test "$1" = "librevision"; then - printf "%d" $librevision + printf "%d" $librevision elif test "$1" = "libage"; then - printf "%d" $libage + printf "%d" $libage fi diff --git a/lang/csharp/build.sh b/lang/csharp/build.sh index 16642666279..66520c18bb1 100755 --- a/lang/csharp/build.sh +++ b/lang/csharp/build.sh @@ -15,10 +15,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -set -e # exit on error -set -x +set -e # exit on error +set -x -cd `dirname "$0"` # connect to root +cd `dirname "$0"` # connect to root ROOT=../.. VERSION=`cat $ROOT/share/VERSION.txt` @@ -28,38 +28,38 @@ export TARGETFRAMEWORKVERSION=v3.5 case "$1" in - test) - xbuild - nunit-console -framework=4.0 Avro.nunit - ;; + test) + xbuild + nunit-console -framework=4.0 Avro.nunit + ;; - perf) - xbuild - mono build/perf/Release/Avro.perf.exe - ;; + perf) + xbuild + mono build/perf/Release/Avro.perf.exe + ;; - dist) - # build binary tarball - xbuild - # add the binary LICENSE and NOTICE to the tarball - cp LICENSE NOTICE build/ - mkdir -p $ROOT/dist/csharp - (cd build; tar czf $ROOT/../dist/csharp/avro-csharp-$VERSION.tar.gz main codegen ipc LICENSE NOTICE) + dist) + # build binary tarball + xbuild + # add the binary LICENSE and NOTICE to the tarball + cp LICENSE NOTICE build/ + mkdir -p $ROOT/dist/csharp + (cd build; tar czf $ROOT/../dist/csharp/avro-csharp-$VERSION.tar.gz main codegen ipc LICENSE NOTICE) - # build documentation - doxygen Avro.dox - mkdir -p $ROOT/build/avro-doc-$VERSION/api/csharp - cp -pr build/doc/* $ROOT/build/avro-doc-$VERSION/api/csharp - ;; + # build documentation + doxygen Avro.dox + mkdir -p $ROOT/build/avro-doc-$VERSION/api/csharp + cp -pr build/doc/* $ROOT/build/avro-doc-$VERSION/api/csharp + ;; - clean) - rm -rf src/apache/{main,test,codegen,ipc}/obj - rm -rf build - ;; + clean) + rm -rf src/apache/{main,test,codegen,ipc}/obj + rm -rf build + ;; - *) - echo "Usage: $0 {test|clean|dist|perf}" - exit 1 + *) + echo "Usage: $0 {test|clean|dist|perf}" + exit 1 esac exit 0 diff --git a/lang/java/archetypes/avro-service-archetype/src/main/resources/archetype-resources/src/main/avro/order-service.avpr b/lang/java/archetypes/avro-service-archetype/src/main/resources/archetype-resources/src/main/avro/order-service.avpr index b9ea5c515aa..c835141166d 100644 --- a/lang/java/archetypes/avro-service-archetype/src/main/resources/archetype-resources/src/main/avro/order-service.avpr +++ b/lang/java/archetypes/avro-service-archetype/src/main/resources/archetype-resources/src/main/avro/order-service.avpr @@ -2,45 +2,45 @@ "namespace":"${package}.service", "protocol": "OrderProcessingService", "doc": "Protocol to submit customer Orders", - "types": [ - { + "types": [ + { "name": "Item", "type": "record", "fields": [ {"name": "name", "type": "string"}, {"name": "sku", "type": "long"}, - {"name": "quantity", "type": "int"} - ] - }, - { + {"name": "quantity", "type": "int"} + ] + }, + { "name": "Order", "type": "record", "fields": [ {"name": "customerId", "type": "long"}, {"name": "orderId", "type": "long"}, - {"name": "orderItems", "type": {"type": "array", "items": "Item"}} - ] - }, - { + {"name": "orderItems", "type": {"type": "array", "items": "Item"}} + ] + }, + { "name": "Confirmation", "type": "record", "fields": [ {"name": "customerId", "type": {"type": "long"}}, {"name": "orderId", "type": "long"}, {"name": "estimatedCompletion", "type": "long"} - ] - }, - { + ] + }, + { "name": "OrderFailure", "type": "error", "fields": [ - {"name": "message", "type": "string"} + {"name": "message", "type": "string"} ] - } + } ], - + "messages": { "submitOrder": { - "doc": "Submit an Order", - "request": [{"name": "order", "type": "Order"}], - "response": "Confirmation", - "errors": ["OrderFailure"] - } + "doc": "Submit an Order", + "request": [{"name": "order", "type": "Order"}], + "response": "Confirmation", + "errors": ["OrderFailure"] + } } } diff --git a/lang/java/archetypes/avro-service-archetype/src/main/resources/archetype-resources/src/main/java/service/SimpleOrderService.java b/lang/java/archetypes/avro-service-archetype/src/main/resources/archetype-resources/src/main/java/service/SimpleOrderService.java index 161ddc3db78..0c933a96715 100644 --- a/lang/java/archetypes/avro-service-archetype/src/main/resources/archetype-resources/src/main/java/service/SimpleOrderService.java +++ b/lang/java/archetypes/avro-service-archetype/src/main/resources/archetype-resources/src/main/java/service/SimpleOrderService.java @@ -31,7 +31,7 @@ */ public class SimpleOrderService implements OrderProcessingService { - private Logger log = LoggerFactory.getLogger(SimpleOrderService.class); + private Logger log = LoggerFactory.getLogger(SimpleOrderService.class); @Override public Confirmation submitOrder(Order order) throws AvroRemoteException, OrderFailure { diff --git a/lang/java/archetypes/avro-service-archetype/src/main/resources/archetype-resources/src/test/java/integration/SimpleOrderServiceIntegrationTest.java b/lang/java/archetypes/avro-service-archetype/src/main/resources/archetype-resources/src/test/java/integration/SimpleOrderServiceIntegrationTest.java index e751192ab1b..788666692ca 100644 --- a/lang/java/archetypes/avro-service-archetype/src/main/resources/archetype-resources/src/test/java/integration/SimpleOrderServiceIntegrationTest.java +++ b/lang/java/archetypes/avro-service-archetype/src/main/resources/archetype-resources/src/test/java/integration/SimpleOrderServiceIntegrationTest.java @@ -44,44 +44,44 @@ */ public class SimpleOrderServiceIntegrationTest { - private static SimpleOrderServiceEndpoint service; - private static SimpleOrderServiceClient client; + private static SimpleOrderServiceEndpoint service; + private static SimpleOrderServiceClient client; - @Test - public void simpleRoundTripTest() throws Exception { - Order simpleOrder = createOrder(); - Confirmation c = client.submitOrder(simpleOrder); + @Test + public void simpleRoundTripTest() throws Exception { + Order simpleOrder = createOrder(); + Confirmation c = client.submitOrder(simpleOrder); - assertEquals(c.getOrderId(), simpleOrder.getOrderId()); - assertEquals(c.getCustomerId(), simpleOrder.getCustomerId()); - assertTrue(c.getEstimatedCompletion() > 0); - } + assertEquals(c.getOrderId(), simpleOrder.getOrderId()); + assertEquals(c.getCustomerId(), simpleOrder.getCustomerId()); + assertTrue(c.getEstimatedCompletion() > 0); + } - @BeforeClass - public static void setupTransport() throws Exception { - InetSocketAddress endpointAddress = new InetSocketAddress("0.0.0.0", 12345); - service = new SimpleOrderServiceEndpoint(endpointAddress); - client = new SimpleOrderServiceClient(endpointAddress); + @BeforeClass + public static void setupTransport() throws Exception { + InetSocketAddress endpointAddress = new InetSocketAddress("0.0.0.0", 12345); + service = new SimpleOrderServiceEndpoint(endpointAddress); + client = new SimpleOrderServiceClient(endpointAddress); - service.start(); - client.start(); - } + service.start(); + client.start(); + } - @AfterClass - public static void shutdownTransport() throws Exception { - client.stop(); - service.stop(); - } + @AfterClass + public static void shutdownTransport() throws Exception { + client.stop(); + service.stop(); + } - public Order createOrder() { - return Order.newBuilder().setOrderId(1).setCustomerId(1).setOrderItems(createItems()).build(); - } + public Order createOrder() { + return Order.newBuilder().setOrderId(1).setCustomerId(1).setOrderItems(createItems()).build(); + } - public List createItems() { - List items = new ArrayList(); - for (int x = 0; x < 5; x++) - items.add(Item.newBuilder().setName("Item-" + x).setQuantity(x + 1).setSku(1230 + x).build()); - return items; - } + public List createItems() { + List items = new ArrayList(); + for (int x = 0; x < 5; x++) + items.add(Item.newBuilder().setName("Item-" + x).setQuantity(x + 1).setSku(1230 + x).build()); + return items; + } } diff --git a/lang/java/avro/src/main/java/org/apache/avro/AvroRemoteException.java b/lang/java/avro/src/main/java/org/apache/avro/AvroRemoteException.java index 11e2125dc38..8af0f71c351 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/AvroRemoteException.java +++ b/lang/java/avro/src/main/java/org/apache/avro/AvroRemoteException.java @@ -35,12 +35,12 @@ public AvroRemoteException(Object value) { super(value != null ? value.toString() : null); this.value = value; } - + public AvroRemoteException(Object value, Throwable cause) { super(value != null ? value.toString() : null, cause); this.value = value; } - + public Object getValue() { return value; } } diff --git a/lang/java/avro/src/main/java/org/apache/avro/JsonProperties.java b/lang/java/avro/src/main/java/org/apache/avro/JsonProperties.java index 62730369336..4e18c09b056 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/JsonProperties.java +++ b/lang/java/avro/src/main/java/org/apache/avro/JsonProperties.java @@ -31,7 +31,7 @@ /** * Base class for objects that have JSON-valued properties. Avro and JSON values are * represented in Java using the following mapping: - * + * * * @@ -154,7 +154,7 @@ public synchronized Object getObjectProp(String name) { * value value. Neither name nor value can be * null. It is illegal to add a property if another with * the same name but different value already exists in this schema. - * + * * @param name The name of the property to add * @param value The value for the property to add */ @@ -167,7 +167,7 @@ public void addProp(String name, String value) { * value value. Neither name nor value can be * null. It is illegal to add a property if another with * the same name but different value already exists in this schema. - * + * * @param name The name of the property to add * @param value The value for the property to add * @deprecated use {@link #addProp(String, Object)} @@ -176,10 +176,10 @@ public void addProp(String name, String value) { public synchronized void addProp(String name, JsonNode value) { if (reserved.contains(name)) throw new AvroRuntimeException("Can't set reserved property: " + name); - + if (value == null) throw new AvroRuntimeException("Can't set a property to null: " + name); - + JsonNode old = props.get(name); if (old == null) props.put(name, value); diff --git a/lang/java/avro/src/main/java/org/apache/avro/Protocol.java b/lang/java/avro/src/main/java/org/apache/avro/Protocol.java index 9c896d2af7a..73e235c89a9 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/Protocol.java +++ b/lang/java/avro/src/main/java/org/apache/avro/Protocol.java @@ -110,7 +110,7 @@ private Message(String name, String doc, public Schema getErrors() { return Schema.createUnion(new ArrayList()); } - + /** Returns true if this is a one-way message, with no response or errors.*/ public boolean isOneWay() { return true; } @@ -161,7 +161,7 @@ public int hashCode() { private class TwoWayMessage extends Message { private Schema response; private Schema errors; - + /** Construct a message. */ private TwoWayMessage(String name, String doc, Map propMap, Schema request, Schema response, Schema errors) { @@ -245,7 +245,7 @@ public Protocol(String name, String namespace) { /** The namespace of this protocol. Qualifies its name. */ public String getNamespace() { return namespace; } - + /** Doc string for this protocol. */ public String getDoc() { return doc; } @@ -300,7 +300,7 @@ public boolean equals(Object o) { && this.messages.equals(that.messages) && this.props.equals(that.props); } - + public int hashCode() { return name.hashCode() + namespace.hashCode() + types.hashCode() + messages.hashCode() + props.hashCode(); @@ -340,7 +340,7 @@ void toJson(JsonGenerator gen) throws IOException { if (!resolved.contains(type)) type.toJson(resolved, gen); gen.writeEndArray(); - + gen.writeObjectFieldStart("messages"); for (Map.Entry e : messages.entrySet()) { gen.writeFieldName(e.getKey()); @@ -379,7 +379,7 @@ public static Protocol parse(String string, String... more) { b.append(part); return parse(b.toString()); } - + /** Read a protocol from a Json string. */ public static Protocol parse(String string) { try { @@ -415,7 +415,7 @@ private void parseNamespace(JsonNode json) { this.namespace = nameNode.getTextValue(); types.space(this.namespace); } - + private void parseDoc(JsonNode json) { this.doc = parseDocNode(json); } @@ -505,7 +505,7 @@ private Message parseMessage(String messageName, JsonNode json) { fields.add(newField); } Schema request = Schema.createRecord(fields); - + boolean oneWay = false; JsonNode oneWayNode = json.get("one-way"); if (oneWayNode != null) { diff --git a/lang/java/avro/src/main/java/org/apache/avro/Schema.java b/lang/java/avro/src/main/java/org/apache/avro/Schema.java index e2ba9277272..8125692326b 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/Schema.java +++ b/lang/java/avro/src/main/java/org/apache/avro/Schema.java @@ -63,7 +63,7 @@ *
    6. A boolean; or *
    7. null. * - * + * * A schema can be constructed using one of its static createXXX * methods, or more conveniently using {@link SchemaBuilder}. The schema objects are * logically immutable. @@ -231,13 +231,13 @@ public void setFields(List fields) { /** If this is an enum, return its symbols. */ public List getEnumSymbols() { throw new AvroRuntimeException("Not an enum: "+this); - } + } /** If this is an enum, return a symbol's ordinal value. */ public int getEnumOrdinal(String symbol) { throw new AvroRuntimeException("Not an enum: "+this); - } - + } + /** If this is an enum, returns true if it contains given symbol. */ public boolean hasEnumSymbol(String symbol) { throw new AvroRuntimeException("Not an enum: "+this); @@ -460,7 +460,7 @@ public boolean equals(Object other) { props.equals(that.props); } public int hashCode() { return name.hashCode() + schema.computeHash(); } - + private boolean defaultValueEquals(JsonNode thatDefaultValue) { if (defaultValue == null) return thatDefaultValue == null; @@ -870,12 +870,12 @@ public boolean equals(Object o) { hash += type.computeHash(); return hash; } - + @Override public void addProp(String name, String value) { throw new AvroRuntimeException("Can't set properties on a union: "+this); } - + void toJson(Names names, JsonGenerator gen) throws IOException { gen.writeStartArray(); for (Schema type : types) @@ -944,7 +944,7 @@ private static class DoubleSchema extends Schema { private static class BooleanSchema extends Schema { public BooleanSchema() { super(Type.BOOLEAN); } } - + private static class NullSchema extends Schema { public NullSchema() { super(Type.NULL); } } @@ -1012,7 +1012,7 @@ public Schema parse(String s, String... more) { b.append(part); return parse(b.toString()); } - + /** Parse a schema from the provided string. * If named, the schema is added to the names known to this parser. */ public Schema parse(String s) { @@ -1129,14 +1129,14 @@ public Schema put(Name name, Schema schema) { return super.put(name, schema); } } - + private static ThreadLocal validateNames = new ThreadLocal() { @Override protected Boolean initialValue() { return true; } }; - + private static String validateName(String name) { if (!validateNames.get()) return name; // not validating names int length = name.length(); @@ -1159,7 +1159,7 @@ private static String validateName(String name) { return false; } }; - + private static JsonNode validateDefault(String fieldName, Schema schema, JsonNode defaultValue) { if (VALIDATE_DEFAULTS.get() && (defaultValue != null) @@ -1175,7 +1175,7 @@ private static boolean isValidDefault(Schema schema, JsonNode defaultValue) { if (defaultValue == null) return false; switch (schema.getType()) { - case STRING: + case STRING: case BYTES: case ENUM: case FIXED: @@ -1356,7 +1356,7 @@ static Set parseAliases(JsonNode node) { throw new SchemaParseException("alias not a string: "+aliasNode); aliases.add(aliasNode.getTextValue()); } - return aliases; + return aliases; } /** Extracts text value associated to key from the container JsonNode, @@ -1413,7 +1413,7 @@ public static Schema applyAliases(Schema writer, Schema reader) { if (aliases.size() == 0 && fieldAliases.size() == 0) return writer; // no aliases - + seen.clear(); return applyAliases(writer, seen, aliases, fieldAliases); } @@ -1533,13 +1533,13 @@ private static void getAliases(Schema schema, * called on it. * @param */ - + /* * This class keeps a boolean variable locked which is set * to true in the lock() method. It's legal to call * lock() any number of times. Any lock() other than the first one * is a no-op. - * + * * This class throws IllegalStateException if a mutating * operation is performed after being locked. Since modifications through * iterator also use the list's mutating operations, this effectively @@ -1548,7 +1548,7 @@ private static void getAliases(Schema schema, static class LockableArrayList extends ArrayList { private static final long serialVersionUID = 1L; private boolean locked = false; - + public LockableArrayList() { } @@ -1580,42 +1580,42 @@ public boolean add(E e) { ensureUnlocked(); return super.add(e); } - + public boolean remove(Object o) { ensureUnlocked(); return super.remove(o); } - + public E remove(int index) { ensureUnlocked(); return super.remove(index); } - + public boolean addAll(Collection c) { ensureUnlocked(); return super.addAll(c); } - + public boolean addAll(int index, Collection c) { ensureUnlocked(); return super.addAll(index, c); } - + public boolean removeAll(Collection c) { ensureUnlocked(); return super.removeAll(c); } - + public boolean retainAll(Collection c) { ensureUnlocked(); return super.retainAll(c); } - + public void clear() { ensureUnlocked(); super.clear(); } } - + } diff --git a/lang/java/avro/src/main/java/org/apache/avro/SchemaBuilder.java b/lang/java/avro/src/main/java/org/apache/avro/SchemaBuilder.java index 55730146b6e..f1a1faa1515 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/SchemaBuilder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/SchemaBuilder.java @@ -44,7 +44,7 @@ *

      * For example, the below JSON schema and the fluent builder code to create it * are very similar: - * + * *
        * {
        *   "type": "record",
      @@ -58,7 +58,7 @@
        *   ]
        * }
        * 
      - * + * *
        *   Schema schema = SchemaBuilder
        *   .record("HandshakeRequest").namespace("org.apache.avro.ipc)
      @@ -70,7 +70,7 @@
        *   .endRecord();
        * 
      *

      - * + * *

      Usage Guide
      * SchemaBuilder chains together many smaller builders and maintains nested * context in order to mimic the Avro Schema specification. Every Avro type in @@ -87,7 +87,7 @@ * share a similar API for selecting and building types. *

      *

      Primitive Types
      - * All Avro primitive types are trivial to configure. A primitive type in + * All Avro primitive types are trivial to configure. A primitive type in * Avro JSON can be declared two ways, one that supports custom properties * and one that does not: *
      @@ -141,12 +141,12 @@
        * 
      Nested Types
      * The Avro nested types, map and array, can have custom properties like * all avro types, are not named, and must specify a nested type. - * After configuration of optional properties, an array or map + * After configuration of optional properties, an array or map * builds or selects its nested type with {@link ArrayBuilder#items()} * and {@link MapBuilder#values()}, respectively. - * + * *
      Fields
      - * {@link RecordBuilder#fields()} returns a {@link FieldAssembler} for + * {@link RecordBuilder#fields()} returns a {@link FieldAssembler} for * defining the fields of the record and completing it. * Each field must have a name, specified via {@link FieldAssembler#name(String)}, * which returns a {@link FieldBuilder} for defining aliases, custom properties, @@ -159,9 +159,9 @@ * {@link IntDefault#intDefault(int)} *

      * There are field shortcut methods on {@link FieldAssembler} for primitive types. - * These shortcuts create required, optional, and nullable fields, but do not + * These shortcuts create required, optional, and nullable fields, but do not * support field aliases, doc, or custom properties. - * + * *

      Unions
      * Union types are built via {@link TypeBuilder#unionOf()} or * {@link FieldTypeBuilder#unionOf()} in the context of type selection. @@ -196,7 +196,7 @@ * .name("f").type().unionOf().nullType().and().longType().endUnion().nullDefault() * .name("f").type().optional().longType() *
      - * + * *
      Explicit Types and Types by Name
      * Types can also be specified explicitly by passing in a Schema, or by name: *
      @@ -218,7 +218,7 @@ public class SchemaBuilder {
       
         private SchemaBuilder() {
         }
      -  
      +
         /**
          * Create a builder for Avro schemas.
          */
      @@ -234,7 +234,7 @@ public static TypeBuilder builder(String namespace) {
           return new TypeBuilder(new SchemaCompletion(),
               new NameContext().namespace(namespace));
         }
      -  
      +
         /**
          * Create a builder for an Avro record with the specified name.
          * This is equivalent to:
      @@ -292,7 +292,7 @@ public static ArrayBuilder array() {
         public static MapBuilder map() {
           return builder().map();
         }
      -  
      +
         /**
          * Create a builder for an Avro union
          * This is equivalent to:
      @@ -303,7 +303,7 @@ public static MapBuilder map() {
         public static BaseTypeBuilder> unionOf() {
           return builder().unionOf();
         }
      -  
      +
         /**
          * Create a builder for a union of a type and null.
          * This is a shortcut for:
      @@ -322,7 +322,7 @@ public static BaseTypeBuilder nullable() {
           return builder().nullable();
         }
       
      -  
      +
         /**
          * An abstract builder for all Avro types.  All Avro types
          * can have arbitrary string key-value properties.
      @@ -331,14 +331,14 @@ public static abstract class PropBuilder> {
           private Map props = null;
           protected PropBuilder() {
           }
      -    
      +
           /**
            * Set name-value pair properties for this type or field.
            */
           public final S prop(String name, String val) {
             return prop(name, TextNode.valueOf(val));
           }
      -    
      +
           // for internal use by the Parser
           final S prop(String name, JsonNode val) {
             if(!hasProps()) {
      @@ -347,11 +347,11 @@ final S prop(String name, JsonNode val) {
             props.put(name, val);
             return self();
           }
      -    
      +
           private boolean hasProps() {
             return (props != null);
           }
      -    
      +
           final  T addPropsTo(T jsonable) {
             if (hasProps()) {
               for(Map.Entry prop : props.entrySet()) {
      @@ -364,7 +364,7 @@ final  T addPropsTo(T jsonable) {
            * must return 'this' **/
           protected abstract S self();
         }
      -  
      +
         /**
          * An abstract type that provides builder methods for configuring the name,
          * doc, and aliases of all Avro types that have names (fields, Fixed, Record,
      @@ -429,7 +429,7 @@ final Field addAliasesTo(Field field) {
             return field;
           }
         }
      -  
      +
         /**
          * An abstract type that provides builder methods for configuring the
          * namespace for all Avro types that have namespaces (Fixed, Record, and
      @@ -475,7 +475,7 @@ final Completion context() {
             return context;
           }
         }
      -  
      +
         /**
          * An abstraction for sharing code amongst all primitive type builders.
          */
      @@ -779,7 +779,7 @@ public R symbols(String... symbols) {
           }
       
         }
      -  
      +
         /**
          * Builds an Avro Map type with optional properties.
          * 

      @@ -873,12 +873,12 @@ public R items(Schema itemsSchema) { /** * internal class for passing the naming context around. This allows for the - * following: + * following: *

    8. Cache and re-use primitive schemas when they do not set * properties.
    9. *
    10. Provide a default namespace for nested contexts (as * the JSON Schema spec does).
    11. - *
    12. Allow previously defined named types or primitive types + *
    13. Allow previously defined named types or primitive types * to be referenced by name.
    14. **/ private static class NameContext { @@ -895,7 +895,7 @@ private static class NameContext { } private final HashMap schemas; private final String namespace; - + private NameContext() { this.schemas = new HashMap(); this.namespace = null; @@ -908,20 +908,20 @@ private NameContext() { schemas.put("bytes", Schema.create(Schema.Type.BYTES)); schemas.put("string", Schema.create(Schema.Type.STRING)); } - + private NameContext(HashMap schemas, String namespace) { this.schemas = schemas; this.namespace = "".equals(namespace) ? null : namespace; } - + private NameContext namespace(String namespace) { return new NameContext(schemas, namespace); } - + private Schema get(String name, String namespace) { return getFullname(resolveName(name, namespace)); } - + private Schema getFullname(String fullName) { Schema schema = schemas.get(fullName); if(schema == null) { @@ -929,7 +929,7 @@ private Schema getFullname(String fullName) { } return schema; } - + private void put(Schema schema) { String fullName = schema.getFullName(); if(schemas.containsKey(fullName)){ @@ -937,7 +937,7 @@ private void put(Schema schema) { } schemas.put(fullName, schema); } - + private String resolveName(String name, String space) { if (PRIMITIVES.contains(name) && space == null) { return name; @@ -950,11 +950,11 @@ private String resolveName(String name, String space) { if (space != null && !"".equals(space)) { return space + "." + name; } - } + } return name; } } - + /** * A common API for building types within a context. BaseTypeBuilder can build * all types other than Unions. {@link TypeBuilder} can additionally build @@ -971,17 +971,17 @@ private String resolveName(String name, String space) { public static class BaseTypeBuilder { private final Completion context; private final NameContext names; - + private BaseTypeBuilder(Completion context, NameContext names) { this.context = context; this.names = names; } - + /** Use the schema provided as the type. **/ public final R type(Schema schema) { return context.complete(schema); } - + /** * Look up the type by name. This type must be previously defined in the * context of this builder. @@ -993,7 +993,7 @@ public final R type(Schema schema) { public final R type(String name) { return type(name, null); } - + /** * Look up the type by name and namespace. This type must be previously * defined in the context of this builder. @@ -1042,7 +1042,7 @@ public final R intType() { public final IntBuilder intBuilder() { return IntBuilder.create(context, names); } - + /** * A plain long type without custom properties. This is equivalent to: *
      @@ -1159,7 +1159,7 @@ public final NullBuilder nullBuilder() {
            * 
            * {"type":"map", "values":"int"}
            * 
      - **/ + **/ public final MapBuilder map() { return MapBuilder.create(context, names); } @@ -1172,7 +1172,7 @@ public final MapBuilder map() { *
            * {"type":"array", "values":"long"}
            * 
      - **/ + **/ public final ArrayBuilder array() { return ArrayBuilder.create(context, names); } @@ -1185,12 +1185,12 @@ public final ArrayBuilder array() { *
            * {"type":"fixed", "name":"com.foo.IPv4", "size":4}
            * 
      - **/ + **/ public final FixedBuilder fixed(String name) { return FixedBuilder.create(context, names, name); } - - /** Build an Avro enum type. Example usage: + + /** Build an Avro enum type. Example usage: *
            * enumeration("Suits").namespace("org.cards").doc("card suit names")
            *   .symbols("HEART", "SPADE", "DIAMOND", "CLUB")
      @@ -1201,7 +1201,7 @@ public final FixedBuilder fixed(String name) {
            *  "doc":"card suit names", "symbols":[
            *    "HEART", "SPADE", "DIAMOND", "CLUB"]}
            * 
      - **/ + **/ public final EnumBuilder enumeration(String name) { return EnumBuilder.create(context, names, name); } @@ -1224,18 +1224,18 @@ public final EnumBuilder enumeration(String name) { * ]} * ]} *
      - **/ + **/ public final RecordBuilder record(String name) { - return RecordBuilder.create(context, names, name); + return RecordBuilder.create(context, names, name); } - + /** Build an Avro union schema type. Example usage: *
      unionOf().stringType().and().bytesType().endUnion()
      - **/ + **/ protected BaseTypeBuilder> unionOf() { return UnionBuilder.create(context, names); } - + /** A shortcut for building a union of a type and null. *

      * For example, the code snippets below are equivalent: @@ -1245,10 +1245,10 @@ protected BaseTypeBuilder> unionOf() { protected BaseTypeBuilder nullable() { return new BaseTypeBuilder(new NullableCompletion(context), names); } - + } - /** A Builder for creating any Avro schema type. + /** A Builder for creating any Avro schema type. **/ public static final class TypeBuilder extends BaseTypeBuilder { private TypeBuilder(Completion context, NameContext names) { @@ -1259,7 +1259,7 @@ private TypeBuilder(Completion context, NameContext names) { public BaseTypeBuilder> unionOf() { return super.unionOf(); } - + @Override public BaseTypeBuilder nullable() { return super.nullable(); @@ -1310,7 +1310,7 @@ protected BaseFieldTypeBuilder(FieldBuilder bldr, CompletionWrapper wrapper) this.names = bldr.names(); this.wrapper = wrapper; } - + /** * A plain boolean type without custom properties. This is equivalent to: *

      @@ -1346,7 +1346,7 @@ public final IntDefault intType() {
           public final IntBuilder> intBuilder() {
             return IntBuilder.create(wrap(new IntDefault(bldr)), names);
           }
      -    
      +
           /**
            * A plain long type without custom properties. This is equivalent to:
            * 
      @@ -1455,31 +1455,31 @@ public final NullBuilder> nullBuilder() {
             return NullBuilder.create(wrap(new NullDefault(bldr)), names);
           }
       
      -    /** Build an Avro map type **/ 
      +    /** Build an Avro map type **/
           public final MapBuilder> map() {
             return MapBuilder.create(wrap(new MapDefault(bldr)), names);
           }
       
      -    /** Build an Avro array type **/ 
      +    /** Build an Avro array type **/
           public final ArrayBuilder> array() {
             return ArrayBuilder.create(wrap(new ArrayDefault(bldr)), names);
           }
       
      -    /** Build an Avro fixed type. **/ 
      +    /** Build an Avro fixed type. **/
           public final FixedBuilder> fixed(String name) {
             return FixedBuilder.create(wrap(new FixedDefault(bldr)), names, name);
           }
      -    
      -    /** Build an Avro enum type. **/ 
      +
      +    /** Build an Avro enum type. **/
           public final EnumBuilder> enumeration(String name) {
             return EnumBuilder.create(wrap(new EnumDefault(bldr)), names, name);
           }
       
      -    /** Build an Avro record type. **/ 
      +    /** Build an Avro record type. **/
           public final RecordBuilder> record(String name) {
      -      return RecordBuilder.create(wrap(new RecordDefault(bldr)), names, name); 
      +      return RecordBuilder.create(wrap(new RecordDefault(bldr)), names, name);
           }
      -    
      +
           private  Completion wrap(
              Completion completion) {
             if (wrapper != null) {
      @@ -1488,7 +1488,7 @@ private  Completion wrap(
             return completion;
           }
         }
      -  
      +
         /** FieldTypeBuilder adds {@link #unionOf()}, {@link #nullable()}, and {@link #optional()}
          * to BaseFieldTypeBuilder. **/
         public static final class FieldTypeBuilder extends BaseFieldTypeBuilder {
      @@ -1496,7 +1496,7 @@ private FieldTypeBuilder(FieldBuilder bldr) {
             super(bldr, null);
           }
       
      -    /** Build an Avro union schema type. **/ 
      +    /** Build an Avro union schema type. **/
           public UnionFieldTypeBuilder unionOf() {
             return new UnionFieldTypeBuilder(bldr);
           }
      @@ -1537,7 +1537,7 @@ private UnionFieldTypeBuilder(FieldBuilder bldr) {
             this.bldr = bldr;
             this.names = bldr.names();
           }
      -    
      +
           /**
            * A plain boolean type without custom properties. This is equivalent to:
            * 
      @@ -1573,7 +1573,7 @@ public UnionAccumulator> intType() {
           public IntBuilder>> intBuilder() {
             return IntBuilder.create(completion(new IntDefault(bldr)), names);
           }
      -    
      +
           /**
            * A plain long type without custom properties. This is equivalent to:
            * 
      @@ -1682,31 +1682,31 @@ public NullBuilder>> nullBuilder() {
             return NullBuilder.create(completion(new NullDefault(bldr)), names);
           }
       
      -    /** Build an Avro map type **/ 
      +    /** Build an Avro map type **/
           public MapBuilder>> map() {
             return MapBuilder.create(completion(new MapDefault(bldr)), names);
           }
       
      -    /** Build an Avro array type **/ 
      +    /** Build an Avro array type **/
           public ArrayBuilder>> array() {
             return ArrayBuilder.create(completion(new ArrayDefault(bldr)), names);
           }
       
      -    /** Build an Avro fixed type. **/ 
      +    /** Build an Avro fixed type. **/
           public FixedBuilder>> fixed(String name) {
             return FixedBuilder.create(completion(new FixedDefault(bldr)), names, name);
           }
      -    
      -    /** Build an Avro enum type. **/ 
      +
      +    /** Build an Avro enum type. **/
           public EnumBuilder>> enumeration(String name) {
             return EnumBuilder.create(completion(new EnumDefault(bldr)), names, name);
           }
       
      -    /** Build an Avro record type. **/ 
      +    /** Build an Avro record type. **/
           public RecordBuilder>> record(String name) {
      -      return RecordBuilder.create(completion(new RecordDefault(bldr)), names, name); 
      +      return RecordBuilder.create(completion(new RecordDefault(bldr)), names, name);
           }
      -    
      +
           private  UnionCompletion completion(Completion context) {
             return new UnionCompletion(context, names, new ArrayList());
           }
      @@ -1756,7 +1756,7 @@ private FieldAssembler(Completion context, NameContext names, Schema record)
           public FieldBuilder name(String fieldName) {
             return new FieldBuilder(this, names, fieldName);
           }
      -    
      +
           /**
            * Shortcut for creating a boolean field with the given name and no default.
            * 

      This is equivalent to: @@ -1767,9 +1767,9 @@ public FieldBuilder name(String fieldName) { public FieldAssembler requiredBoolean(String fieldName) { return name(fieldName).type().booleanType().noDefault(); } - + /** - * Shortcut for creating an optional boolean field: a union of null and + * Shortcut for creating an optional boolean field: a union of null and * boolean with null default.

      * This is equivalent to: *

      @@ -1779,13 +1779,13 @@ public FieldAssembler requiredBoolean(String fieldName) {
           public FieldAssembler optionalBoolean(String fieldName) {
             return name(fieldName).type().optional().booleanType();
           }
      -    
      +
           /**
            * Shortcut for creating a nullable boolean field: a union of boolean and
            * null with an boolean default.
            * 

      * This is equivalent to: - * + * *

            * name(fieldName).type().nullable().booleanType().booleanDefault(defaultVal)
            * 
      @@ -1805,7 +1805,7 @@ public FieldAssembler nullableBoolean(String fieldName, boolean defaultVal) { public FieldAssembler requiredInt(String fieldName) { return name(fieldName).type().intType().noDefault(); } - + /** * Shortcut for creating an optional int field: a union of null and int * with null default.

      @@ -1817,7 +1817,7 @@ public FieldAssembler requiredInt(String fieldName) { public FieldAssembler optionalInt(String fieldName) { return name(fieldName).type().optional().intType(); } - + /** * Shortcut for creating a nullable int field: a union of int and null * with an int default.

      @@ -1840,7 +1840,7 @@ public FieldAssembler nullableInt(String fieldName, int defaultVal) { public FieldAssembler requiredLong(String fieldName) { return name(fieldName).type().longType().noDefault(); } - + /** * Shortcut for creating an optional long field: a union of null and long * with null default.

      @@ -1852,7 +1852,7 @@ public FieldAssembler requiredLong(String fieldName) { public FieldAssembler optionalLong(String fieldName) { return name(fieldName).type().optional().longType(); } - + /** * Shortcut for creating a nullable long field: a union of long and null * with a long default.

      @@ -1864,7 +1864,7 @@ public FieldAssembler optionalLong(String fieldName) { public FieldAssembler nullableLong(String fieldName, long defaultVal) { return name(fieldName).type().nullable().longType().longDefault(defaultVal); } - + /** * Shortcut for creating a float field with the given name and no default. *

      This is equivalent to: @@ -1875,7 +1875,7 @@ public FieldAssembler nullableLong(String fieldName, long defaultVal) { public FieldAssembler requiredFloat(String fieldName) { return name(fieldName).type().floatType().noDefault(); } - + /** * Shortcut for creating an optional float field: a union of null and float * with null default.

      @@ -1887,7 +1887,7 @@ public FieldAssembler requiredFloat(String fieldName) { public FieldAssembler optionalFloat(String fieldName) { return name(fieldName).type().optional().floatType(); } - + /** * Shortcut for creating a nullable float field: a union of float and null * with a float default.

      @@ -1910,7 +1910,7 @@ public FieldAssembler nullableFloat(String fieldName, float defaultVal) { public FieldAssembler requiredDouble(String fieldName) { return name(fieldName).type().doubleType().noDefault(); } - + /** * Shortcut for creating an optional double field: a union of null and double * with null default.

      @@ -1922,7 +1922,7 @@ public FieldAssembler requiredDouble(String fieldName) { public FieldAssembler optionalDouble(String fieldName) { return name(fieldName).type().optional().doubleType(); } - + /** * Shortcut for creating a nullable double field: a union of double and null * with a double default.

      @@ -1934,7 +1934,7 @@ public FieldAssembler optionalDouble(String fieldName) { public FieldAssembler nullableDouble(String fieldName, double defaultVal) { return name(fieldName).type().nullable().doubleType().doubleDefault(defaultVal); } - + /** * Shortcut for creating a string field with the given name and no default. *

      This is equivalent to: @@ -1945,7 +1945,7 @@ public FieldAssembler nullableDouble(String fieldName, double defaultVal) { public FieldAssembler requiredString(String fieldName) { return name(fieldName).type().stringType().noDefault(); } - + /** * Shortcut for creating an optional string field: a union of null and string * with null default.

      @@ -1957,7 +1957,7 @@ public FieldAssembler requiredString(String fieldName) { public FieldAssembler optionalString(String fieldName) { return name(fieldName).type().optional().stringType(); } - + /** * Shortcut for creating a nullable string field: a union of string and null * with a string default.

      @@ -1980,7 +1980,7 @@ public FieldAssembler nullableString(String fieldName, String defaultVal) { public FieldAssembler requiredBytes(String fieldName) { return name(fieldName).type().bytesType().noDefault(); } - + /** * Shortcut for creating an optional bytes field: a union of null and bytes * with null default.

      @@ -1992,7 +1992,7 @@ public FieldAssembler requiredBytes(String fieldName) { public FieldAssembler optionalBytes(String fieldName) { return name(fieldName).type().optional().bytesType(); } - + /** * Shortcut for creating a nullable bytes field: a union of bytes and null * with a bytes default.

      @@ -2018,12 +2018,12 @@ private FieldAssembler addField(Field field) { fields.add(field); return this; } - + } - + /** * Builds a Field in the context of a {@link FieldAssembler}. - * + * * Usage is to first configure any of the optional parameters and then to call one * of the type methods to complete the field. For example *

      @@ -2040,13 +2040,13 @@ private FieldBuilder(FieldAssembler fields, NameContext names, String name) {
             super(names, name);
             this.fields = fields;
           }
      -    
      +
           /** Set this field to have ascending order.  Ascending is the default **/
           public FieldBuilder orderAscending() {
             order = Schema.Field.Order.ASCENDING;
             return self();
           }
      -    
      +
           /** Set this field to have decending order.  Decending is the default **/
           public FieldBuilder orderDescending() {
             order = Schema.Field.Order.DESCENDING;
      @@ -2058,7 +2058,7 @@ public FieldBuilder orderIgnore() {
             order = Schema.Field.Order.IGNORE;
             return self();
           }
      -    
      +
           /**
            * Final step in configuring this field, finalizing name, namespace, alias,
            * and order.
      @@ -2070,7 +2070,7 @@ public FieldTypeBuilder type() {
       
           /**
            * Final step in configuring this field, finalizing name, namespace, alias,
      -     * and order.  Sets the field's type to the provided schema, returns a 
      +     * and order.  Sets the field's type to the provided schema, returns a
            * {@link GenericDefault}.
            */
           public GenericDefault type(Schema type) {
      @@ -2110,16 +2110,16 @@ public GenericDefault type(String name, String namespace) {
             Schema schema = names().get(name, namespace);
             return type(schema);
           }
      -    
      +
           private FieldAssembler completeField(Schema schema, Object defaultVal) {
             JsonNode defaultNode = toJsonNode(defaultVal);
             return completeField(schema, defaultNode);
           }
      -    
      +
           private FieldAssembler completeField(Schema schema) {
             return completeField(schema, null);
           }
      -    
      +
           private FieldAssembler completeField(Schema schema, JsonNode defaultVal) {
             Field field = new Field(name(), schema, doc(), defaultVal, order);
             addPropsTo(field);
      @@ -2132,7 +2132,7 @@ protected FieldBuilder self() {
             return this;
           }
         }
      -    
      +
         /** Abstract base class for field defaults. **/
         public static abstract class FieldDefault> extends Completion {
           private final FieldBuilder field;
      @@ -2140,25 +2140,25 @@ public static abstract class FieldDefault> exten
           FieldDefault(FieldBuilder field) {
             this.field = field;
           }
      -    
      +
           /** Completes this field with no default value **/
           public final FieldAssembler noDefault() {
             return field.completeField(schema);
           }
      -    
      +
           private FieldAssembler usingDefault(Object defaultVal) {
             return field.completeField(schema, defaultVal);
           }
      -    
      +
           @Override
           final S complete(Schema schema) {
             this.schema = schema;
             return self();
           }
      -    
      +
           abstract S self();
         }
      -  
      +
         /** Choose whether to use a default value for the field or not. **/
         public static class BooleanDefault extends FieldDefault> {
           private BooleanDefault(FieldBuilder field) {
      @@ -2169,13 +2169,13 @@ private BooleanDefault(FieldBuilder field) {
           public final FieldAssembler booleanDefault(boolean defaultVal) {
             return super.usingDefault(defaultVal);
           }
      -    
      +
           @Override
           final BooleanDefault self() {
             return this;
           }
         }
      -  
      +
         /** Choose whether to use a default value for the field or not. **/
         public static class IntDefault extends FieldDefault> {
           private IntDefault(FieldBuilder field) {
      @@ -2186,13 +2186,13 @@ private IntDefault(FieldBuilder field) {
           public final FieldAssembler intDefault(int defaultVal) {
             return super.usingDefault(defaultVal);
           }
      -    
      +
           @Override
           final IntDefault self() {
             return this;
           }
         }
      -  
      +
         /** Choose whether to use a default value for the field or not. **/
         public static class LongDefault extends FieldDefault> {
           private LongDefault(FieldBuilder field) {
      @@ -2203,7 +2203,7 @@ private LongDefault(FieldBuilder field) {
           public final FieldAssembler longDefault(long defaultVal) {
             return super.usingDefault(defaultVal);
           }
      -    
      +
           @Override
           final LongDefault self() {
             return this;
      @@ -2220,7 +2220,7 @@ private FloatDefault(FieldBuilder field) {
           public final FieldAssembler floatDefault(float defaultVal) {
             return super.usingDefault(defaultVal);
           }
      -    
      +
           @Override
           final FloatDefault self() {
             return this;
      @@ -2237,7 +2237,7 @@ private DoubleDefault(FieldBuilder field) {
           public final FieldAssembler doubleDefault(double defaultVal) {
             return super.usingDefault(defaultVal);
           }
      -    
      +
           @Override
           final DoubleDefault self() {
             return this;
      @@ -2254,7 +2254,7 @@ private StringDefault(FieldBuilder field) {
           public final FieldAssembler stringDefault(String defaultVal) {
             return super.usingDefault(defaultVal);
           }
      -    
      +
           @Override
           final StringDefault self() {
             return this;
      @@ -2266,24 +2266,24 @@ public static class BytesDefault extends FieldDefault> {
           private BytesDefault(FieldBuilder field) {
             super(field);
           }
      -    
      +
           /** Completes this field with the default value provided, cannot be null **/
           public final FieldAssembler bytesDefault(byte[] defaultVal) {
             return super.usingDefault(ByteBuffer.wrap(defaultVal));
           }
      -    
      +
           /** Completes this field with the default value provided, cannot be null **/
           public final FieldAssembler bytesDefault(ByteBuffer defaultVal) {
             return super.usingDefault(defaultVal);
           }
      -    
      +
           /** Completes this field with the default value provided, cannot be null.
            * The string is interpreted as a byte[], with each character code point
            * value equalling the byte value, as in the Avro spec JSON default. **/
           public final FieldAssembler bytesDefault(String defaultVal) {
      -      return super.usingDefault(defaultVal);  
      +      return super.usingDefault(defaultVal);
           }
      -    
      +
           @Override
           final BytesDefault self() {
             return this;
      @@ -2300,110 +2300,110 @@ private NullDefault(FieldBuilder field) {
           public final FieldAssembler nullDefault() {
             return super.usingDefault(null);
           }
      -    
      +
           @Override
           final NullDefault self() {
             return this;
           }
         }
      -  
      +
         /** Choose whether to use a default value for the field or not. **/
         public static class MapDefault extends FieldDefault> {
           private MapDefault(FieldBuilder field) {
             super(field);
           }
      -    
      +
           /** Completes this field with the default value provided, cannot be null **/
           public final  FieldAssembler mapDefault(Map defaultVal) {
             return super.usingDefault(defaultVal);
           }
      -    
      +
           @Override
           final MapDefault self() {
             return this;
           }
         }
      -  
      +
         /** Choose whether to use a default value for the field or not. **/
         public static class ArrayDefault extends FieldDefault> {
           private ArrayDefault(FieldBuilder field) {
             super(field);
           }
      -    
      +
           /** Completes this field with the default value provided, cannot be null **/
           public final  FieldAssembler arrayDefault(List defaultVal) {
             return super.usingDefault(defaultVal);
           }
      -    
      +
           @Override
           final ArrayDefault self() {
             return this;
           }
         }
      -  
      +
         /** Choose whether to use a default value for the field or not. **/
         public static class FixedDefault extends FieldDefault> {
           private FixedDefault(FieldBuilder field) {
             super(field);
           }
      -    
      +
           /** Completes this field with the default value provided, cannot be null **/
           public final FieldAssembler fixedDefault(byte[] defaultVal) {
             return super.usingDefault(ByteBuffer.wrap(defaultVal));
           }
      -    
      +
           /** Completes this field with the default value provided, cannot be null **/
           public final FieldAssembler fixedDefault(ByteBuffer defaultVal) {
             return super.usingDefault(defaultVal);
           }
      -    
      +
           /** Completes this field with the default value provided, cannot be null.
            * The string is interpreted as a byte[], with each character code point
            * value equalling the byte value, as in the Avro spec JSON default. **/
           public final FieldAssembler fixedDefault(String defaultVal) {
      -      return super.usingDefault(defaultVal);  
      +      return super.usingDefault(defaultVal);
           }
      -    
      +
           @Override
           final FixedDefault self() {
             return this;
           }
         }
      -  
      +
         /** Choose whether to use a default value for the field or not. **/
         public static class EnumDefault extends FieldDefault> {
           private EnumDefault(FieldBuilder field) {
             super(field);
           }
      -    
      +
           /** Completes this field with the default value provided, cannot be null **/
           public final FieldAssembler enumDefault(String defaultVal) {
             return super.usingDefault(defaultVal);
           }
      -    
      +
           @Override
           final EnumDefault self() {
             return this;
           }
         }
      -  
      +
         /** Choose whether to use a default value for the field or not. **/
         public static class RecordDefault extends FieldDefault> {
           private RecordDefault(FieldBuilder field) {
             super(field);
           }
      -    
      +
           /** Completes this field with the default value provided, cannot be null **/
           public final FieldAssembler recordDefault(GenericRecord defaultVal) {
             return super.usingDefault(defaultVal);
           }
      -    
      +
           @Override
           final RecordDefault self() {
             return this;
           }
         }
      -  
      +
         public final static class GenericDefault {
           private final FieldBuilder field;
           private final Schema schema;
      @@ -2411,37 +2411,37 @@ private GenericDefault(FieldBuilder field, Schema schema) {
             this.field = field;
             this.schema = schema;
           }
      -    
      +
           /** Do not use a default value for this field. **/
           public FieldAssembler noDefault() {
             return field.completeField(schema);
           }
      -    
      +
           /** Completes this field with the default value provided.
            * The value must conform to the schema of the field. **/
           public FieldAssembler withDefault(Object defaultVal) {
             return field.completeField(schema, defaultVal);
           }
         }
      -  
      -  /** 
      +
      +  /**
          * Completion is for internal builder use, all subclasses are private.
      -   * 
      +   *
          * Completion is an object that takes a Schema and returns some result.
          */
         private abstract static class Completion {
           abstract R complete(Schema schema);
         }
      -  
      +
         private static class SchemaCompletion extends Completion {
           @Override
           protected Schema complete(Schema schema) {
             return schema;
           }
         }
      -  
      +
         private static final Schema NULL_SCHEMA = Schema.create(Schema.Type.NULL);
      -  
      +
         private static class NullableCompletion extends Completion {
           private final Completion context;
           private NullableCompletion(Completion context) {
      @@ -2454,7 +2454,7 @@ protected R complete(Schema schema) {
             return context.complete(nullable);
           }
         }
      -  
      +
         private static class OptionalCompletion extends Completion> {
           private final FieldBuilder bldr;
           public OptionalCompletion(FieldBuilder bldr) {
      @@ -2467,11 +2467,11 @@ protected FieldAssembler complete(Schema schema) {
             return bldr.completeField(optional, (Object)null);
           }
         }
      -  
      +
         private abstract static class CompletionWrapper {
           abstract  Completion wrap(Completion completion);
         }
      -  
      +
         private static final class NullableCompletionWrapper extends CompletionWrapper {
           @Override
            Completion wrap(Completion completion) {
      @@ -2539,7 +2539,7 @@ protected UnionAccumulator complete(Schema schema) {
             return new UnionAccumulator(context, names, updated);
           }
         }
      -  
      +
         /** Accumulates all of the types in a union.  Add an additional type with
          * {@link #and()}.  Complete the union with {@link #endUnion()}
          */
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/SchemaValidationStrategy.java b/lang/java/avro/src/main/java/org/apache/avro/SchemaValidationStrategy.java
      index dc1c9cc0e85..8d73375995a 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/SchemaValidationStrategy.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/SchemaValidationStrategy.java
      @@ -29,7 +29,7 @@ public interface SchemaValidationStrategy {
       
         /**
          * Validates that one schema is compatible with another.
      -   * 
      +   *
          * @throws SchemaValidationException if the schemas are not compatible.
          */
         void validate(Schema toValidate, Schema existing)
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/SchemaValidator.java b/lang/java/avro/src/main/java/org/apache/avro/SchemaValidator.java
      index 197c5c09488..af85baca179 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/SchemaValidator.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/SchemaValidator.java
      @@ -36,7 +36,7 @@ public interface SchemaValidator {
          * chronological order. This allows some validators to identify which schemas
          * are the most "recent" in order to validate only against the mosst recent
          * schema(s).
      -   * 
      +   *
          * @param toValidate The schema to validate
          * @param existing The schemas to validate against, in order from most recent to latest if applicable
          * @throws SchemaValidationException if the schema fails to validate.
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/SchemaValidatorBuilder.java b/lang/java/avro/src/main/java/org/apache/avro/SchemaValidatorBuilder.java
      index e1563d29afa..5875435875a 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/SchemaValidatorBuilder.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/SchemaValidatorBuilder.java
      @@ -57,17 +57,17 @@ public SchemaValidatorBuilder mutualReadStrategy() {
           this.strategy = new ValidateMutualRead();
           return this;
         }
      -  
      +
         public SchemaValidator validateLatest() {
           valid();
           return new ValidateLatest(strategy);
         }
      -  
      +
         public SchemaValidator validateAll() {
           valid();
           return new ValidateAll(strategy);
         }
      -  
      +
         private void valid() {
           if(null == strategy) {
             throw new AvroRuntimeException("SchemaValidationStrategy not specified in builder");
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/UnresolvedUnionException.java b/lang/java/avro/src/main/java/org/apache/avro/UnresolvedUnionException.java
      index ed66acaa0f2..e875baf9cb6 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/UnresolvedUnionException.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/UnresolvedUnionException.java
      @@ -22,7 +22,7 @@
       public class UnresolvedUnionException extends AvroRuntimeException {
         private Object unresolvedDatum;
         private Schema unionSchema;
      -  
      +
         public UnresolvedUnionException(Schema unionSchema, Object unresolvedDatum) {
           super("Not in union "+unionSchema+": "+unresolvedDatum);
           this.unionSchema = unionSchema;
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/ValidateCanBeRead.java b/lang/java/avro/src/main/java/org/apache/avro/ValidateCanBeRead.java
      index 60d4b04c54b..fed5a10da8f 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/ValidateCanBeRead.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/ValidateCanBeRead.java
      @@ -22,14 +22,14 @@
        * A {@link SchemaValidationStrategy} that checks that the data written with the
        * {@link Schema} to validate can be read by the existing schema according to
        * the default Avro schema resolution rules.
      - * 
      + *
        */
       class ValidateCanBeRead implements SchemaValidationStrategy {
       
         /**
          * Validate that data written with first schema provided can be read using the
          * second schema, according to the default Avro schema resolution rules.
      -   * 
      +   *
          * @throws SchemaValidationException
          *           if the second schema cannot read data written by the first.
          */
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/ValidateCanRead.java b/lang/java/avro/src/main/java/org/apache/avro/ValidateCanRead.java
      index bbf0c1ea3fc..7384eca4353 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/ValidateCanRead.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/ValidateCanRead.java
      @@ -22,7 +22,7 @@
        * A {@link SchemaValidationStrategy} that checks that the {@link Schema} to
        * validate can read the existing schema according to the default Avro schema
        * resolution rules.
      - * 
      + *
        */
       class ValidateCanRead implements SchemaValidationStrategy {
       
      @@ -30,7 +30,7 @@ class ValidateCanRead implements SchemaValidationStrategy {
          * Validate that the first schema provided can be used to read data written
          * with the second schema, according to the default Avro schema resolution
          * rules.
      -   * 
      +   *
          * @throws SchemaValidationException
          *           if the first schema cannot read data written by the second.
          */
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/ValidateMutualRead.java b/lang/java/avro/src/main/java/org/apache/avro/ValidateMutualRead.java
      index 5f8861edeae..e142b4184a0 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/ValidateMutualRead.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/ValidateMutualRead.java
      @@ -27,14 +27,14 @@
        * A {@link SchemaValidationStrategy} that checks that the {@link Schema} to
        * validate and the existing schema can mutually read each other according to
        * the default Avro schema resolution rules.
      - * 
      + *
        */
       class ValidateMutualRead implements SchemaValidationStrategy {
       
         /**
          * Validate that the schemas provided can mutually read data written by each
          * other according to the default Avro schema resolution rules.
      -   * 
      +   *
          * @throws SchemaValidationException if the schemas are not mutually compatible.
          */
         @Override
      @@ -47,7 +47,7 @@ public void validate(Schema toValidate, Schema existing)
         /**
          * Validates that data written with one schema can be read using another,
          * based on the default Avro schema resolution rules.
      -   * 
      +   *
          * @param writtenWith
          *          The "writer's" schema, representing data to be read.
          * @param readUsing
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/data/ErrorBuilder.java b/lang/java/avro/src/main/java/org/apache/avro/data/ErrorBuilder.java
      index b55cfd02c91..e682acdf155 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/data/ErrorBuilder.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/data/ErrorBuilder.java
      @@ -19,28 +19,28 @@
       
       /** Interface for error builders */
       public interface ErrorBuilder extends RecordBuilder {
      -  
      +
         /** Gets the value */
         Object getValue();
      -  
      +
         /** Sets the value */
         ErrorBuilder setValue(Object value);
      -  
      +
         /** Checks whether the value has been set */
         boolean hasValue();
      -  
      +
         /** Clears the value */
         ErrorBuilder clearValue();
      -  
      +
         /** Gets the error cause */
         Throwable getCause();
      -  
      +
         /** Sets the error cause */
         ErrorBuilder setCause(Throwable cause);
      -  
      +
         /** Checks whether the cause has been set */
         boolean hasCause();
      -  
      +
         /** Clears the cause */
         ErrorBuilder clearCause();
       
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/data/Json.java b/lang/java/avro/src/main/java/org/apache/avro/data/Json.java
      index 73a57c21d5a..daa848223f4 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/data/Json.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/data/Json.java
      @@ -73,7 +73,7 @@ public static class Writer implements DatumWriter {
             if (!SCHEMA.equals(schema))
               throw new RuntimeException("Not the Json schema: "+schema);
           }
      -    
      +
           @Override
           public void write(JsonNode datum, Encoder out) throws IOException {
             Json.write(datum, out);
      @@ -173,7 +173,7 @@ public static String toString(Object datum) {
       
         /** Note: this enum must be kept aligned with the union in Json.avsc. */
         private enum JsonType { LONG, DOUBLE, STRING, BOOLEAN, NULL, ARRAY, OBJECT }
      -  
      +
         /**
          * Write Json data as Avro data.
          * @deprecated internal method
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilder.java b/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilder.java
      index 8c7a660c22a..a01592cbf2b 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilder.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilder.java
      @@ -22,7 +22,7 @@
       public interface RecordBuilder {
         /**
          * Constructs a new instance using the values set in the RecordBuilder.
      -   * If a particular value was not set and the schema defines a default 
      +   * If a particular value was not set and the schema defines a default
          * value, the default value will be used.
          * @return a new instance using values set in the RecordBuilder.
          */
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilderBase.java b/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilderBase.java
      index ca73b70730e..8e34a36e0bc 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilderBase.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/data/RecordBuilderBase.java
      @@ -28,14 +28,14 @@
       import org.apache.avro.generic.IndexedRecord;
       
       /** Abstract base class for RecordBuilder implementations.  Not thread-safe. */
      -public abstract class RecordBuilderBase 
      +public abstract class RecordBuilderBase
         implements RecordBuilder {
         private static final Field[] EMPTY_FIELDS = new Field[0];
         private final Schema schema;
         private final Field[] fields;
         private final boolean[] fieldSetFlags;
         private final GenericData data;
      -  
      +
         protected final Schema schema() { return schema; }
         protected final Field[] fields() { return fields; }
         protected final boolean[] fieldSetFlags() { return fieldSetFlags; }
      @@ -51,7 +51,7 @@ protected RecordBuilderBase(Schema schema, GenericData data) {
           fields = (Field[]) schema.getFields().toArray(EMPTY_FIELDS);
           fieldSetFlags = new boolean[fields.length];
         }
      -  
      +
         /**
          * RecordBuilderBase copy constructor.
          * Makes a deep copy of the values in the other builder.
      @@ -65,17 +65,17 @@ protected RecordBuilderBase(RecordBuilderBase other, GenericData data) {
           System.arraycopy(
               other.fieldSetFlags, 0, fieldSetFlags, 0, fieldSetFlags.length);
         }
      -  
      +
         /**
      -   * Validates that a particular value for a given field is valid according to 
      +   * Validates that a particular value for a given field is valid according to
          * the following algorithm:
      -   * 1. If the value is not null, or the field type is null, or the field type 
      +   * 1. If the value is not null, or the field type is null, or the field type
          * is a union which accepts nulls, returns.
          * 2. Else, if the field has a default value, returns.
      -   * 3. Otherwise throws AvroRuntimeException. 
      +   * 3. Otherwise throws AvroRuntimeException.
          * @param field the field to validate.
          * @param value the value to validate.
      -   * @throws NullPointerException if value is null and the given field does 
      +   * @throws NullPointerException if value is null and the given field does
          * not accept null values.
          */
         protected void validate(Field field, Object value) {
      @@ -92,7 +92,7 @@ else if (field.defaultValue() != null) {
         }
       
         /**
      -   * Tests whether a value is valid for a specified field. 
      +   * Tests whether a value is valid for a specified field.
          * @param f the field for which to test the value.
          * @param value the value to test.
          * @return true if the value is valid for the given field; false otherwise.
      @@ -101,10 +101,10 @@ protected static boolean isValidValue(Field f, Object value) {
           if (value != null) {
             return true;
           }
      -    
      +
           Schema schema = f.schema();
           Type type = schema.getType();
      -    
      +
           // If the type is null, any value is valid
           if (type == Type.NULL) {
             return true;
      @@ -118,20 +118,20 @@ protected static boolean isValidValue(Field f, Object value) {
               }
             }
           }
      -    
      +
           // The value is null but the type does not allow nulls
           return false;
         }
      -  
      +
         /**
          * Gets the default value of the given field, if any.
          * @param field the field whose default value should be retrieved.
      -   * @return the default value associated with the given field, 
      +   * @return the default value associated with the given field,
          * or null if none is specified in the schema.
      -   * @throws IOException 
      +   * @throws IOException
          */
         @SuppressWarnings({ "rawtypes", "unchecked" })
      -  protected Object defaultValue(Field field) throws IOException {    
      +  protected Object defaultValue(Field field) throws IOException {
           return data.deepCopy(field.schema(), data.getDefaultValue(field));
         }
       
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/BZip2Codec.java b/lang/java/avro/src/main/java/org/apache/avro/file/BZip2Codec.java
      index 09cf623e977..8dccfc33ffd 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/file/BZip2Codec.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/file/BZip2Codec.java
      @@ -69,11 +69,11 @@ public ByteBuffer decompress(ByteBuffer compressedData) throws IOException {
             byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
       
             int readCount = -1;
      -      
      +
             while ( (readCount = inputStream.read(buffer, compressedData.position(), buffer.length))> 0) {
               baos.write(buffer, 0, readCount);
             }
      -      
      +
             ByteBuffer result = ByteBuffer.wrap(baos.toByteArray());
             return result;
           } finally {
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/Codec.java b/lang/java/avro/src/main/java/org/apache/avro/file/Codec.java
      index af5e0137a2c..c27b4b7e735 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/file/Codec.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/file/Codec.java
      @@ -20,7 +20,7 @@
       import java.io.IOException;
       import java.nio.ByteBuffer;
       
      -/** 
      +/**
        * Interface for Avro-supported compression codecs for data files.
        */
       public abstract class Codec {
      @@ -30,14 +30,14 @@ public abstract class Codec {
         public abstract ByteBuffer compress(ByteBuffer uncompressedData) throws IOException;
         /** Decompress the data  */
         public abstract ByteBuffer decompress(ByteBuffer compressedData) throws IOException;
      -  /** 
      +  /**
          * Codecs must implement an equals() method.  Two codecs, A and B are equal
          * if: the result of A and B decompressing content compressed by A is the same
          * AND the retult of A and B decompressing content compressed by B is the same
          **/
         @Override
         public abstract boolean equals(Object other);
      -  /** 
      +  /**
          * Codecs must implement a hashCode() method that is consistent with equals().*/
         @Override
         public abstract int hashCode();
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/CodecFactory.java b/lang/java/avro/src/main/java/org/apache/avro/file/CodecFactory.java
      index 6f25ea25dc2..d178e134daf 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/file/CodecFactory.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/file/CodecFactory.java
      @@ -67,11 +67,11 @@ public static CodecFactory bzip2Codec() {
       
         /** Creates internal Codec. */
         protected abstract Codec createInstance();
      -  
      -  /** Mapping of string names (stored as metas) and codecs. 
      +
      +  /** Mapping of string names (stored as metas) and codecs.
          * Note that currently options (like compression level)
          * are not recoverable. */
      -  private static final Map REGISTERED = 
      +  private static final Map REGISTERED =
           new HashMap();
       
         public static final int DEFAULT_DEFLATE_LEVEL = Deflater.DEFAULT_COMPRESSION;
      @@ -103,7 +103,7 @@ public static CodecFactory fromString(String s) {
           }
           return o;
         }
      -  
      +
       
       
         /** Adds a new codec implementation.  If name already had
      @@ -111,11 +111,11 @@ public static CodecFactory fromString(String s) {
         public static CodecFactory addCodec(String name, CodecFactory c) {
           return REGISTERED.put(name, c);
         }
      -  
      +
         @Override
         public String toString() {
           Codec instance = this.createInstance();
           return instance.toString();
         }
      -  
      +
       }
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileConstants.java b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileConstants.java
      index 4061962b2e0..265ac392e2e 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileConstants.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileConstants.java
      @@ -30,7 +30,7 @@ private DataFileConstants() {}                  // no public ctor
         };
         public static final long FOOTER_BLOCK = -1;
         public static final int SYNC_SIZE = 16;
      -  public static final int DEFAULT_SYNC_INTERVAL = 4000*SYNC_SIZE; 
      +  public static final int DEFAULT_SYNC_INTERVAL = 4000*SYNC_SIZE;
       
         public static final String SCHEMA = "avro.schema";
         public static final String CODEC = "avro.codec";
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
      index be12574dff0..0d5e5c1b725 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader.java
      @@ -59,7 +59,7 @@ public static  FileReader openReader(SeekableInput in,
             return new DataFileReader(in, reader);
           if (Arrays.equals(DataFileReader12.MAGIC, magic)) // 1.2 format
             return new DataFileReader12(in, reader);
      -    
      +
           throw new IOException("Not an Avro data file");
         }
       
      @@ -166,7 +166,7 @@ public long previousSync() {
           return blockStart;
         }
       
      -  /** Return true if past the next synchronization point after a position. */ 
      +  /** Return true if past the next synchronization point after a position. */
         @Override
         public boolean pastSync(long position) throws IOException {
           return ((blockStart >= position+SYNC_SIZE)||(blockStart >= sin.length()));
      @@ -174,7 +174,7 @@ public boolean pastSync(long position) throws IOException {
       
         @Override public long tell() throws IOException { return sin.tell(); }
       
      -  static class SeekableInputStream extends InputStream 
      +  static class SeekableInputStream extends InputStream
         implements SeekableInput {
           private final byte[] oneByte = new byte[1];
           private SeekableInput in;
      @@ -182,7 +182,7 @@ static class SeekableInputStream extends InputStream
           SeekableInputStream(SeekableInput in) throws IOException {
               this.in = in;
             }
      -    
      +
           @Override
           public void seek(long p) throws IOException {
             if (p < 0)
      @@ -204,7 +204,7 @@ public long length() throws IOException {
           public int read(byte[] b) throws IOException {
             return in.read(b, 0, b.length);
             }
      -    
      +
           @Override
           public int read(byte[] b, int off, int len) throws IOException {
             return in.read(b, off, len);
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader12.java b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader12.java
      index 0194de0bf98..54176dfea32 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader12.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileReader12.java
      @@ -39,7 +39,7 @@ public class DataFileReader12 implements FileReader, Closeable {
         };
         private static final long FOOTER_BLOCK = -1;
         private static final int SYNC_SIZE = 16;
      -  private static final int SYNC_INTERVAL = 1000*SYNC_SIZE; 
      +  private static final int SYNC_INTERVAL = 1000*SYNC_SIZE;
       
         private static final String SCHEMA = "schema";
         private static final String SYNC = "sync";
      @@ -160,8 +160,8 @@ public synchronized D next(D reuse) throws IOException {
             skipSync();                                 // skip a sync
       
             blockCount = vin.readLong();                // read blockCount
      -         
      -      if (blockCount == FOOTER_BLOCK) { 
      +
      +      if (blockCount == FOOTER_BLOCK) {
               seek(vin.readLong()+in.tell());           // skip a footer
             }
           }
      @@ -208,7 +208,7 @@ public synchronized void sync(long position) throws IOException {
           seek(in.length());
         }
       
      -  /** Return true if past the next synchronization point after a position. */ 
      +  /** Return true if past the next synchronization point after a position. */
         @Override
         public boolean pastSync(long position) throws IOException {
           return ((blockStart >= position+SYNC_SIZE)||(blockStart >= in.length()));
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java
      index 458a7df587d..bfc53a02d02 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileStream.java
      @@ -74,8 +74,8 @@ private Header() {}
         byte[] syncBuffer = new byte[DataFileConstants.SYNC_SIZE];
         private Codec codec;
       
      -  /** Construct a reader for an input stream.  For file-based input, use 
      -   * {@link DataFileReader}.  This will buffer, wrapping with a 
      +  /** Construct a reader for an input stream.  For file-based input, use
      +   * {@link DataFileReader}.  This will buffer, wrapping with a
          * {@link java.io.BufferedInputStream}
          * is not necessary. */
         public DataFileStream(InputStream in, DatumReader reader)
      @@ -90,7 +90,7 @@ public DataFileStream(InputStream in, DatumReader reader)
         protected DataFileStream(DatumReader reader) throws IOException {
           this.reader = reader;
         }
      -  
      +
         /** Initialize the stream by reading from its head. */
         void initialize(InputStream in) throws IOException {
           this.header = new Header();
      @@ -118,7 +118,7 @@ void initialize(InputStream in) throws IOException {
             } while ((l = vin.mapNext()) != 0);
           }
           vin.readFixed(header.sync);                          // read sync
      -    
      +
           // finalize the header
           header.metaKeyList = Collections.unmodifiableList(header.metaKeyList);
           header.schema = Schema.parse(getMetaString(DataFileConstants.SCHEMA),false);
      @@ -319,22 +319,22 @@ private DataBlock(long numEntries, int blockSize) {
             this.numEntries = numEntries;
             this.blockSize = blockSize;
           }
      -    
      +
           DataBlock(ByteBuffer block, long numEntries) {
             this.data = block.array();
             this.blockSize = block.remaining();
             this.offset = block.arrayOffset() + block.position();
             this.numEntries = numEntries;
           }
      -    
      +
           byte[] getData() {
             return data;
           }
      -    
      +
           long getNumEntries() {
             return numEntries;
           }
      -    
      +
           int getBlockSize() {
             return blockSize;
           }
      @@ -346,23 +346,23 @@ boolean isFlushOnWrite() {
           void setFlushOnWrite(boolean flushOnWrite) {
             this.flushOnWrite = flushOnWrite;
           }
      -    
      +
           ByteBuffer getAsByteBuffer() {
             return ByteBuffer.wrap(data, offset, blockSize);
           }
      -    
      +
           void decompressUsing(Codec c) throws IOException {
             ByteBuffer result = c.decompress(getAsByteBuffer());
             data = result.array();
             blockSize = result.remaining();
           }
      -    
      +
           void compressUsing(Codec c) throws IOException {
             ByteBuffer result = c.compress(getAsByteBuffer());
             data = result.array();
             blockSize = result.remaining();
           }
      -    
      +
           void writeBlockTo(BinaryEncoder e, byte[] sync) throws IOException {
             e.writeLong(this.numEntries);
             e.writeLong(this.blockSize);
      @@ -372,7 +372,7 @@ void writeBlockTo(BinaryEncoder e, byte[] sync) throws IOException {
               e.flush();
             }
           }
      -    
      +
         }
       }
       
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileWriter.java b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileWriter.java
      index 52fb8953f44..fe916dcf42f 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/file/DataFileWriter.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/file/DataFileWriter.java
      @@ -77,16 +77,16 @@ public class DataFileWriter implements Closeable, Flushable {
         public DataFileWriter(DatumWriter dout) {
           this.dout = dout;
         }
      -  
      +
         private void assertOpen() {
           if (!isOpen) throw new AvroRuntimeException("not open");
         }
         private void assertNotOpen() {
           if (isOpen) throw new AvroRuntimeException("already open");
         }
      -  
      -  /** 
      -   * Configures this writer to use the given codec. 
      +
      +  /**
      +   * Configures this writer to use the given codec.
          * May not be reset after writes have begun.
          */
         public DataFileWriter setCodec(CodecFactory c) {
      @@ -97,7 +97,7 @@ public DataFileWriter setCodec(CodecFactory c) {
         }
       
         /**
      -   * Set the synchronization interval for this file, in bytes. 
      +   * Set the synchronization interval for this file, in bytes.
          * Valid values range from 32 to 2^30
          * Suggested values are between 2K and 2M
          *
      @@ -108,12 +108,12 @@ public DataFileWriter setCodec(CodecFactory c) {
          * called with param set to false, then the block may not be flushed to the
          * stream after the sync marker is written. In this case,
          * the {@linkplain #flush()} must be called to flush the stream.
      -   * 
      +   *
          * Invalid values throw IllegalArgumentException
      -   * 
      -   * @param syncInterval 
      +   *
      +   * @param syncInterval
          *   the approximate number of uncompressed bytes to write in each block
      -   * @return 
      +   * @return
          *   this DataFileWriter
          */
         public DataFileWriter setSyncInterval(int syncInterval) {
      @@ -251,7 +251,7 @@ private DataFileWriter setMetaInternal(String key, byte[] value) {
           meta.put(key, value);
           return this;
         }
      -  
      +
         private DataFileWriter setMetaInternal(String key, String value) {
           try {
             return setMetaInternal(key, value.getBytes("UTF-8"));
      @@ -267,7 +267,7 @@ public DataFileWriter setMeta(String key, byte[] value) {
           }
           return setMetaInternal(key, value);
         }
      -  
      +
         public static boolean isReservedMeta(String key) {
           return key.startsWith("avro.");
         }
      @@ -310,7 +310,7 @@ public void append(D datum) throws IOException {
           blockCount++;
           writeIfBlockFull();
         }
      -  
      +
         // if there is an error encoding, flush the encoder and then
         // reset the buffer position to contain size bytes, discarding the rest.
         // Otherwise the file will be corrupt with a partial record.
      @@ -330,7 +330,7 @@ public void appendEncoded(ByteBuffer datum) throws IOException {
           blockCount++;
           writeIfBlockFull();
         }
      -  
      +
         private int bufferInUse() {
           return (buffer.size() + bufOut.bytesBuffered());
         }
      @@ -384,7 +384,7 @@ public void appendAllFrom(DataFileStream otherFile, boolean recompress) throw
             }
           }
         }
      -  
      +
         private void writeBlock() throws IOException {
           if (blockCount > 0) {
             bufOut.flush();
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/DeflateCodec.java b/lang/java/avro/src/main/java/org/apache/avro/file/DeflateCodec.java
      index 2a0c8c5045f..f8f6ac42a5d 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/file/DeflateCodec.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/file/DeflateCodec.java
      @@ -26,8 +26,8 @@
       import java.util.zip.Inflater;
       import java.util.zip.InflaterOutputStream;
       
      -/** 
      - * Implements DEFLATE (RFC1951) compression and decompression. 
      +/**
      + * Implements DEFLATE (RFC1951) compression and decompression.
        *
        * Note that there is a distinction between RFC1951 (deflate)
        * and RFC1950 (zlib).  zlib adds an extra 2-byte header
      @@ -37,7 +37,7 @@
        * RFC1951.
        */
       class DeflateCodec extends Codec {
      -  
      +
         static class Option extends CodecFactory {
           private int compressionLevel;
       
      @@ -55,7 +55,7 @@ protected Codec createInstance() {
         private Deflater deflater;
         private Inflater inflater;
         //currently only do 'nowrap' -- RFC 1951, not zlib
      -  private boolean nowrap = true; 
      +  private boolean nowrap = true;
         private int compressionLevel;
       
         public DeflateCodec(int compressionLevel) {
      @@ -84,7 +84,7 @@ public ByteBuffer decompress(ByteBuffer data) throws IOException {
           ByteBuffer result = ByteBuffer.wrap(baos.toByteArray());
           return result;
         }
      -  
      +
         private void writeAndClose(ByteBuffer data, OutputStream to) throws IOException {
           byte[] input = data.array();
           int offset = data.arrayOffset() + data.position();
      @@ -95,7 +95,7 @@ private void writeAndClose(ByteBuffer data, OutputStream to) throws IOException
             to.close();
           }
         }
      -  
      +
         // get and initialize the inflater for use.
         private Inflater getInflater() {
           if (null == inflater) {
      @@ -113,7 +113,7 @@ private Deflater getDeflater() {
           deflater.reset();
           return deflater;
         }
      -  
      +
         // get and initialize the output buffer for use.
         private ByteArrayOutputStream getOutputBuffer(int suggestedLength) {
           if (null == outputBuffer) {
      @@ -122,7 +122,7 @@ private ByteArrayOutputStream getOutputBuffer(int suggestedLength) {
           outputBuffer.reset();
           return outputBuffer;
         }
      -  
      +
         @Override
         public int hashCode() {
           return nowrap ? 0 : 1;
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/FileReader.java b/lang/java/avro/src/main/java/org/apache/avro/file/FileReader.java
      index 19de11c92a3..68c0102ef40 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/file/FileReader.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/file/FileReader.java
      @@ -40,7 +40,7 @@ public interface FileReader extends Iterator, Iterable, Closeable {
          * #next()}. */
         void sync(long position) throws IOException;
       
      -  /** Return true if past the next synchronization point after a position. */ 
      +  /** Return true if past the next synchronization point after a position. */
         boolean pastSync(long position) throws IOException;
       
         /** Return the current position in the input. */
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/NullCodec.java b/lang/java/avro/src/main/java/org/apache/avro/file/NullCodec.java
      index fd82d9b2e85..e95f699e754 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/file/NullCodec.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/file/NullCodec.java
      @@ -22,7 +22,7 @@
       
       /** Implements "null" (pass through) codec. */
       final class NullCodec extends Codec {
      -  
      +
         private static final NullCodec INSTANCE = new NullCodec();
       
         static class Option extends CodecFactory {
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/file/SnappyCodec.java b/lang/java/avro/src/main/java/org/apache/avro/file/SnappyCodec.java
      index 078705077f6..1a5d252692f 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/file/SnappyCodec.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/file/SnappyCodec.java
      @@ -60,15 +60,15 @@ public ByteBuffer decompress(ByteBuffer in) throws IOException {
           int size = Snappy.uncompress(in.array(),in.position(),in.remaining()-4,
                                        out.array(), 0);
           out.limit(size);
      -    
      +
           crc32.reset();
           crc32.update(out.array(), 0, size);
           if (in.getInt(in.limit()-4) != (int)crc32.getValue())
             throw new IOException("Checksum failure");
      -    
      +
           return out;
         }
      -  
      +
         @Override public int hashCode() { return getName().hashCode(); }
       
         @Override
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericArray.java b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericArray.java
      index 40b7e0f482b..e69e4eff0a4 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericArray.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericArray.java
      @@ -26,7 +26,7 @@ public interface GenericArray extends List, GenericContainer {
          * store an element, if any.  This permits reuse of arrays and their elements
          * without allocating new objects. */
         T peek();
      -  
      +
         /** Reverses the order of the elements in this array. */
         void reverse();
       }
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java
      index 2b01de408c0..09f4c5a0120 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java
      @@ -60,7 +60,7 @@
       public class GenericData {
       
         private static final GenericData INSTANCE = new GenericData();
      -  
      +
         /** Used to specify the Java type for a string schema. */
         public enum StringType { CharSequence, String, Utf8 };
       
      @@ -322,12 +322,12 @@ public int compareTo(GenericArray that) {
           public void reverse() {
             int left = 0;
             int right = elements.length - 1;
      -      
      +
             while (left < right) {
               Object tmp = elements[left];
               elements[left] = elements[right];
               elements[right] = tmp;
      -        
      +
               left++;
               right--;
             }
      @@ -526,7 +526,7 @@ protected void toString(Object datum, StringBuilder buffer) {
               toString(element, buffer);
               if (i++ < last)
                 buffer.append(", ");
      -      }        
      +      }
             buffer.append("]");
           } else if (isMap(datum)) {
             buffer.append("{");
      @@ -561,7 +561,7 @@ protected void toString(Object datum, StringBuilder buffer) {
             buffer.append(datum);
           }
         }
      -  
      +
         /* Adapted from http://code.google.com/p/json-simple */
         private void writeEscapedString(CharSequence string, StringBuilder builder) {
           for(int i = 0; i < string.length(); i++){
      @@ -658,7 +658,7 @@ public Schema induce(Object datum) {
         public void setField(Object record, String name, int position, Object o) {
           ((IndexedRecord)record).put(position, o);
         }
      -  
      +
         /** Called by {@link GenericDatumReader#readRecord} to retrieve a record
          * field value from a reused instance.  The default implementation is for
          * {@link IndexedRecord}.*/
      @@ -675,7 +675,7 @@ public Object getField(Object record, String name, int position) {
         protected void setField(Object r, String n, int p, Object o, Object state) {
           setField(r, n, p, o);
         }
      -  
      +
         /** Version of {@link #getField} that has state. */
         protected Object getField(Object record, String name, int pos, Object state) {
           return getField(record, name, pos);
      @@ -798,7 +798,7 @@ protected Schema getRecordSchema(Object record) {
         protected boolean isEnum(Object datum) {
           return datum instanceof GenericEnumSymbol;
         }
      -  
      +
         /** Called to obtain the schema of a enum.  By default calls
          * {GenericContainer#getSchema().  May be overridden for alternate enum
          * representations. */
      @@ -810,7 +810,7 @@ protected Schema getEnumSchema(Object enu) {
         protected boolean isMap(Object datum) {
           return datum instanceof Map;
         }
      -  
      +
         /** Called by the default implementation of {@link #instanceOf}.*/
         protected boolean isFixed(Object datum) {
           return datum instanceof GenericFixed;
      @@ -867,7 +867,7 @@ protected boolean isDouble(Object datum) {
         protected boolean isBoolean(Object datum) {
           return datum instanceof Boolean;
         }
      -   
      +
       
         /** Compute a hash code according to a schema, consistent with {@link
          * #compare(Object,Object,Schema)}. */
      @@ -974,11 +974,11 @@ protected int compare(Object o1, Object o2, Schema s, boolean equals) {
         /**
          * Gets the default value of the given field, if any.
          * @param field the field whose default value should be retrieved.
      -   * @return the default value associated with the given field, 
      +   * @return the default value associated with the given field,
          * or null if none is specified in the schema.
          */
         @SuppressWarnings({ "rawtypes", "unchecked" })
      -  public Object getDefaultValue(Field field) {    
      +  public Object getDefaultValue(Field field) {
           JsonNode json = field.defaultValue();
           if (json == null)
             throw new AvroRuntimeException("Field " + field
      @@ -989,10 +989,10 @@ public Object getDefaultValue(Field field) {
                       && field.schema().getTypes().get(0).getType() == Type.NULL))) {
             return null;
           }
      -    
      +
           // Check the cache
           Object defaultValue = defaultValueCache.get(field);
      -    
      +
           // If not cached, get the default Java value by encoding the default JSON
           // value and then decoding it:
           if (defaultValue == null)
      @@ -1060,7 +1060,7 @@ public  T deepCopy(Schema schema, T value) {
               return value; // immutable
             case MAP:
               Map mapValue = (Map) value;
      -        Map mapCopy = 
      +        Map mapCopy =
                 new HashMap(mapValue.size());
               for (Map.Entry entry : mapValue.entrySet()) {
                 mapCopy.put((CharSequence)(deepCopy(STRINGS, entry.getKey())),
      @@ -1086,11 +1086,11 @@ public  T deepCopy(Schema schema, T value) {
               if (value instanceof String) {
                 return (T)value;
               }
      -        
      -        // Some CharSequence subclasses are mutable, so we still need to make 
      +
      +        // Some CharSequence subclasses are mutable, so we still need to make
               // a copy
               else if (value instanceof Utf8) {
      -          // Utf8 copy constructor is more efficient than converting 
      +          // Utf8 copy constructor is more efficient than converting
                 // to string and then back to Utf8
                 return (T)new Utf8((Utf8)value);
               }
      @@ -1104,7 +1104,7 @@ else if (value instanceof Utf8) {
                   value + "\"");
           }
         }
      -  
      +
         /** Called to create an fixed value. May be overridden for alternate fixed
          * representations.  By default, returns {@link GenericFixed}. */
         public Object createFixed(Object old, Schema schema) {
      @@ -1113,7 +1113,7 @@ public Object createFixed(Object old, Schema schema) {
             return old;
           return new GenericData.Fixed(schema);
         }
      -  
      +
         /** Called to create an fixed value. May be overridden for alternate fixed
          * representations.  By default, returns {@link GenericFixed}. */
         public Object createFixed(Object old, byte[] bytes, Schema schema) {
      @@ -1121,7 +1121,7 @@ public Object createFixed(Object old, byte[] bytes, Schema schema) {
           System.arraycopy(bytes, 0, fixed.bytes(), 0, schema.getFixedSize());
           return fixed;
         }
      -  
      +
         /** Called to create an enum value. May be overridden for alternate enum
          * representations.  By default, returns a GenericEnumSymbol. */
         public Object createEnum(String symbol, Schema schema) {
      @@ -1144,5 +1144,5 @@ public Object newRecord(Object old, Schema schema) {
           }
           return new GenericData.Record(schema);
         }
      -  
      +
       }
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java
      index 9417b2266b9..6133d6b33b5 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java
      @@ -43,7 +43,7 @@ public class GenericDatumReader implements DatumReader {
         private final GenericData data;
         private Schema actual;
         private Schema expected;
      -  
      +
         private ResolvingDecoder creatorResolver = null;
         private final Thread creator;
       
      @@ -115,7 +115,7 @@ protected final ResolvingDecoder getResolver(Schema actual, Schema expected)
           ResolvingDecoder resolver;
           if (currThread == creator && creatorResolver != null) {
             return creatorResolver;
      -    } 
      +    }
       
           Map cache = RESOLVER_CACHE.get().get(actual);
           if (cache == null) {
      @@ -128,7 +128,7 @@ protected final ResolvingDecoder getResolver(Schema actual, Schema expected)
                 Schema.applyAliases(actual, expected), expected, null);
             cache.put(expected, resolver);
           }
      -    
      +
           if (currThread == creator){
             creatorResolver = resolver;
           }
      @@ -145,7 +145,7 @@ public D read(D reuse, Decoder in) throws IOException {
           resolver.drain();
           return result;
         }
      -  
      +
         /** Called to read data.*/
         protected Object read(Object old, Schema expected,
             ResolvingDecoder in) throws IOException {
      @@ -215,11 +215,11 @@ protected Object convert(Object datum, Schema schema, LogicalType type,
       
         /** Called to read a record instance. May be overridden for alternate record
          * representations.*/
      -  protected Object readRecord(Object old, Schema expected, 
      +  protected Object readRecord(Object old, Schema expected,
             ResolvingDecoder in) throws IOException {
           Object r = data.newRecord(old, expected);
           Object state = data.getRecordState(r, expected);
      -    
      +
           for (Field f : in.readFieldOrder()) {
             int pos = f.pos();
             String name = f.name();
      @@ -232,14 +232,14 @@ protected Object readRecord(Object old, Schema expected,
       
           return r;
         }
      -  
      -  /** Called to read a single field of a record. May be overridden for more 
      +
      +  /** Called to read a single field of a record. May be overridden for more
          * efficient or alternate implementations.*/
         protected void readField(Object r, Field f, Object oldDatum,
           ResolvingDecoder in, Object state) throws IOException {
           data.setField(r, f.name(), f.pos(), read(oldDatum, f.schema(), in), state);
         }
      -  
      +
         /** Called to read an enum value. May be overridden for alternate enum
          * representations.  By default, returns a GenericEnumSymbol. */
         protected Object readEnum(Schema expected, Decoder in) throws IOException {
      @@ -299,7 +299,7 @@ protected Object peekArray(Object array) {
         protected void addToArray(Object array, long pos, Object e) {
           ((Collection) array).add(e);
         }
      -  
      +
         /** Called to read a map instance.  May be overridden for alternate map
          * representations.*/
         protected Object readMap(Object old, Schema expected,
      @@ -341,7 +341,7 @@ protected Object readMapKey(Object old, Schema expected, Decoder in)
         protected void addToMap(Object map, Object key, Object value) {
           ((Map) map).put(key, value);
         }
      -  
      +
         /** Called to read a fixed value. May be overridden for alternate fixed
          * representations.  By default, returns {@link GenericFixed}. */
         protected Object readFixed(Object old, Schema expected, Decoder in)
      @@ -350,11 +350,11 @@ protected Object readFixed(Object old, Schema expected, Decoder in)
           in.readFixed(fixed.bytes(), 0, expected.getFixedSize());
           return fixed;
         }
      -  
      -  /** 
      +
      +  /**
          * Called to create an fixed value. May be overridden for alternate fixed
          * representations.  By default, returns {@link GenericFixed}.
      -   * @deprecated As of Avro 1.6.0 this method has been moved to 
      +   * @deprecated As of Avro 1.6.0 this method has been moved to
          * {@link GenericData#createFixed(Object, Schema)}
          */
         @Deprecated
      @@ -362,17 +362,17 @@ protected Object createFixed(Object old, Schema schema) {
           return data.createFixed(old, schema);
         }
       
      -  /** 
      +  /**
          * Called to create an fixed value. May be overridden for alternate fixed
          * representations.  By default, returns {@link GenericFixed}.
      -   * @deprecated As of Avro 1.6.0 this method has been moved to 
      +   * @deprecated As of Avro 1.6.0 this method has been moved to
          * {@link GenericData#createFixed(Object, byte[], Schema)}
          */
         @Deprecated
         protected Object createFixed(Object old, byte[] bytes, Schema schema) {
           return data.createFixed(old, bytes, schema);
         }
      -  
      +
         /**
          * Called to create new record instances. Subclasses may override to use a
          * different record implementation. The returned instance must conform to the
      @@ -380,7 +380,7 @@ protected Object createFixed(Object old, byte[] bytes, Schema schema) {
          * schema, they should either be removed from the old object, or it should
          * create a new instance that conforms to the schema. By default, this returns
          * a {@link GenericData.Record}.
      -   * @deprecated As of Avro 1.6.0 this method has been moved to 
      +   * @deprecated As of Avro 1.6.0 this method has been moved to
          * {@link GenericData#newRecord(Object, Schema)}
          */
         @Deprecated
      @@ -421,7 +421,7 @@ protected Object readString(Object old, Schema expected,
           if (stringClass == CharSequence.class)
             return readString(old, in);
           return newInstanceFromString(stringClass, in.readString());
      -  }                  
      +  }
       
         /** Called to read strings.  Subclasses may override to use a different
          * string representation.  By default, this calls {@link
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java
      index 7cfa022eea4..63fa025d0aa 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java
      @@ -143,10 +143,10 @@ protected void writeRecord(Schema schema, Object datum, Encoder out)
             writeField(datum, f, out, state);
           }
         }
      -  
      -  /** Called to write a single field of a record. May be overridden for more 
      +
      +  /** Called to write a single field of a record. May be overridden for more
          * efficient or alternate implementations.*/
      -  protected void writeField(Object datum, Field f, Encoder out, Object state) 
      +  protected void writeField(Object datum, Field f, Encoder out, Object state)
             throws IOException {
           Object value = data.getField(datum, f.name(), f.pos(), state);
           try {
      @@ -155,7 +155,7 @@ protected void writeField(Object datum, Field f, Encoder out, Object state)
             throw npe(e, " in field " + f.name());
           }
         }
      -  
      +
         /** Called to write an enum value.  May be overridden for alternate enum
          * representations.*/
         protected void writeEnum(Schema schema, Object datum, Encoder out)
      @@ -164,7 +164,7 @@ protected void writeEnum(Schema schema, Object datum, Encoder out)
             throw new AvroTypeException("Not an enum: "+datum);
           out.writeEnum(schema.getEnumOrdinal(datum.toString()));
         }
      -  
      +
         /** Called to write a array.  May be overridden for alternate array
          * representations.*/
         protected void writeArray(Schema schema, Object datum, Encoder out)
      @@ -205,7 +205,7 @@ protected long getArraySize(Object array) {
         protected Iterator getArrayElements(Object array) {
           return ((Collection) array).iterator();
         }
      -  
      +
         /** Called to write a map.  May be overridden for alternate map
          * representations.*/
         protected void writeMap(Schema schema, Object datum, Encoder out)
      @@ -241,7 +241,7 @@ protected int getMapSize(Object map) {
         protected Iterable> getMapEntries(Object map) {
           return ((Map) map).entrySet();
         }
      -  
      +
         /** Called to write a string.  May be overridden for alternate string
          * representations.*/
         protected void writeString(Schema schema, Object datum, Encoder out)
      @@ -266,7 +266,7 @@ protected void writeFixed(Schema schema, Object datum, Encoder out)
           throws IOException {
           out.writeFixed(((GenericFixed)datum).bytes(), 0, schema.getFixedSize());
         }
      -  
      +
         private void error(Schema schema, Object datum) {
           throw new AvroTypeException("Not a "+schema+": "+datum);
         }
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericRecordBuilder.java b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericRecordBuilder.java
      index 21371045d8b..22a49f5c90f 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericRecordBuilder.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericRecordBuilder.java
      @@ -29,7 +29,7 @@
        * for fields if they are not specified.  */
       public class GenericRecordBuilder extends RecordBuilderBase {
         private final GenericData.Record record;
      -  
      +
         /**
          * Creates a GenericRecordBuilder for building Record instances.
          * @param schema the schema associated with the record class.
      @@ -38,7 +38,7 @@ public GenericRecordBuilder(Schema schema) {
           super(schema, GenericData.get());
           record = new GenericData.Record(schema);
         }
      -  
      +
         /**
          * Creates a GenericRecordBuilder by copying an existing GenericRecordBuilder.
          * @param other the GenericRecordBuilder to copy.
      @@ -47,7 +47,7 @@ public GenericRecordBuilder(GenericRecordBuilder other) {
           super(other, GenericData.get());
           record = new GenericData.Record(other.record, /* deepCopy = */ true);
         }
      -  
      +
         /**
          * Creates a GenericRecordBuilder by copying an existing record instance.
          * @param other the record instance to copy.
      @@ -55,18 +55,18 @@ record = new GenericData.Record(other.record, /* deepCopy = */ true);
         public GenericRecordBuilder(Record other) {
           super(other.getSchema(), GenericData.get());
           record = new GenericData.Record(other, /* deepCopy = */ true);
      -    
      +
           // Set all fields in the RecordBuilder that are set in the record
           for (Field f : schema().getFields()) {
             Object value = other.get(f.pos());
      -      // Only set the value if it is not null, if the schema type is null, 
      +      // Only set the value if it is not null, if the schema type is null,
             // or if the schema type is a union that accepts nulls.
             if (isValidValue(f, value)) {
               set(f, data().deepCopy(f.schema(), value));
             }
           }
         }
      -  
      +
         /**
          * Gets the value of a field.
          * @param fieldName the name of the field to get.
      @@ -75,7 +75,7 @@ record = new GenericData.Record(other, /* deepCopy = */ true);
         public Object get(String fieldName) {
           return get(schema().getField(fieldName));
         }
      -  
      +
         /**
          * Gets the value of a field.
          * @param field the field to get.
      @@ -84,7 +84,7 @@ public Object get(String fieldName) {
         public Object get(Field field) {
           return get(field.pos());
         }
      -  
      +
         /**
          * Gets the value of a field.
          * @param pos the position of the field to get.
      @@ -93,7 +93,7 @@ public Object get(Field field) {
         protected Object get(int pos) {
           return record.get(pos);
         }
      -  
      +
         /**
          * Sets the value of a field.
          * @param fieldName the name of the field to set.
      @@ -103,7 +103,7 @@ protected Object get(int pos) {
         public GenericRecordBuilder set(String fieldName, Object value) {
           return set(schema().getField(fieldName), value);
         }
      -  
      +
         /**
          * Sets the value of a field.
          * @param field the field to set.
      @@ -113,7 +113,7 @@ public GenericRecordBuilder set(String fieldName, Object value) {
         public GenericRecordBuilder set(Field field, Object value) {
           return set(field, field.pos(), value);
         }
      -  
      +
         /**
          * Sets the value of a field.
          * @param pos the field to set.
      @@ -123,7 +123,7 @@ public GenericRecordBuilder set(Field field, Object value) {
         protected GenericRecordBuilder set(int pos, Object value) {
           return set(fields()[pos], pos, value);
         }
      -  
      +
         /**
          * Sets the value of a field.
          * @param field the field to set.
      @@ -137,7 +137,7 @@ private GenericRecordBuilder set(Field field, int pos, Object value) {
           fieldSetFlags()[pos] = true;
           return this;
         }
      -  
      +
         /**
          * Checks whether a field has been set.
          * @param fieldName the name of the field to check.
      @@ -146,7 +146,7 @@ private GenericRecordBuilder set(Field field, int pos, Object value) {
         public boolean has(String fieldName) {
           return has(schema().getField(fieldName));
         }
      -  
      +
         /**
          * Checks whether a field has been set.
          * @param field the field to check.
      @@ -155,7 +155,7 @@ public boolean has(String fieldName) {
         public boolean has(Field field) {
           return has(field.pos());
         }
      -  
      +
         /**
          * Checks whether a field has been set.
          * @param pos the position of the field to check.
      @@ -164,7 +164,7 @@ public boolean has(Field field) {
         protected boolean has(int pos) {
           return fieldSetFlags()[pos];
         }
      -  
      +
         /**
          * Clears the value of the given field.
          * @param fieldName the name of the field to clear.
      @@ -173,7 +173,7 @@ protected boolean has(int pos) {
         public GenericRecordBuilder clear(String fieldName) {
           return clear(schema().getField(fieldName));
         }
      -  
      +
         /**
          * Clears the value of the given field.
          * @param field the field to clear.
      @@ -182,7 +182,7 @@ public GenericRecordBuilder clear(String fieldName) {
         public GenericRecordBuilder clear(Field field) {
           return clear(field.pos());
         }
      -  
      +
         /**
          * Clears the value of the given field.
          * @param pos the position of the field to clear.
      @@ -193,7 +193,7 @@ protected GenericRecordBuilder clear(int pos) {
           fieldSetFlags()[pos] = false;
           return this;
         }
      -  
      +
         @Override
         public Record build() {
           Record record;
      @@ -202,7 +202,7 @@ record = new GenericData.Record(schema());
           } catch (Exception e) {
             throw new AvroRuntimeException(e);
           }
      -    
      +
           for (Field field : fields()) {
             Object value;
             try {
      @@ -214,22 +214,22 @@ record = new GenericData.Record(schema());
               record.put(field.pos(), value);
             }
           }
      -    
      +
           return record;
         }
      -  
      +
         /**
          * Gets the value of the given field.
          * If the field has been set, the set value is returned (even if it's null).
      -   * If the field hasn't been set and has a default value, the default value 
      +   * If the field hasn't been set and has a default value, the default value
          * is returned.
          * @param field the field whose value should be retrieved.
      -   * @return the value set for the given field, the field's default value, 
      +   * @return the value set for the given field, the field's default value,
          * or null.
          * @throws IOException
          */
         private Object getWithDefault(Field field) throws IOException {
      -    return fieldSetFlags()[field.pos()] ? 
      +    return fieldSetFlags()[field.pos()] ?
               record.get(field.pos()) : defaultValue(field);
         }
       
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryData.java b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryData.java
      index 18cbf8a17df..3d4f79c4ace 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryData.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryData.java
      @@ -35,7 +35,7 @@ public Decoders() {
              this.d1 = new BinaryDecoder(new byte[0], 0, 0);
              this.d2 = new BinaryDecoder(new byte[0], 0, 0);
           }
      -    public void set(byte[] data1, int off1, int len1, 
      +    public void set(byte[] data1, int off1, int len1,
                           byte[] data2, int off2, int len2) {
             d1.setBuf(data1, off1, len1);
             d2.setBuf(data2, off2, len2);
      @@ -283,7 +283,7 @@ private static int hashBytes(int init, HashData data, int len, boolean rev)
           byte[] bytes = data.decoder.getBuf();
           int start = data.decoder.getPos();
           int end = start+len;
      -    if (rev) 
      +    if (rev)
             for (int i = end-1; i >= start; i--)
               hashCode = hashCode*31 + bytes[i];
           else
      @@ -333,7 +333,7 @@ public static int encodeInt(int n, byte[] buf, int pos) {
                 }
               }
             }
      -    } 
      +    }
           buf[pos++] = (byte) n;
           return pos - start;
         }
      @@ -395,7 +395,7 @@ public static int encodeLong(long n, byte[] buf, int pos) {
         public static int encodeFloat(float f, byte[] buf, int pos) {
           int len = 1;
           int bits = Float.floatToRawIntBits(f);
      -    // hotspot compiler works well with this variant 
      +    // hotspot compiler works well with this variant
           buf[pos]         = (byte)((bits       ) & 0xFF);
           buf[pos + len++] = (byte)((bits >>>  8) & 0xFF);
           buf[pos + len++] = (byte)((bits >>> 16) & 0xFF);
      diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java
      index 7877002e510..3711d2bd2b8 100644
      --- a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java
      +++ b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryDecoder.java
      @@ -33,7 +33,7 @@
        * required to serve its read methods.
        * The number of unused bytes in the buffer can be accessed by
        * inputStream().remaining(), if the BinaryDecoder is not 'direct'.
      - * 
      + *
        * @see Encoder
        */
       
      @@ -191,7 +191,7 @@ public long readLong() throws IOException {
           }
           return (l >>> 1) ^ -(l & 1); // back to two's-complement
         }
      -  
      +
         // splitting readLong up makes it faster because of the JVM does more
         // optimizations on small methods
         private long innerLongDecode(long l) throws IOException {
      @@ -264,7 +264,7 @@ public Utf8 readString(Utf8 old) throws IOException {
           }
           return result;
         }
      -  
      +
         private final Utf8 scratchUtf8 = new Utf8();
       
         @Override
      @@ -325,7 +325,7 @@ protected void doSkipBytes(long length) throws IOException {
       
         /**
          * Reads length bytes into bytes starting at start.
      -   * 
      +   *
          * @throws EOFException
          *           If there are not enough number of bytes in the source.
          * @throws IOException
      @@ -354,7 +354,7 @@ protected void doReadBytes(byte[] bytes, int start, int length)
          * Returns the number of items to follow in the current array or map. Returns
          * 0 if there are no more items in the current array and the array/map has
          * ended.
      -   * 
      +   *
          * @throws IOException
          */
         protected long doReadItemCount() throws IOException {
      @@ -372,7 +372,7 @@ protected long doReadItemCount() throws IOException {
          * more items left in the array or map. If items cannot be skipped (because
          * byte count to skip is not found in the stream) return the count of the
          * items found. The client needs to skip the items individually.
      -   * 
      +   *
          * @return Zero if there are no more items to skip and end of array/map is
          *         reached. Positive number if some items are found that cannot be
          *         skipped and the client needs to skip them individually.
      @@ -476,10 +476,10 @@ private void ensureBounds(int num) throws IOException {
       
         /**
          * Returns an {@link java.io.InputStream} that is aware of any buffering that
      -   * may occur in this BinaryDecoder. Readers that need to interleave decoding 
      +   * may occur in this BinaryDecoder. Readers that need to interleave decoding
          * Avro data with other reads must access this InputStream to do so unless
          * the implementation is 'direct' and does not read beyond the minimum bytes
      -   * necessary from the source.  
      +   * necessary from the source.
          */
         public InputStream inputStream() {
           return source;
      @@ -624,7 +624,7 @@ protected void detach() {
           /**
            * Skips length bytes from the source. If length bytes cannot be skipped due
            * to end of file/stream/channel/etc an EOFException is thrown
      -     * 
      +     *
            * @param length
            *          the number of bytes to attempt to skip
            * @throws IOException
      @@ -639,7 +639,7 @@ protected void detach() {
            * actual number of bytes skipped. This method must attempt to skip as many
            * bytes as possible up to skipLength bytes. Skipping 0 bytes signals
            * end of stream/channel/file/etc
      -     * 
      +     *
            * @param skipLength
            *          the number of bytes to attempt to skip
            * @return the count of actual bytes skipped.
      @@ -650,7 +650,7 @@ protected void detach() {
            * Reads raw from the source, into a byte[]. Used for reads that are larger
            * than the buffer, or otherwise unbuffered. This is a mandatory read -- if
            * there is not enough bytes in the source, EOFException is thrown.
      -     * 
      +     *
            * @throws IOException
            *           if an error occurs
            * @throws EOFException
      @@ -666,7 +666,7 @@ protected abstract void readRaw(byte[] data, int off, int len)
            * 

      * This method must attempt to read as much as possible from the source. * Returns 0 when at the end of stream/channel/file/etc. - * + * * @throws IOException * if an error occurs reading **/ @@ -677,9 +677,9 @@ protected abstract int tryReadRaw(byte[] data, int off, int len) * If this source buffers, compacts the buffer by placing the * remaining bytes starting at pos at minPos. This may * be done in the current buffer, or may replace the buffer with a new one. - * + * * The end result must be a buffer with at least 16 bytes of remaining space. - * + * * @param pos * @param minPos * @param remaining @@ -876,7 +876,7 @@ public void close() throws IOException { /** * This byte source is special. It will avoid copying data by using the * source's byte[] as a buffer in the decoder. - * + * */ private static class ByteArrayByteSource extends ByteSource { private byte[] data; diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryEncoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryEncoder.java index 7be0390e218..9e21a6531e0 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/BinaryEncoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/BinaryEncoder.java @@ -26,7 +26,7 @@ * An abstract {@link Encoder} for Avro's binary encoding. *

      * To construct and configure instances, use {@link EncoderFactory} - * + * * @see EncoderFactory * @see BufferedBinaryEncoder * @see DirectBinaryEncoder @@ -35,15 +35,15 @@ * @see Decoder */ public abstract class BinaryEncoder extends Encoder { - + @Override public void writeNull() throws IOException {} - + @Override public void writeString(Utf8 utf8) throws IOException { this.writeBytes(utf8.getBytes(), 0, utf8.getByteLength()); } - + @Override public void writeString(String string) throws IOException { if (0 == string.length()) { @@ -65,7 +65,7 @@ public void writeBytes(ByteBuffer bytes) throws IOException { writeFixed(bytes); } } - + @Override public void writeBytes(byte[] bytes, int start, int len) throws IOException { if (0 == len) { @@ -75,7 +75,7 @@ public void writeBytes(byte[] bytes, int start, int len) throws IOException { this.writeInt(len); this.writeFixed(bytes, start, len); } - + @Override public void writeEnum(int e) throws IOException { this.writeInt(e); @@ -90,7 +90,7 @@ public void setItemCount(long itemCount) throws IOException { this.writeLong(itemCount); } } - + @Override public void startItem() throws IOException {} @@ -111,10 +111,10 @@ public void writeMapEnd() throws IOException { public void writeIndex(int unionIndex) throws IOException { writeInt(unionIndex); } - + /** Write a zero byte to the underlying output. **/ protected abstract void writeZero() throws IOException; - + /** * Returns the number of bytes currently buffered by this encoder. If this * Encoder does not buffer, this will always return zero. @@ -122,6 +122,6 @@ public void writeIndex(int unionIndex) throws IOException { * Call {@link #flush()} to empty the buffer to the underlying output. */ public abstract int bytesBuffered(); - + } diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/BlockingBinaryEncoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/BlockingBinaryEncoder.java index e8b6c33885d..96a055dc4ee 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/BlockingBinaryEncoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/BlockingBinaryEncoder.java @@ -37,7 +37,7 @@ * {@link #flush()} is called. *

      * BlockingBinaryEncoder is not thread-safe - * + * * @see BinaryEncoder * @see EncoderFactory * @see Encoder @@ -100,7 +100,7 @@ public enum State { /** The state of this BlockedValue */ public State state; - + /** The location in the buffer where this blocked value starts */ public int start; @@ -109,7 +109,7 @@ public enum State { * is the first item, this is same as {@link #start}. */ public int lastFullItem; - + /** * Number of items in this blocked value that are stored * in the buffer. @@ -126,7 +126,7 @@ public BlockedValue() { this.start = this.lastFullItem = 0; this.items = 1; // Makes various assertions work out } - + /** * Check invariants of this and also the * BlockedValue containing this. @@ -167,12 +167,12 @@ public boolean check(BlockedValue prev, int pos) { * stream. */ private byte[] buf; - + /** * Index into the location in {@link #buf}, where next byte can be written. */ private int pos; - + /** * The state stack. */ @@ -232,11 +232,11 @@ BlockingBinaryEncoder configure(OutputStream out, int blockBufferSize, if (null == buf || buf.length != blockBufferSize) { buf = new byte[blockBufferSize]; } - + assert check(); return this; } - + @Override public void flush() throws IOException { BlockedValue bv = blockStack[stackTop]; @@ -270,7 +270,7 @@ public void writeLong(long n) throws IOException { ensureBounds(10); pos += BinaryData.encodeLong(n, buf, pos); } - + @Override public void writeFloat(float f) throws IOException { ensureBounds(4); @@ -287,7 +287,7 @@ public void writeDouble(double d) throws IOException { public void writeFixed(byte[] bytes, int start, int len) throws IOException { doWriteBytes(bytes, start, len); } - + @Override protected void writeZero() throws IOException { ensureBounds(1); @@ -318,7 +318,7 @@ public void setItemCount(long itemCount) throws IOException { assert check(); } - + @Override public void startItem() throws IOException { if (blockStack[stackTop].state == BlockedValue.State.OVERFLOW) { @@ -371,7 +371,7 @@ public void writeMapEnd() throws IOException { throw new AvroTypeException("Failed to read write expected number of array elements."); } endBlockedValue(); - + assert check(); } @@ -385,7 +385,7 @@ public void writeIndex(int unionIndex) throws IOException { public int bytesBuffered() { return pos + super.bytesBuffered(); } - + private void endBlockedValue() throws IOException { for (; ;) { assert check(); diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/BufferedBinaryEncoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/BufferedBinaryEncoder.java index cb0758c8100..82a36f9ebee 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/BufferedBinaryEncoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/BufferedBinaryEncoder.java @@ -38,7 +38,7 @@ * To construct or reconfigure, use * {@link EncoderFactory#binaryEncoder(OutputStream, BinaryEncoder)}. *

      - * To change the buffer size, configure the factory instance used to + * To change the buffer size, configure the factory instance used to * create instances with {@link EncoderFactory#configureBufferSize(int)} * @see Encoder * @see EncoderFactory @@ -54,7 +54,7 @@ public class BufferedBinaryEncoder extends BinaryEncoder { BufferedBinaryEncoder(OutputStream out, int bufferSize) { configure(out, bufferSize); } - + BufferedBinaryEncoder configure(OutputStream out, int bufferSize) { if (null == out) throw new NullPointerException("OutputStream cannot be null!"); @@ -85,7 +85,7 @@ public void flush() throws IOException { sink.innerFlush(); } - /** Flushes the internal buffer to the underlying output. + /** Flushes the internal buffer to the underlying output. * Does not flush the underlying output. */ private void flushBuffer() throws IOException { @@ -154,7 +154,7 @@ public void writeFixed(byte[] bytes, int start, int len) throws IOException { System.arraycopy(bytes, start, buf, pos, len); pos += len; } - + @Override public void writeFixed(ByteBuffer bytes) throws IOException { if (!bytes.hasArray() && bytes.remaining() > bulkLimit) { @@ -169,7 +169,7 @@ public void writeFixed(ByteBuffer bytes) throws IOException { protected void writeZero() throws IOException { writeByte(0); } - + private void writeByte(int b) throws IOException { if (pos == buf.length) { flushBuffer(); @@ -195,13 +195,13 @@ private abstract static class ByteSink { protected ByteSink() {} /** Write data from bytes, starting at off, for len bytes **/ protected abstract void innerWrite(byte[] bytes, int off, int len) throws IOException; - + protected abstract void innerWrite(ByteBuffer buff) throws IOException; - + /** Flush the underlying output, if supported **/ protected abstract void innerFlush() throws IOException; } - + static class OutputStreamSink extends ByteSink { private final OutputStream out; private final WritableByteChannel channel; diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/Decoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/Decoder.java index e924de54638..46d3e9ebd41 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/Decoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/Decoder.java @@ -88,14 +88,14 @@ public abstract class Decoder { * is not the type of the next value to be read */ public abstract double readDouble() throws IOException; - + /** * Reads a char-string written by {@link Encoder#writeString}. * @throws AvroTypeException If this is a stateful reader and * char-string is not the type of the next value to be read */ public abstract Utf8 readString(Utf8 old) throws IOException; - + /** * Reads a char-string written by {@link Encoder#writeString}. * @throws AvroTypeException If this is a stateful reader and @@ -125,7 +125,7 @@ public abstract class Decoder { * byte-string is not the type of the next value to be read */ public abstract void skipBytes() throws IOException; - + /** * Reads fixed sized binary object. * @param bytes The buffer to store the contents being read. @@ -149,7 +149,7 @@ public abstract void readFixed(byte[] bytes, int start, int length) public void readFixed(byte[] bytes) throws IOException { readFixed(bytes, 0, bytes.length); } - + /** * Discards fixed sized binary object. * @param length The size of the binary object to be skipped. @@ -168,7 +168,7 @@ public void readFixed(byte[] bytes) throws IOException { * @throws IOException */ public abstract int readEnum() throws IOException; - + /** * Reads and returns the size of the first block of an array. If * this method returns non-zero, then the caller should read the diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/DecoderFactory.java b/lang/java/avro/src/main/java/org/apache/avro/io/DecoderFactory.java index c777614faef..2e874ad8e82 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/DecoderFactory.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/DecoderFactory.java @@ -28,7 +28,7 @@ * Factories are thread-safe, and are generally cached by applications for * performance reasons. Multiple instances are only required if multiple * concurrent configurations are needed. - * + * * @see Decoder */ @@ -50,7 +50,7 @@ public DecoderFactory() { public static DecoderFactory defaultFactory() { return get(); } - + /** * Returns an immutable static DecoderFactory configured with default settings * All mutating methods throw IllegalArgumentExceptions. All creator methods @@ -64,7 +64,7 @@ public static DecoderFactory get() { * Configures this factory to use the specified buffer size when creating * Decoder instances that buffer their input. The default buffer size is * 8192 bytes. - * + * * @param size The preferred buffer size. Valid values are in the range [32, * 16*1024*1024]. Values outside this range are rounded to the nearest * value in the range. Values less than 512 or greater than 1024*1024 @@ -82,7 +82,7 @@ public DecoderFactory configureDecoderBufferSize(int size) { this.binaryDecoderBufferSize = size; return this; } - + /** * Returns this factory's configured preferred buffer size. Used when creating * Decoder instances that buffer. See {@link #configureDecoderBufferSize} @@ -91,14 +91,14 @@ public DecoderFactory configureDecoderBufferSize(int size) { public int getConfiguredBufferSize() { return this.binaryDecoderBufferSize; } - + /** @deprecated use the equivalent * {@link #binaryDecoder(InputStream, BinaryDecoder)} instead */ @Deprecated public BinaryDecoder createBinaryDecoder(InputStream in, BinaryDecoder reuse) { return binaryDecoder(in, reuse); } - + /** * Creates or reinitializes a {@link BinaryDecoder} with the input stream * provided as the source of data. If reuse is provided, it will be @@ -113,7 +113,7 @@ public BinaryDecoder createBinaryDecoder(InputStream in, BinaryDecoder reuse) { * {@link BinaryDecoder#inputStream()} provides a view on the data that is * buffer-aware, for users that need to interleave access to data * with the Decoder API. - * + * * @param in * The InputStream to initialize to * @param reuse @@ -135,7 +135,7 @@ public BinaryDecoder binaryDecoder(InputStream in, BinaryDecoder reuse) { return ((BinaryDecoder)reuse).configure(in, binaryDecoderBufferSize); } } - + /** * Creates or reinitializes a {@link BinaryDecoder} with the input stream * provided as the source of data. If reuse is provided, it will be @@ -149,7 +149,7 @@ public BinaryDecoder binaryDecoder(InputStream in, BinaryDecoder reuse) { * A "direct" BinaryDecoder does not read ahead from an InputStream or other data source * that cannot be rewound. From the perspective of a client, a "direct" decoder * must never read beyond the minimum necessary bytes to service a {@link BinaryDecoder} - * API read request. + * API read request. *

      * In the case that the improved performance of a buffering implementation does not outweigh the * inconvenience of its buffering semantics, a "direct" decoder can be @@ -187,7 +187,7 @@ public BinaryDecoder createBinaryDecoder(byte[] bytes, int offset, return reuse.configure(bytes, offset, length); } } - + /** * Creates or reinitializes a {@link BinaryDecoder} with the byte array * provided as the source of data. If reuse is provided, it will @@ -197,7 +197,7 @@ public BinaryDecoder createBinaryDecoder(byte[] bytes, int offset, * {@link BinaryDecoder#inputStream()} provides a view on the data that is * buffer-aware and can provide a view of the data not yet read by Decoder API * methods. - * + * * @param bytes The byte array to initialize to * @param offset The offset to start reading from * @param length The maximum number of bytes to read from the byte array @@ -223,7 +223,7 @@ public BinaryDecoder binaryDecoder(byte[] bytes, int offset, public BinaryDecoder createBinaryDecoder(byte[] bytes, BinaryDecoder reuse) { return binaryDecoder(bytes, 0, bytes.length, reuse); } - + /** * This method is shorthand for *

      @@ -238,7 +238,7 @@ public BinaryDecoder binaryDecoder(byte[] bytes, BinaryDecoder reuse) {
          * Creates a {@link JsonDecoder} using the InputStrim provided for reading
          * data that conforms to the Schema provided.
          * 

      - * + * * @param schema * The Schema for data read from this JsonEncoder. Cannot be null. * @param input @@ -250,12 +250,12 @@ public JsonDecoder jsonDecoder(Schema schema, InputStream input) throws IOException { return new JsonDecoder(schema, input); } - + /** * Creates a {@link JsonDecoder} using the String provided for reading data * that conforms to the Schema provided. *

      - * + * * @param schema * The Schema for data read from this JsonEncoder. Cannot be null. * @param input @@ -272,7 +272,7 @@ public JsonDecoder jsonDecoder(Schema schema, String input) * Creates a {@link ValidatingDecoder} wrapping the Decoder provided. This * ValidatingDecoder will ensure that operations against it conform to the * schema provided. - * + * * @param schema * The Schema to validate against. Cannot be null. * @param wrapped @@ -290,7 +290,7 @@ public ValidatingDecoder validatingDecoder(Schema schema, Decoder wrapped) * Creates a {@link ResolvingDecoder} wrapping the Decoder provided. This * ResolvingDecoder will resolve input conforming to the writer schema * from the wrapped Decoder, and present it as the reader schema. - * + * * @param writer * The Schema that the source data is in. Cannot be null. * @param reader @@ -306,7 +306,7 @@ public ResolvingDecoder resolvingDecoder(Schema writer, Schema reader, Decoder wrapped) throws IOException { return new ResolvingDecoder(writer, reader, wrapped); } - + private static class DefaultDecoderFactory extends DecoderFactory { @Override public DecoderFactory configureDecoderBufferSize(int bufferSize) { diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryDecoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryDecoder.java index 5bc17607424..07c6199d4d4 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryDecoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryDecoder.java @@ -54,11 +54,11 @@ public ByteBuffer read(ByteBuffer old, int length) throws IOException { private class ReuseByteReader extends ByteReader { private final ByteBufferInputStream bbi; - + public ReuseByteReader(ByteBufferInputStream bbi) { this.bbi = bbi; } - + @Override public ByteBuffer read(ByteBuffer old, int length) throws IOException { if (old != null) { @@ -67,7 +67,7 @@ public ByteBuffer read(ByteBuffer old, int length) throws IOException { return bbi.readBuffer(length); } } - + } private ByteReader byteReader; @@ -111,7 +111,7 @@ public int readInt() throws IOException { shift += 7; } while (shift < 32); throw new IOException("Invalid int encoding"); - + } @Override @@ -119,7 +119,7 @@ public long readLong() throws IOException { long n = 0; int b; int shift = 0; - do { + do { b = in.read(); if (b >= 0) { n |= (b & 0x7FL) << shift; diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryEncoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryEncoder.java index 112674213b1..ff5b52c7468 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryEncoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/DirectBinaryEncoder.java @@ -43,7 +43,7 @@ public class DirectBinaryEncoder extends BinaryEncoder { private final byte[] buf = new byte[12]; /** Create a writer that sends its output to the underlying stream - * out. + * out. **/ DirectBinaryEncoder(OutputStream out) { configure(out); @@ -84,7 +84,7 @@ public void writeInt(int n) throws IOException { } /* buffering is slower for writeLong when the number is small enough to - * fit in an int. + * fit in an int. * (Sun JRE 1.6u22, x64 -server) */ @Override public void writeLong(long n) throws IOException { @@ -101,7 +101,7 @@ public void writeLong(long n) throws IOException { int len = BinaryData.encodeLong(n, buf, 0); out.write(buf, 0, len); } - + @Override public void writeFloat(float f) throws IOException { int len = BinaryData.encodeFloat(f, buf, 0); @@ -124,7 +124,7 @@ public void writeFixed(byte[] bytes, int start, int len) throws IOException { protected void writeZero() throws IOException { out.write(0); } - + @Override public int bytesBuffered() { return 0; diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/Encoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/Encoder.java index c3647c06036..4148afb72cf 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/Encoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/Encoder.java @@ -40,7 +40,7 @@ * (See {@link #writeArrayStart} for details on these methods.) *

      * {@link EncoderFactory} contains Encoder construction and configuration - * facilities. + * facilities. * @see EncoderFactory * @see Decoder */ @@ -53,7 +53,7 @@ public abstract class Encoder implements Flushable { * null is not expected */ public abstract void writeNull() throws IOException; - + /** * Write a boolean value. * @throws AvroTypeException If this is a stateful writer and a @@ -74,9 +74,9 @@ public abstract class Encoder implements Flushable { * long is not expected */ public abstract void writeLong(long n) throws IOException; - + /** Write a float. - * @throws IOException + * @throws IOException * @throws AvroTypeException If this is a stateful writer and a * float is not expected */ @@ -98,7 +98,7 @@ public abstract class Encoder implements Flushable { /** * Write a Unicode character string. The default implementation converts - * the String to a {@link org.apache.avro.util.Utf8}. Some Encoder + * the String to a {@link org.apache.avro.util.Utf8}. Some Encoder * implementations may want to do something different as a performance optimization. * @throws AvroTypeException If this is a stateful writer and a * char-string is not expected @@ -120,25 +120,25 @@ public void writeString(CharSequence charSequence) throws IOException { else writeString(charSequence.toString()); } - + /** * Write a byte string. * @throws AvroTypeException If this is a stateful writer and a * byte-string is not expected */ public abstract void writeBytes(ByteBuffer bytes) throws IOException; - + /** * Write a byte string. * @throws AvroTypeException If this is a stateful writer and a * byte-string is not expected */ public abstract void writeBytes(byte[] bytes, int start, int len) throws IOException; - + /** * Writes a byte string. * Equivalent to writeBytes(bytes, 0, bytes.length) - * @throws IOException + * @throws IOException * @throws AvroTypeException If this is a stateful writer and a * byte-string is not expected */ @@ -165,7 +165,7 @@ public void writeBytes(byte[] bytes) throws IOException { public void writeFixed(byte[] bytes) throws IOException { writeFixed(bytes, 0, bytes.length); } - + /** Writes a fixed from a ByteBuffer. */ public void writeFixed(ByteBuffer bytes) throws IOException { int pos = bytes.position(); @@ -225,12 +225,12 @@ public void writeFixed(ByteBuffer bytes) throws IOException { * to {@link #startItem()} must be equal to the count specified * in {@link #setItemCount}. Once a batch is completed you * can start another batch with {@link #setItemCount}. - * + * * @param itemCount The number of {@link #startItem()} calls to follow. * @throws IOException */ public abstract void setItemCount(long itemCount) throws IOException; - + /** * Start a new item of an array or map. * See {@link #writeArrayStart} for usage information. diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/EncoderFactory.java b/lang/java/avro/src/main/java/org/apache/avro/io/EncoderFactory.java index 679daa7cf04..9ba1acc541d 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/EncoderFactory.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/EncoderFactory.java @@ -30,7 +30,7 @@ * Factory methods that create Encoder instances are thread-safe. * Multiple instances with different configurations can be cached * by an application. - * + * * @see Encoder * @see BinaryEncoder * @see JsonEncoder @@ -46,9 +46,9 @@ public class EncoderFactory { private static final int MIN_BLOCK_BUFFER_SIZE = 64; private static final int MAX_BLOCK_BUFFER_SIZE = 1024 * 1024 * 1024; - private static final EncoderFactory DEFAULT_FACTORY = + private static final EncoderFactory DEFAULT_FACTORY = new DefaultEncoderFactory(); - + protected int binaryBufferSize = DEFAULT_BUFFER_SIZE; protected int binaryBlockSize = DEFAULT_BLOCK_BUFFER_SIZE; @@ -59,12 +59,12 @@ public class EncoderFactory { public static EncoderFactory get() { return DEFAULT_FACTORY; } - + /** * Configures this factory to use the specified buffer size when creating * Encoder instances that buffer their output. The default buffer size is 2048 * bytes. - * + * * @param size * The buffer size to configure new instances with. Valid values are * in the range [32, 16*1024*1024]. Values outside this range are set @@ -86,7 +86,7 @@ public EncoderFactory configureBufferSize(int size) { this.binaryBufferSize = size; return this; } - + /** * Returns this factory's configured default buffer size. Used when creating * Encoder instances that buffer writes. @@ -101,7 +101,7 @@ public int getBufferSize() { /** * Configures this factory to construct blocking BinaryEncoders with the * specified block buffer size. The default buffer size is 64 * 1024 bytes. - * + * * @param size * The preferred block size for array blocking. Arrays larger than * this size will be segmented into blocks according to the Avro @@ -115,7 +115,7 @@ public int getBufferSize() { * @see #blockingBinaryEncoder(OutputStream, BinaryEncoder) */ public EncoderFactory configureBlockSize(int size) { - if (size < MIN_BLOCK_BUFFER_SIZE) + if (size < MIN_BLOCK_BUFFER_SIZE) size = MIN_BLOCK_BUFFER_SIZE; if (size > MAX_BLOCK_BUFFER_SIZE) size = MAX_BLOCK_BUFFER_SIZE; @@ -124,7 +124,7 @@ public EncoderFactory configureBlockSize(int size) { } /** - * Returns this factory's configured default block buffer size. + * Returns this factory's configured default block buffer size. * {@link BinaryEncoder} instances created with * #blockingBinaryEncoder(OutputStream, BinaryEncoder) * will have block buffers of this size. @@ -136,7 +136,7 @@ public EncoderFactory configureBlockSize(int size) { public int getBlockSize() { return this.binaryBlockSize; } - + /** * Creates or reinitializes a {@link BinaryEncoder} with the OutputStream * provided as the destination for written data. If reuse is provided, @@ -147,11 +147,11 @@ public int getBlockSize() { * Data may not appear on the underlying OutputStream until * {@link Encoder#flush()} is called. The buffer size is configured with * {@link #configureBufferSize(int)}. - *

      If buffering is not desired, and lower performance is acceptable, use + *

      If buffering is not desired, and lower performance is acceptable, use * {@link #directBinaryEncoder(OutputStream, BinaryEncoder)} *

      * {@link BinaryEncoder} instances returned by this method are not thread-safe - * + * * @param out * The OutputStream to write to. Cannot be null. * @param reuse @@ -163,7 +163,7 @@ public int getBlockSize() { * reuse is null, this will be a new instance. If reuse * is not null, then the returned instance may be a new instance or * reuse reconfigured to use out. - * @throws IOException + * @throws IOException * @see BufferedBinaryEncoder * @see Encoder */ @@ -193,7 +193,7 @@ public BinaryEncoder binaryEncoder(OutputStream out, BinaryEncoder reuse) { * would not be useful. *

      * {@link BinaryEncoder} instances returned by this method are not thread-safe. - * + * * @param out * The OutputStream to initialize to. Cannot be null. * @param reuse @@ -215,7 +215,7 @@ public BinaryEncoder directBinaryEncoder(OutputStream out, BinaryEncoder reuse) return ((DirectBinaryEncoder)reuse).configure(out); } } - + /** * Creates or reinitializes a {@link BinaryEncoder} with the OutputStream * provided as the destination for written data. If reuse is provided, @@ -230,10 +230,10 @@ public BinaryEncoder directBinaryEncoder(OutputStream out, BinaryEncoder reuse) * delimited with byte sizes for Arrays and Maps. This allows for some decoders * to skip over large Arrays or Maps without decoding the contents, but adds * some overhead. The default block size is configured with - * {@link #configureBlockSize(int)} + * {@link #configureBlockSize(int)} *

      * {@link BinaryEncoder} instances returned by this method are not thread-safe. - * + * * @param out * The OutputStream to initialize to. Cannot be null. * @param reuse @@ -269,7 +269,7 @@ public BinaryEncoder blockingBinaryEncoder(OutputStream out, * underlying OutputStream until {@link Encoder#flush()} is called. *

      * {@link JsonEncoder} is not thread-safe. - * + * * @param schema * The Schema for data written to this JsonEncoder. Cannot be null. * @param out @@ -290,7 +290,7 @@ public JsonEncoder jsonEncoder(Schema schema, OutputStream out) * underlying OutputStream until {@link Encoder#flush()} is called. *

      * {@link JsonEncoder} is not thread-safe. - * + * * @param schema * The Schema for data written to this JsonEncoder. Cannot be null. * @param out @@ -313,7 +313,7 @@ public JsonEncoder jsonEncoder(Schema schema, OutputStream out, boolean pretty) * underlying output until {@link Encoder#flush()} is called. *

      * {@link JsonEncoder} is not thread-safe. - * + * * @param schema * The Schema for data written to this JsonEncoder. Cannot be null. * @param gen @@ -327,7 +327,7 @@ public JsonEncoder jsonEncoder(Schema schema, JsonGenerator gen) throws IOException { return new JsonEncoder(schema, gen); } - + /** * Creates a {@link ValidatingEncoder} that wraps the Encoder provided. * This ValidatingEncoder will ensure that operations against it conform @@ -337,7 +337,7 @@ public JsonEncoder jsonEncoder(Schema schema, JsonGenerator gen) * underlying output until {@link Encoder#flush()} is called. *

      * {@link ValidatingEncoder} is not thread-safe. - * + * * @param schema * The Schema to validate operations against. Cannot be null. * @param encoder @@ -350,7 +350,7 @@ public ValidatingEncoder validatingEncoder(Schema schema, Encoder encoder) throws IOException { return new ValidatingEncoder(schema, encoder); } - + // default encoder is not mutable private static class DefaultEncoderFactory extends EncoderFactory { @Override diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/JsonDecoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/JsonDecoder.java index 82061810e51..8045199ecb7 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/JsonDecoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/JsonDecoder.java @@ -43,7 +43,7 @@ import org.codehaus.jackson.JsonToken; import org.codehaus.jackson.ObjectCodec; -/** A {@link Decoder} for Avro's JSON data encoding. +/** A {@link Decoder} for Avro's JSON data encoding. *

      * Construct using {@link DecoderFactory}. *

      @@ -54,20 +54,20 @@ public class JsonDecoder extends ParsingDecoder private JsonParser in; private static JsonFactory jsonFactory = new JsonFactory(); Stack reorderBuffers = new Stack(); - ReorderBuffer currentReorderBuffer; - + ReorderBuffer currentReorderBuffer; + private static class ReorderBuffer { public Map> savedFields = new HashMap>(); - public JsonParser origParser = null; + public JsonParser origParser = null; } - + static final String CHARSET = "ISO-8859-1"; private JsonDecoder(Symbol root, InputStream in) throws IOException { super(root); configure(in); } - + private JsonDecoder(Symbol root, String in) throws IOException { super(root); configure(in); @@ -76,11 +76,11 @@ private JsonDecoder(Symbol root, String in) throws IOException { JsonDecoder(Schema schema, InputStream in) throws IOException { this(getSymbol(schema), in); } - + JsonDecoder(Schema schema, String in) throws IOException { this(getSymbol(schema), in); } - + private static Symbol getSymbol(Schema schema) { if (null == schema) { throw new NullPointerException("Schema cannot be null!"); @@ -109,7 +109,7 @@ public JsonDecoder configure(InputStream in) throws IOException { this.in.nextToken(); return this; } - + /** * Reconfigures this JsonDecoder to use the String provided for input. *

      @@ -152,7 +152,7 @@ public void readNull() throws IOException { @Override public boolean readBoolean() throws IOException { advance(Symbol.BOOLEAN); - JsonToken t = in.getCurrentToken(); + JsonToken t = in.getCurrentToken(); if (t == JsonToken.VALUE_TRUE || t == JsonToken.VALUE_FALSE) { in.nextToken(); return t == JsonToken.VALUE_TRUE; @@ -172,7 +172,7 @@ public int readInt() throws IOException { throw error("int"); } } - + @Override public long readLong() throws IOException { advance(Symbol.LONG); @@ -208,7 +208,7 @@ public double readDouble() throws IOException { throw error("double"); } } - + @Override public Utf8 readString(Utf8 old) throws IOException { return new Utf8(readString()); @@ -284,7 +284,7 @@ private void checkFixed(int size) throws IOException { top.size + " but received " + size + " bytes."); } } - + @Override public void readFixed(byte[] bytes, int start, int len) throws IOException { checkFixed(len); @@ -377,7 +377,7 @@ public long skipArray() throws IOException { if (in.getCurrentToken() == JsonToken.START_ARRAY) { in.skipChildren(); in.nextToken(); - advance(Symbol.ARRAY_END); + advance(Symbol.ARRAY_END); } else { throw error("array-start"); } @@ -417,7 +417,7 @@ public long skipMap() throws IOException { if (in.getCurrentToken() == JsonToken.START_OBJECT) { in.skipChildren(); in.nextToken(); - advance(Symbol.MAP_END); + advance(Symbol.MAP_END); } else { throw error("map-start"); } @@ -428,7 +428,7 @@ public long skipMap() throws IOException { public int readIndex() throws IOException { advance(Symbol.UNION); Symbol.Alternative a = (Symbol.Alternative) parser.popSymbol(); - + String label; if (in.getCurrentToken() == JsonToken.VALUE_NULL) { label = "null"; @@ -514,12 +514,12 @@ public JsonElement(JsonToken t, String value) { this.token = t; this.value = value; } - + public JsonElement(JsonToken t) { this(t, null); } } - + private static List getVaueAsTree(JsonParser in) throws IOException { int level = 0; List result = new ArrayList(); @@ -685,7 +685,7 @@ public byte[] getBinaryValue(Base64Variant b64variant) throws IOException { throw new UnsupportedOperationException(); } - + @Override public JsonToken getCurrentToken() { return elements.get(pos).token; diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/JsonEncoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/JsonEncoder.java index 9d413e633b8..2c2b0c1d51b 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/JsonEncoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/JsonEncoder.java @@ -34,7 +34,7 @@ import org.codehaus.jackson.util.DefaultPrettyPrinter; import org.codehaus.jackson.util.MinimalPrettyPrinter; -/** An {@link Encoder} for Avro's JSON data encoding. +/** An {@link Encoder} for Avro's JSON data encoding. *

      * Construct using {@link EncoderFactory}. *

      @@ -79,7 +79,7 @@ public void flush() throws IOException { private static JsonGenerator getJsonGenerator(OutputStream out, boolean pretty) throws IOException { if (null == out) - throw new NullPointerException("OutputStream cannot be null"); + throw new NullPointerException("OutputStream cannot be null"); JsonGenerator g = new JsonFactory().createJsonGenerator(out, JsonEncoding.UTF8); if (pretty) { @@ -99,7 +99,7 @@ public void writeRootValueSeparator(JsonGenerator jg) } return g; } - + /** * Reconfigures this JsonEncoder to use the output stream provided. *

      @@ -108,7 +108,7 @@ public void writeRootValueSeparator(JsonGenerator jg) * Otherwise, this JsonEncoder will flush its current output and then * reconfigure its output to use a default UTF8 JsonGenerator that writes * to the provided OutputStream. - * + * * @param out * The OutputStream to direct output to. Cannot be null. * @throws IOException @@ -118,7 +118,7 @@ public JsonEncoder configure(OutputStream out) throws IOException { this.configure(getJsonGenerator(out, false)); return this; } - + /** * Reconfigures this JsonEncoder to output to the JsonGenerator provided. *

      @@ -126,7 +126,7 @@ public JsonEncoder configure(OutputStream out) throws IOException { *

      * Otherwise, this JsonEncoder will flush its current output and then * reconfigure its output to use the provided JsonGenerator. - * + * * @param generator * The JsonGenerator to direct output to. Cannot be null. * @throws IOException @@ -184,8 +184,8 @@ public void writeDouble(double d) throws IOException { public void writeString(Utf8 utf8) throws IOException { writeString(utf8.toString()); } - - @Override + + @Override public void writeString(String str) throws IOException { parser.advance(Symbol.STRING); if (parser.topSymbol() == Symbol.MAP_KEY_MARKER) { diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/ParsingDecoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/ParsingDecoder.java index db1790e7b36..39e8aa32466 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/ParsingDecoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/ParsingDecoder.java @@ -35,7 +35,7 @@ protected ParsingDecoder(Symbol root) throws IOException { } protected abstract void skipFixed() throws IOException; - + @Override public void skipAction() throws IOException { parser.popSymbol(); @@ -72,6 +72,6 @@ public void skipTopSymbol() throws IOException { skipMap(); } } - + } diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/ParsingEncoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/ParsingEncoder.java index b6fe369d13c..53a7833247b 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/ParsingEncoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/ParsingEncoder.java @@ -30,7 +30,7 @@ public abstract class ParsingEncoder extends Encoder { * the collections (array or map). */ private long[] counts = new long[10]; - + protected int pos = -1; @Override @@ -54,7 +54,7 @@ protected final void push() { } counts[pos] = 0; } - + protected final void pop() { if (counts[pos] != 0) { throw new AvroTypeException("Incorrect number of items written. " + @@ -62,7 +62,7 @@ protected final void pop() { } pos--; } - + protected final int depth() { return pos; } diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/ResolvingDecoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/ResolvingDecoder.java index 2d7eba2a5b3..02cad1f0fc4 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/ResolvingDecoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/ResolvingDecoder.java @@ -43,12 +43,12 @@ public class ResolvingDecoder extends ValidatingDecoder { private Decoder backup; - + ResolvingDecoder(Schema writer, Schema reader, Decoder in) throws IOException { this(resolve(writer, reader), in); } - + /** * Constructs a ResolvingDecoder using the given resolver. * The resolver must have been returned by a previous call to @@ -68,7 +68,7 @@ private ResolvingDecoder(Object resolver, Decoder in) * returned Object is immutable and hence can be simultaneously used * in many ResolvingDecoders. This method is reasonably expensive, the * users are encouraged to cache the result. - * + * * @param writer The writer's schema. Cannot be null. * @param reader The reader's schema. Cannot be null. * @return The opaque reolver. @@ -124,20 +124,20 @@ public static Object resolve(Schema writer, Schema reader) * field values.) * * @throws AvroTypeException If we're not starting a new record - * + * */ public final Schema.Field[] readFieldOrder() throws IOException { return ((Symbol.FieldOrderAction) parser.advance(Symbol.FIELD_ACTION)). fields; } - + /** * Consume any more data that has been written by the writer but not * needed by the reader so that the the underlying decoder is in proper * shape for the next record. This situation happens when, for example, * the writer writes a record with two fields and the reader needs only the * first field. - * + * * This function should be called after completely decoding an object but * before next object can be decoded from the same underlying decoder * either directly or through another resolving decoder. If the same resolving @@ -175,7 +175,7 @@ public float readFloat() throws IOException { return (float) in.readFloat(); } } - + @Override public double readDouble() throws IOException { Symbol actual = parser.advance(Symbol.DOUBLE); @@ -190,7 +190,7 @@ public double readDouble() throws IOException { return in.readDouble(); } } - + @Override public Utf8 readString(Utf8 old) throws IOException { Symbol actual = parser.advance(Symbol.STRING); @@ -261,7 +261,7 @@ public int readEnum() throws IOException { throw new AvroTypeException((String) o); } } - + @Override public int readIndex() throws IOException { parser.advance(Symbol.UNION); diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingDecoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingDecoder.java index ec4275c38c9..3963dcf6f18 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingDecoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingDecoder.java @@ -50,7 +50,7 @@ public class ValidatingDecoder extends ParsingDecoder ValidatingDecoder(Schema schema, Decoder in) throws IOException { this(getSymbol(schema), in); } - + private static Symbol getSymbol(Schema schema) { if (null == schema) { throw new NullPointerException("Schema cannot be null"); @@ -70,7 +70,7 @@ public void readNull() throws IOException { parser.advance(Symbol.NULL); in.readNull(); } - + @Override public boolean readBoolean() throws IOException { parser.advance(Symbol.BOOLEAN); @@ -82,7 +82,7 @@ public int readInt() throws IOException { parser.advance(Symbol.INT); return in.readInt(); } - + @Override public long readLong() throws IOException { parser.advance(Symbol.LONG); @@ -100,7 +100,7 @@ public double readDouble() throws IOException { parser.advance(Symbol.DOUBLE); return in.readDouble(); } - + @Override public Utf8 readString(Utf8 old) throws IOException { parser.advance(Symbol.STRING); @@ -140,7 +140,7 @@ private void checkFixed(int size) throws IOException { top.size + " but received " + size + " bytes."); } } - + @Override public void readFixed(byte[] bytes, int start, int len) throws IOException { checkFixed(len); @@ -201,7 +201,7 @@ public long skipArray() throws IOException { parser.skipRepeater(); } } - parser.advance(Symbol.ARRAY_END); + parser.advance(Symbol.ARRAY_END); return 0; } @@ -245,7 +245,7 @@ public int readIndex() throws IOException { parser.pushSymbol(top.getSymbol(result)); return result; } - + @Override public Symbol doAction(Symbol input, Symbol top) throws IOException { return null; diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingEncoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingEncoder.java index 275df186e6d..7d2777fd24c 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingEncoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/ValidatingEncoder.java @@ -39,7 +39,7 @@ * @see Encoder * @see EncoderFactory */ -public class ValidatingEncoder extends ParsingEncoder +public class ValidatingEncoder extends ParsingEncoder implements Parser.ActionHandler { protected Encoder out; protected final Parser parser; @@ -70,7 +70,7 @@ public ValidatingEncoder configure(Encoder encoder) { this.out = encoder; return this; } - + @Override public void writeNull() throws IOException { parser.advance(Symbol.NULL); @@ -112,13 +112,13 @@ public void writeString(Utf8 utf8) throws IOException { parser.advance(Symbol.STRING); out.writeString(utf8); } - + @Override public void writeString(String str) throws IOException { parser.advance(Symbol.STRING); out.writeString(str); } - + @Override public void writeString(CharSequence charSequence) throws IOException { parser.advance(Symbol.STRING); diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Parser.java b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Parser.java index 796de3ec967..867e5147f96 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Parser.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Parser.java @@ -101,7 +101,7 @@ public final Symbol advance(Symbol input) throws IOException { } } } - + /** * Performs any implicit actions at the top the stack, expanding any * production (other than the root) that may be encountered. @@ -124,12 +124,12 @@ public final void processImplicitActions() throws IOException { } /** - * Performs any "trailing" implicit actions at the top the stack. + * Performs any "trailing" implicit actions at the top the stack. */ public final void processTrailingImplicitActions() throws IOException { while (pos >= 1) { Symbol top = stack[pos - 1]; - if (top.kind == Symbol.Kind.IMPLICIT_ACTION + if (top.kind == Symbol.Kind.IMPLICIT_ACTION && ((Symbol.ImplicitAction) top).isTrailing) { pos--; symbolHandler.doAction(null, top); @@ -160,14 +160,14 @@ public final void pushProduction(Symbol sym) { public Symbol popSymbol() { return stack[--pos]; } - + /** * Returns the top symbol from the stack. */ public Symbol topSymbol() { return stack[pos - 1]; } - + /** * Pushes sym on to the stack. */ @@ -177,7 +177,7 @@ public void pushSymbol(Symbol sym) { } stack[pos++] = sym; } - + /** * Returns the depth of the stack. */ diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ResolvingGrammarGenerator.java b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ResolvingGrammarGenerator.java index 31f38de74a8..cc028cf538d 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ResolvingGrammarGenerator.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ResolvingGrammarGenerator.java @@ -39,29 +39,29 @@ public class ResolvingGrammarGenerator extends ValidatingGrammarGenerator { /** * Resolves the writer schema writer and the reader schema - * reader and returns the start symbol for the grammar generated. + * reader and returns the start symbol for the grammar generated. * @param writer The schema used by the writer * @param reader The schema used by the reader * @return The start symbol for the resolving grammar - * @throws IOException + * @throws IOException */ public final Symbol generate(Schema writer, Schema reader) throws IOException { return Symbol.root(generate(writer, reader, new HashMap())); } - + /** * Resolves the writer schema writer and the reader schema * reader and returns the start symbol for the grammar generated. * If there is already a symbol in the map seen for resolving the * two schemas, then that symbol is returned. Otherwise a new symbol is - * generated and returnd. + * generated and returnd. * @param writer The schema used by the writer * @param reader The schema used by the reader * @param seen The <reader-schema, writer-schema> to symbol * map of start symbols of resolving grammars so far. * @return The start symbol for the resolving grammar - * @throws IOException + * @throws IOException */ public Symbol generate(Schema writer, Schema reader, Map seen) throws IOException @@ -108,7 +108,7 @@ public Symbol generate(Schema writer, Schema reader, generate(writer.getElementType(), reader.getElementType(), seen)), Symbol.ARRAY_START); - + case MAP: return Symbol.seq(Symbol.repeat(Symbol.MAP_END, generate(writer.getValueType(), @@ -125,7 +125,7 @@ public Symbol generate(Schema writer, Schema reader, if (writerType == Schema.Type.UNION) { return resolveUnion(writer, reader, seen); } - + switch (readerType) { case LONG: switch (writerType) { @@ -133,7 +133,7 @@ public Symbol generate(Schema writer, Schema reader, return Symbol.resolve(super.generate(writer, seen), Symbol.LONG); } break; - + case FLOAT: switch (writerType) { case INT: @@ -141,7 +141,7 @@ public Symbol generate(Schema writer, Schema reader, return Symbol.resolve(super.generate(writer, seen), Symbol.FLOAT); } break; - + case DOUBLE: switch (writerType) { case INT: @@ -150,21 +150,21 @@ public Symbol generate(Schema writer, Schema reader, return Symbol.resolve(super.generate(writer, seen), Symbol.DOUBLE); } break; - + case BYTES: switch (writerType) { case STRING: return Symbol.resolve(super.generate(writer, seen), Symbol.BYTES); } break; - + case STRING: switch (writerType) { case BYTES: return Symbol.resolve(super.generate(writer, seen), Symbol.STRING); } break; - + case UNION: int j = bestBranch(reader, writer, seen); if (j >= 0) { @@ -308,7 +308,7 @@ private static byte[] getBinary(Schema s, JsonNode n) throws IOException { e.flush(); return out.toByteArray(); } - + /** * Encodes the given Json node n on to the encoder e * according to the schema s. diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/SkipParser.java b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/SkipParser.java index 5afbe60d648..baf4e940b6e 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/SkipParser.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/SkipParser.java @@ -39,7 +39,7 @@ public interface SkipHandler { */ void skipTopSymbol() throws IOException; } - + private final SkipHandler skipHandler; public SkipParser(Symbol root, ActionHandler symbolHandler, diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java index 80ae6442b47..178aa0b7d49 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/Symbol.java @@ -60,7 +60,7 @@ public enum Kind { * the symbols that forms the production for this symbol. The * sequence is in the reverse order of production. This is useful * for easy copying onto parsing stack. - * + * * Please note that this is a final. So the production for a symbol * should be known before that symbol is constructed. This requirement * cannot be met for those symbols which are recursive (e.g. a record that @@ -77,8 +77,8 @@ public enum Kind { protected Symbol(Kind kind) { this(kind, null); } - - + + protected Symbol(Kind kind, Symbol[] production) { this.production = production; this.kind = kind; @@ -120,7 +120,7 @@ static Symbol alt(Symbol[] symbols, String[] labels) { static Symbol error(String e) { return new ErrorAction(e); } - + /** * A convenience method to construct a ResolvingAction. * @param w The writer symbol @@ -129,32 +129,32 @@ static Symbol error(String e) { static Symbol resolve(Symbol w, Symbol r) { return new ResolvingAction(w, r); } - + private static class Fixup { public final Symbol[] symbols; public final int pos; - + public Fixup(Symbol[] symbols, int pos) { this.symbols = symbols; this.pos = pos; } } - + public Symbol flatten(Map map, Map> map2) { return this; } - + public int flattenedSize() { return 1; } - + /** * Flattens the given sub-array of symbols into an sub-array of symbols. Every * Sequence in the input are replaced by its production recursively. * Non-Sequence symbols, they internally have other symbols * those internal symbols also get flattened. - * + * * The algorithm does a few tricks to handle recursive symbol definitions. * In order to avoid infinite recursion with recursive symbols, we have a map * of Symbol->Symbol. Before fully constructing a flattened symbol for a @@ -168,7 +168,7 @@ public int flattenedSize() { * has not not be fully constructed yet, we copy a bunch of nulls. * Fix-up remembers all those null patches. The fix-ups gets finally * filled when we know the symbols to occupy those patches. - * + * * @param in The array of input symbols to flatten * @param start The position where the input sub-array starts. * @param out The output that receives the flattened list of symbols. The @@ -246,7 +246,7 @@ public Terminal(String printName) { public static class ImplicitAction extends Symbol { /** - * Set to true if and only if this implicit action is + * Set to true if and only if this implicit action is * a trailing action. That is, it is an action that follows * real symbol. E.g {@link Symbol#DEFAULT_END_ACTION}. */ @@ -255,13 +255,13 @@ public static class ImplicitAction extends Symbol { private ImplicitAction() { this(false); } - + private ImplicitAction(boolean isTrailing) { super(Kind.IMPLICIT_ACTION); this.isTrailing = isTrailing; } } - + protected static class Root extends Symbol { private Root(Symbol... symbols) { super(Kind.ROOT, makeProduction(symbols)); @@ -276,7 +276,7 @@ private static Symbol[] makeProduction(Symbol[] symbols) { return result; } } - + protected static class Sequence extends Symbol implements Iterable { private Sequence(Symbol[] productions) { super(Kind.SEQUENCE, productions); @@ -285,19 +285,19 @@ private Sequence(Symbol[] productions) { public Symbol get(int index) { return production[index]; } - + public int size() { return production.length; } - + public Iterator iterator() { return new Iterator() { private int pos = production.length; - + public boolean hasNext() { return 0 < pos; } - + public Symbol next() { if (0 < pos) { return production[--pos]; @@ -305,7 +305,7 @@ public Symbol next() { throw new NoSuchElementException(); } } - + public void remove() { throw new UnsupportedOperationException(); } @@ -320,7 +320,7 @@ public Sequence flatten(Map map, map.put(this, result); List l = new ArrayList(); map2.put(result, l); - + flatten(production, 0, result.production, 0, map, map2); for (Fixup f : l) { @@ -340,19 +340,19 @@ public final int flattenedSize() { public static class Repeater extends Symbol { public final Symbol end; - + private Repeater(Symbol end, Symbol... sequenceToRepeat) { super(Kind.REPEATER, makeProduction(sequenceToRepeat)); this.end = end; production[0] = this; } - + private static Symbol[] makeProduction(Symbol[] p) { Symbol[] result = new Symbol[p.length + 1]; System.arraycopy(p, 0, result, 1, p.length); return result; } - + @Override public Repeater flatten(Map map, Map> map2) { @@ -363,9 +363,9 @@ public Repeater flatten(Map map, } } - + /** - * Returns true if the Parser contains any Error symbol, indicating that it may fail + * Returns true if the Parser contains any Error symbol, indicating that it may fail * for some inputs. */ public static boolean hasErrors(Symbol symbol) { @@ -388,7 +388,7 @@ public static boolean hasErrors(Symbol symbol) { throw new RuntimeException("unknown symbol kind: " + symbol.kind); } } - + private static boolean hasErrors(Symbol root, Symbol[] symbols) { if(null != symbols) { for(Symbol s: symbols) { @@ -402,7 +402,7 @@ private static boolean hasErrors(Symbol root, Symbol[] symbols) { } return false; } - + public static class Alternative extends Symbol { public final Symbol[] symbols; public final String[] labels; @@ -411,15 +411,15 @@ private Alternative(Symbol[] symbols, String[] labels) { this.symbols = symbols; this.labels = labels; } - + public Symbol getSymbol(int index) { return symbols[index]; } - + public String getLabel(int index) { return labels[index]; } - + public int size() { return symbols.length; } @@ -468,7 +468,7 @@ public static class IntCheckAction extends Symbol { public static EnumAdjustAction enumAdjustAction(int rsymCount, Object[] adj) { return new EnumAdjustAction(rsymCount, adj); } - + public static class EnumAdjustAction extends IntCheckAction { public final Object[] adjustments; @Deprecated public EnumAdjustAction(int rsymCount, Object[] adjustments) { @@ -492,7 +492,7 @@ private ResolvingAction(Symbol writer, Symbol reader) { this.writer = writer; this.reader = reader; } - + @Override public ResolvingAction flatten(Map map, Map> map2) { @@ -501,7 +501,7 @@ public ResolvingAction flatten(Map map, } } - + public static SkipAction skipAction(Symbol symToSkip) { return new SkipAction(symToSkip); } @@ -512,7 +512,7 @@ public static class SkipAction extends ImplicitAction { super(true); this.symToSkip = symToSkip; } - + @Override public SkipAction flatten(Map map, Map> map2) { @@ -524,7 +524,7 @@ public SkipAction flatten(Map map, public static FieldAdjustAction fieldAdjustAction(int rindex, String fname) { return new FieldAdjustAction(rindex, fname); } - + public static class FieldAdjustAction extends ImplicitAction { public final int rindex; public final String fname; @@ -533,7 +533,7 @@ public static class FieldAdjustAction extends ImplicitAction { this.fname = fname; } } - + public static FieldOrderAction fieldOrderAction(Schema.Field[] fields) { return new FieldOrderAction(fields); } @@ -567,13 +567,13 @@ public static class UnionAdjustAction extends ImplicitAction { this.rindex = rindex; this.symToParse = symToParse; } - + @Override public UnionAdjustAction flatten(Map map, Map> map2) { return new UnionAdjustAction(rindex, symToParse.flatten(map, map2)); } - + } /** For JSON. */ @@ -587,11 +587,11 @@ public static class EnumLabelsAction extends IntCheckAction { super(symbols.size()); this.symbols = symbols; } - + public String getLabel(int n) { return symbols.get(n); } - + public int findLabel(String l) { if (l != null) { for (int i = 0; i < symbols.size(); i++) { @@ -633,7 +633,7 @@ public int findLabel(String l) { public static final Symbol RECORD_END = new ImplicitAction(true); public static final Symbol UNION_END = new ImplicitAction(true); public static final Symbol FIELD_END = new ImplicitAction(true); - + public static final Symbol DEFAULT_END_ACTION = new ImplicitAction(true); public static final Symbol MAP_KEY_MARKER = new Symbol.Terminal("map-key-marker"); diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ValidatingGrammarGenerator.java b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ValidatingGrammarGenerator.java index 6bd1b260cd8..962fc10982b 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ValidatingGrammarGenerator.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/parsing/ValidatingGrammarGenerator.java @@ -101,7 +101,7 @@ public Symbol generate(Schema sc, Map seen) { List subs = sc.getTypes(); Symbol[] symbols = new Symbol[subs.size()]; String[] labels = new String[subs.size()]; - + int i = 0; for (Schema b : sc.getTypes()) { symbols[i] = generate(b, seen); @@ -119,7 +119,7 @@ public Symbol generate(Schema sc, Map seen) { static class LitS { public final Schema actual; public LitS(Schema actual) { this.actual = actual; } - + /** * Two LitS are equal if and only if their underlying schema is * the same (not merely equal). @@ -128,7 +128,7 @@ public boolean equals(Object o) { if (! (o instanceof LitS)) return false; return actual == ((LitS)o).actual; } - + public int hashCode() { return actual.hashCode(); } diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/AvroAlias.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/AvroAlias.java index bcd0fd173cb..d613350505a 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/reflect/AvroAlias.java +++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/AvroAlias.java @@ -25,7 +25,7 @@ /** * Adds the given name and space as an alias to the schema. * Avro files of this schema can be read into classes - * named by the alias. + * named by the alias. */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/CustomEncoding.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/CustomEncoding.java index 1c180e548b2..66421c588ef 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/reflect/CustomEncoding.java +++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/CustomEncoding.java @@ -25,10 +25,10 @@ /** * Expert: a custom encoder and decoder that writes - * an object directly to avro. + * an object directly to avro. * No validation is performed to check that the encoding conforms to the schema. * Invalid implementations may result in an unreadable file. - * The use of {@link org.apache.avro.io.ValidatingEncoder} is recommended. + * The use of {@link org.apache.avro.io.ValidatingEncoder} is recommended. * * @param The class of objects that can be serialized with this encoder / decoder. */ @@ -36,7 +36,7 @@ public abstract class CustomEncoding { protected Schema schema; - + protected abstract void write(Object datum, Encoder out) throws IOException; protected abstract T read(Object reuse, Decoder in) throws IOException; diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccess.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccess.java index ba739bc384e..ffc6f3c12e2 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccess.java +++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccess.java @@ -20,7 +20,7 @@ import java.lang.reflect.Field; abstract class FieldAccess { - + protected abstract FieldAccessor getAccessor(Field field); } diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessReflect.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessReflect.java index 680139acef4..fd544ec0222 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessReflect.java +++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessReflect.java @@ -47,7 +47,7 @@ public ReflectionBasedAccessor(Field field) { this.field = field; this.field.setAccessible(true); isStringable = field.isAnnotationPresent(Stringable.class); - isCustomEncoded = field.isAnnotationPresent(AvroEncode.class); + isCustomEncoded = field.isAnnotationPresent(AvroEncode.class); } @Override @@ -65,17 +65,17 @@ public void set(Object object, Object value) throws IllegalAccessException, IOException { field.set(object, value); } - + @Override protected Field getField() { return field; } - + @Override protected boolean isStringable() { return isStringable; } - + @Override protected boolean isCustomEncoded() { return isCustomEncoded; diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessUnsafe.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessUnsafe.java index b5ade1e6201..3ae25fde43a 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessUnsafe.java +++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessUnsafe.java @@ -92,7 +92,7 @@ protected Field getField() { protected boolean supportsIO() { return true; } - + @Override protected boolean isStringable() { return isStringable; @@ -321,18 +321,18 @@ protected void set(Object object, Object value) { protected Object get(Object object) { return UNSAFE.getObject(object, offset); } - + @Override protected boolean supportsIO() { return false; } - + } - + final static class UnsafeCustomEncodedField extends UnsafeCachedField { private CustomEncoding encoding; - + UnsafeCustomEncodedField(Field f, CustomEncoding encoding) { super(f); this.encoding = encoding; @@ -347,7 +347,7 @@ protected Object get(Object object) throws IllegalAccessException { protected void set(Object object, Object value) throws IllegalAccessException, IOException { UNSAFE.putObject(object, offset, value); } - + @Override protected void read(Object object, Decoder in) throws IOException { UNSAFE.putObject(object, offset, encoding.read(in)); @@ -357,7 +357,7 @@ protected void read(Object object, Decoder in) throws IOException { protected void write(Object object, Encoder out) throws IOException { encoding.write(UNSAFE.getObject(object, offset), out); } - + protected boolean isCustomEncoded() { return true; } diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessor.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessor.java index b76d185d46e..9d7114771bf 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessor.java +++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessor.java @@ -41,15 +41,15 @@ protected void write(Object object, Encoder out) throws IOException { protected boolean supportsIO() { return false; } - + protected abstract Field getField(); - + protected boolean isStringable() { return false; } - + protected boolean isCustomEncoded() { return false; } - + } diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java index 5af55b77938..6b6ae4e40b0 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java +++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectData.java @@ -87,17 +87,17 @@ protected Schema createFieldSchema(Field field, Map names) { return makeNullable(schema); } } - + private static final ReflectData INSTANCE = new ReflectData(); /** For subclasses. Applications normally use {@link ReflectData#get()}. */ public ReflectData() {} - + /** Construct with a particular classloader. */ public ReflectData(ClassLoader classLoader) { super(classLoader); } - + /** Return the singleton instance. */ public static ReflectData get() { return INSTANCE; } @@ -148,7 +148,7 @@ protected void setField(Object record, String name, int pos, Object o, public Object getField(Object record, String name, int position) { return getField(record, name, position, null); } - + @Override protected Object getField(Object record, String name, int pos, Object state) { if (record instanceof IndexedRecord) { @@ -160,7 +160,7 @@ protected Object getField(Object record, String name, int pos, Object state) { throw new AvroRuntimeException(e); } } - + private FieldAccessor getAccessorForField(Object record, String name, int pos, Object optionalState) { if (optionalState != null) { @@ -227,8 +227,8 @@ public boolean validate(Schema schema, Object datum) { return super.validate(schema, datum); } } - - static final ConcurrentHashMap, ClassAccessorData> + + static final ConcurrentHashMap, ClassAccessorData> ACCESSOR_CACHE = new ConcurrentHashMap, ClassAccessorData>(); static class ClassAccessorData { @@ -244,14 +244,14 @@ private ClassAccessorData(Class c) { continue; } FieldAccessor accessor = ReflectionUtil.getFieldAccess().getAccessor(f); - AvroName avroname = f.getAnnotation(AvroName.class); - byName.put( (avroname != null + AvroName avroname = f.getAnnotation(AvroName.class); + byName.put( (avroname != null ? avroname.value() - : f.getName()) , accessor); + : f.getName()) , accessor); } } - - /** + + /** * Return the field accessors as an array, indexed by the field * index of the given schema. */ @@ -282,7 +282,7 @@ private FieldAccessor getAccessorFor(String fieldName) { return result; } } - + private ClassAccessorData getClassAccessorData(Class c) { ClassAccessorData data = ACCESSOR_CACHE.get(c); if(data == null && !IndexedRecord.class.isAssignableFrom(c)){ @@ -294,7 +294,7 @@ private ClassAccessorData getClassAccessorData(Class c) { } return data; } - + private FieldAccessor[] getFieldAccessors(Class c, Schema s) { ClassAccessorData data = getClassAccessorData(c); if (data != null) { @@ -302,7 +302,7 @@ private FieldAccessor[] getFieldAccessors(Class c, Schema s) { } return null; } - + private FieldAccessor getFieldAccessor(Class c, String fieldName) { ClassAccessorData data = getClassAccessorData(c); if (data != null) { @@ -431,9 +431,9 @@ Schema createNonStringMapSchema(Type keyType, Type valueType, Map names) { Schema keySchema = createSchema(keyType, names); Schema valueSchema = createSchema(valueType, names); - Schema.Field keyField = + Schema.Field keyField = new Schema.Field(NS_MAP_KEY, keySchema, null, null); - Schema.Field valueField = + Schema.Field valueField = new Schema.Field(NS_MAP_VALUE, valueSchema, null, null); String name = getNameForNonStringMapRecord(keyType, valueType, keySchema, valueSchema); @@ -493,7 +493,7 @@ protected Schema createSchema(Type type, Map names) { if (type instanceof GenericArrayType) { // generic array Type component = ((GenericArrayType)type).getGenericComponentType(); if (component == Byte.TYPE) // byte array - return Schema.create(Schema.Type.BYTES); + return Schema.create(Schema.Type.BYTES); Schema result = Schema.createArray(createSchema(component, names)); setElement(result, component); return result; @@ -534,10 +534,10 @@ protected Schema createSchema(Type type, Map names) { } else if (type instanceof Class) { // Class Class c = (Class)type; if (c.isPrimitive() || // primitives - c == Void.class || c == Boolean.class || + c == Void.class || c == Boolean.class || c == Integer.class || c == Long.class || - c == Float.class || c == Double.class || - c == Byte.class || c == Short.class || + c == Float.class || c == Double.class || + c == Byte.class || c == Short.class || c == Character.class) return super.createSchema(type, names); if (c.isArray()) { // array @@ -599,7 +599,7 @@ protected Schema createSchema(Type type, Map names) { consumeAvroAliasAnnotation(c, schema); names.put(c.getName(), schema); for (Field field : getCachedFields(c)) - if ((field.getModifiers()&(Modifier.TRANSIENT|Modifier.STATIC))==0 + if ((field.getModifiers()&(Modifier.TRANSIENT|Modifier.STATIC))==0 && !field.isAnnotationPresent(AvroIgnore.class)) { Schema fieldSchema = createFieldSchema(field, names); AvroDefault defaultAnnotation @@ -607,7 +607,7 @@ protected Schema createSchema(Type type, Map names) { JsonNode defaultValue = (defaultAnnotation == null) ? null : Schema.parseJson(defaultAnnotation.value()); - + if (defaultValue == null && fieldSchema.getType() == Schema.Type.UNION) { Schema defaultType = fieldSchema.getTypes().get(0); @@ -616,17 +616,17 @@ protected Schema createSchema(Type type, Map names) { } } AvroName annotatedName = field.getAnnotation(AvroName.class); // Rename fields - String fieldName = (annotatedName != null) + String fieldName = (annotatedName != null) ? annotatedName.value() : field.getName(); - Schema.Field recordField + Schema.Field recordField = new Schema.Field(fieldName, fieldSchema, null, defaultValue); - + AvroMeta meta = field.getAnnotation(AvroMeta.class); // add metadata - if (meta != null) - recordField.addProp(meta.key(), meta.value()); - for(Schema.Field f : fields) { - if (f.name().equals(fieldName)) + if (meta != null) + recordField.addProp(meta.key(), meta.value()); + for(Schema.Field f : fields) { + if (f.name().equals(fieldName)) throw new AvroTypeException("double field entry: "+ fieldName); } fields.add(recordField); @@ -636,7 +636,7 @@ protected Schema createSchema(Type type, Map names) { null, null)); schema.setFields(fields); AvroMeta meta = c.getAnnotation(AvroMeta.class); - if (meta != null) + if (meta != null) schema.addProp(meta.key(), meta.value()); } names.put(fullName, schema); @@ -654,7 +654,7 @@ protected Schema createSchema(Type type, Map names) { makeNullable(Schema.create(Schema.Type.STRING)); // if array element type is a class with a union annotation, note it - // this is required because we cannot set a property on the union itself + // this is required because we cannot set a property on the union itself private void setElement(Schema schema, Type element) { if (!(element instanceof Class)) return; Class c = (Class)element; @@ -694,7 +694,7 @@ public static Schema makeNullable(Schema schema) { private static final Map,Field[]> FIELDS_CACHE = new ConcurrentHashMap,Field[]>(); - + // Return of this class and its superclasses to serialize. private static Field[] getCachedFields(Class recordClass) { Field[] fieldsList = FIELDS_CACHE.get(recordClass); @@ -722,7 +722,7 @@ private static Field[] getFields(Class recordClass, boolean excludeJava) { fieldsList = fields.values().toArray(new Field[0]); return fieldsList; } - + /** Create a schema for a field. */ protected Schema createFieldSchema(Field field, Map names) { AvroEncode enc = field.getAnnotation(AvroEncode.class); @@ -731,7 +731,7 @@ protected Schema createFieldSchema(Field field, Map names) { return enc.using().newInstance().getSchema(); } catch (Exception e) { throw new AvroRuntimeException("Could not create schema from custom serializer for " + field.getName()); - } + } AvroSchema explicit = field.getAnnotation(AvroSchema.class); if (explicit != null) // explicit schema @@ -816,7 +816,7 @@ else if (annotation instanceof Nullable) // nullable List errs = new ArrayList(); errs.add(Protocol.SYSTEM_ERROR); // every method can throw for (Type err : method.getGenericExceptionTypes()) - if (err != AvroRemoteException.class) + if (err != AvroRemoteException.class) errs.add(getSchema(err, names)); Schema errors = Schema.createUnion(errs); return protocol.createMessage(method.getName(), null /* doc */, request, response, errors); @@ -851,8 +851,8 @@ protected int compare(Object o1, Object o2, Schema s, boolean equals) { case BYTES: if (!o1.getClass().isArray()) break; - byte[] b1 = (byte[])o1; - byte[] b2 = (byte[])o2; + byte[] b1 = (byte[])o1; + byte[] b2 = (byte[])o2; return BinaryData.compareBytes(b1, 0, b1.length, b2, 0, b2.length); } return super.compare(o1, o2, s, equals); @@ -862,7 +862,7 @@ protected int compare(Object o1, Object o2, Schema s, boolean equals) { protected Object getRecordState(Object record, Schema schema) { return getFieldAccessors(record.getClass(), schema); } - + private void consumeAvroAliasAnnotation(Class c, Schema schema) { AvroAlias alias = c.getAnnotation(AvroAlias.class); if (alias != null) { diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectDatumReader.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectDatumReader.java index ee1218075d4..3d5a3010235 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectDatumReader.java +++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectDatumReader.java @@ -275,13 +275,13 @@ protected void readField(Object record, Field f, Object oldDatum, if (accessor.isStringable()) { try { String asString = (String) read(null, f.schema(), in); - accessor.set(record, asString == null + accessor.set(record, asString == null ? null : newInstanceFromString(accessor.getField().getType(), asString)); return; } catch (Exception e) { throw new AvroRuntimeException("Failed to read Stringable", e); - } + } } LogicalType logicalType = f.schema().getLogicalType(); if (logicalType != null) { diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectDatumWriter.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectDatumWriter.java index 85e3c55c118..fbdb9a5224b 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectDatumWriter.java +++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectDatumWriter.java @@ -51,7 +51,7 @@ public ReflectDatumWriter(Schema root) { public ReflectDatumWriter(Schema root, ReflectData reflectData) { super(root, reflectData); } - + protected ReflectDatumWriter(ReflectData reflectData) { super(reflectData); } @@ -69,7 +69,7 @@ protected void writeArray(Schema schema, Object datum, Encoder out) if (null == elementClass) { // not a Collection or an Array throw new AvroRuntimeException("Array data must be a Collection or Array"); - } + } Schema element = schema.getElementType(); if (elementClass.isPrimitive()) { Schema.Type type = element.getType(); @@ -109,7 +109,7 @@ protected void writeArray(Schema schema, Object datum, Encoder out) out.writeArrayEnd(); } } - + private void writeObjectArray(Schema element, Object[] data, Encoder out) throws IOException { int size = data.length; out.setItemCount(size); @@ -117,12 +117,12 @@ private void writeObjectArray(Schema element, Object[] data, Encoder out) throws this.write(element, data[i], out); } } - + private void arrayError(Class cl, Schema.Type type) { throw new AvroRuntimeException("Error writing array with inner type " + cl + " and avro type: " + type); } - + @Override protected void writeBytes(Object datum, Encoder out) throws IOException { if (datum instanceof byte[]) @@ -176,7 +176,7 @@ protected void writeField(Object record, Field f, Encoder out, Object state) throw new AvroRuntimeException("Failed to write Stringable", e); } return; - } + } } } super.writeField(record, f, out, state); diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectionUtil.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectionUtil.java index 1457cdbfe7c..236de410bd9 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectionUtil.java +++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectionUtil.java @@ -22,10 +22,10 @@ /** * A few utility methods for using @link{java.misc.Unsafe}, mostly for private * use. - * + * * Use of Unsafe on Android is forbidden, as Android provides only a very * limited functionality for this class compared to the JDK version. - * + * */ class ReflectionUtil { diff --git a/lang/java/avro/src/main/java/org/apache/avro/specific/AvroGenerated.java b/lang/java/avro/src/main/java/org/apache/avro/specific/AvroGenerated.java index e57d27e66e5..d04043116fb 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/specific/AvroGenerated.java +++ b/lang/java/avro/src/main/java/org/apache/avro/specific/AvroGenerated.java @@ -23,8 +23,8 @@ import java.lang.annotation.Target; /** - * Indicates that an annotated class is an Avro generated class. All Avro - * generated classes will be annotated with this annotation. + * Indicates that an annotated class is an Avro generated class. All Avro + * generated classes will be annotated with this annotation. */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) diff --git a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java index 647f8235c43..ec2e33f075c 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java +++ b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificData.java @@ -50,7 +50,7 @@ public class SpecificData extends GenericData { private static final SpecificData INSTANCE = new SpecificData(); - + private static final Class[] NO_ARG = new Class[]{}; private static final Class[] SCHEMA_ARG = new Class[]{Schema.class}; private static final Map CTOR_CACHE = @@ -101,7 +101,7 @@ public SpecificData() {} public SpecificData(ClassLoader classLoader) { super(classLoader); } - + @Override public DatumReader createDatumReader(Schema schema) { return new SpecificDatumReader(schema, schema, this); @@ -293,7 +293,7 @@ protected String getSchemaName(Object datum) { return super.getSchemaName(datum); } - /** True iff a class should be serialized with toString(). */ + /** True iff a class should be serialized with toString(). */ protected boolean isStringable(Class c) { return stringableClasses.contains(c); } @@ -324,7 +324,7 @@ protected int compare(Object o1, Object o2, Schema s, boolean eq) { return super.compare(o1, o2, s, eq); } } - + /** Create an instance of a class. If the class implements {@link * SchemaConstructable}, call a constructor with a {@link * org.apache.avro.Schema} parameter, otherwise use a no-arg constructor. */ @@ -345,14 +345,14 @@ public static Object newInstance(Class c, Schema s) { } return result; } - + @Override public Object createFixed(Object old, Schema schema) { Class c = getClass(schema); if (c == null) return super.createFixed(old, schema); // punt to generic return c.isInstance(old) ? old : newInstance(c, schema); } - + @Override public Object newRecord(Object old, Schema schema) { Class c = getClass(schema); diff --git a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumReader.java b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumReader.java index ceffdd657a0..870d16f548c 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumReader.java +++ b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumReader.java @@ -79,7 +79,7 @@ public void setSchema(Schema actual) { case STRING: stringClass = getPropAsClass(schema, SpecificData.CLASS_PROP); break; - case MAP: + case MAP: stringClass = getPropAsClass(schema, SpecificData.KEY_CLASS_PROP); break; } diff --git a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumWriter.java b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumWriter.java index 49dddbbc31c..128b02e9237 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumWriter.java +++ b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumWriter.java @@ -32,19 +32,19 @@ public SpecificDatumWriter() { public SpecificDatumWriter(Class c) { super(SpecificData.get().getSchema(c), SpecificData.get()); } - + public SpecificDatumWriter(Schema schema) { super(schema, SpecificData.get()); } - + public SpecificDatumWriter(Schema root, SpecificData specificData) { super(root, specificData); } - + protected SpecificDatumWriter(SpecificData specificData) { super(specificData); } - + /** Returns the {@link SpecificData} implementation used by this writer. */ public SpecificData getSpecificData() { return (SpecificData) getData(); diff --git a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificErrorBuilderBase.java b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificErrorBuilderBase.java index f95f42c4979..961f030abbb 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificErrorBuilderBase.java +++ b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificErrorBuilderBase.java @@ -23,18 +23,18 @@ import org.apache.avro.data.ErrorBuilder; import org.apache.avro.data.RecordBuilderBase; -/** +/** * Abstract base class for specific ErrorBuilder implementations. * Not thread-safe. */ -abstract public class SpecificErrorBuilderBase +abstract public class SpecificErrorBuilderBase extends RecordBuilderBase implements ErrorBuilder { private Constructor errorConstructor; private Object value; private boolean hasValue; private Throwable cause; private boolean hasCause; - + /** * Creates a SpecificErrorBuilderBase for building errors of the given type. * @param schema the schema associated with the error class. @@ -42,7 +42,7 @@ abstract public class SpecificErrorBuilderBase protected SpecificErrorBuilderBase(Schema schema) { super(schema, SpecificData.get()); } - + /** * SpecificErrorBuilderBase copy constructor. * @param other SpecificErrorBuilderBase instance to copy. @@ -55,19 +55,19 @@ protected SpecificErrorBuilderBase(SpecificErrorBuilderBase other) { this.cause = other.cause; this.hasCause = other.hasCause; } - + /** * Creates a SpecificErrorBuilderBase by copying an existing error instance. * @param other the error instance to copy. */ protected SpecificErrorBuilderBase(T other) { super(other.getSchema(), SpecificData.get()); - + Object otherValue = other.getValue(); if (otherValue != null) { setValue(otherValue); } - + Throwable otherCause = other.getCause(); if (otherCause != null) { setCause(otherCause); @@ -85,12 +85,12 @@ public SpecificErrorBuilderBase setValue(Object value) { hasValue = true; return this; } - + @Override public boolean hasValue() { return hasValue; } - + @Override public SpecificErrorBuilderBase clearValue() { value = null; @@ -109,12 +109,12 @@ public SpecificErrorBuilderBase setCause(Throwable cause) { hasCause = true; return this; } - + @Override public boolean hasCause() { return hasCause; } - + @Override public SpecificErrorBuilderBase clearCause() { cause = null; diff --git a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificExceptionBase.java b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificExceptionBase.java index bf07e30453e..86d0a69be21 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificExceptionBase.java +++ b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificExceptionBase.java @@ -33,7 +33,7 @@ public abstract class SpecificExceptionBase extends AvroRemoteException public SpecificExceptionBase() { super(); } - + public SpecificExceptionBase(Throwable value) { super(value); } @@ -41,7 +41,7 @@ public SpecificExceptionBase(Throwable value) { public SpecificExceptionBase(Object value) { super(value); } - + public SpecificExceptionBase(Object value, Throwable cause) { super(value, cause); } diff --git a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificFixed.java b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificFixed.java index 9ff9093643f..0802b0dc0e3 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificFixed.java +++ b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificFixed.java @@ -35,9 +35,9 @@ public abstract class SpecificFixed public SpecificFixed() { bytes(new byte[getSchema().getFixedSize()]); } - + public SpecificFixed(byte[] bytes) { - bytes(bytes); + bytes(bytes); } public void bytes(byte[] bytes) { this.bytes = bytes; } diff --git a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBase.java b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBase.java index 51ee6538863..77d0928cfbb 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBase.java +++ b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBase.java @@ -51,7 +51,7 @@ public boolean equals(Object that) { if (this.getClass() != that.getClass()) return false; // not same schema return SpecificData.get().compare(this, that, this.getSchema(), true) == 0; } - + @Override public int hashCode() { return SpecificData.get().hashCode(this, this.getSchema()); diff --git a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBuilderBase.java b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBuilderBase.java index d508dce47b2..d157434d2bd 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBuilderBase.java +++ b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBuilderBase.java @@ -24,9 +24,9 @@ * Abstract base class for specific RecordBuilder implementations. * Not thread-safe. */ -abstract public class SpecificRecordBuilderBase +abstract public class SpecificRecordBuilderBase extends RecordBuilderBase { - + /** * Creates a SpecificRecordBuilderBase for building records of the given type. * @param schema the schema associated with the record class. @@ -34,7 +34,7 @@ abstract public class SpecificRecordBuilderBase protected SpecificRecordBuilderBase(Schema schema) { super(schema, SpecificData.get()); } - + /** * SpecificRecordBuilderBase copy constructor. * @param other SpecificRecordBuilderBase instance to copy. @@ -42,7 +42,7 @@ protected SpecificRecordBuilderBase(Schema schema) { protected SpecificRecordBuilderBase(SpecificRecordBuilderBase other) { super(other, SpecificData.get()); } - + /** * Creates a SpecificRecordBuilderBase by copying an existing record instance. * @param other the record instance to copy. diff --git a/lang/java/avro/src/main/java/org/apache/avro/util/ByteBufferOutputStream.java b/lang/java/avro/src/main/java/org/apache/avro/util/ByteBufferOutputStream.java index 2feb699f6a6..498a6d460e6 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/util/ByteBufferOutputStream.java +++ b/lang/java/avro/src/main/java/org/apache/avro/util/ByteBufferOutputStream.java @@ -51,7 +51,7 @@ public void prepend(List lists) { } buffers.addAll(0, lists); } - + /** Append a list of ByteBuffers to this stream. */ public void append(List lists) { for (ByteBuffer buffer: lists) { @@ -59,7 +59,7 @@ public void append(List lists) { } buffers.addAll(lists); } - + public void reset() { buffers = new LinkedList(); buffers.add(ByteBuffer.allocate(BUFFER_SIZE)); diff --git a/lang/java/avro/src/main/java/org/apache/avro/util/Utf8.java b/lang/java/avro/src/main/java/org/apache/avro/util/Utf8.java index 061d160487a..27d11a3167b 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/util/Utf8.java +++ b/lang/java/avro/src/main/java/org/apache/avro/util/Utf8.java @@ -40,7 +40,7 @@ public Utf8(String string) { this.length = bytes.length; this.string = string; } - + public Utf8(Utf8 other) { this.length = other.length; this.bytes = new byte[other.length]; diff --git a/lang/java/avro/src/main/java/org/apache/avro/util/WeakIdentityHashMap.java b/lang/java/avro/src/main/java/org/apache/avro/util/WeakIdentityHashMap.java index d65227c5735..a22708a72ef 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/util/WeakIdentityHashMap.java +++ b/lang/java/avro/src/main/java/org/apache/avro/util/WeakIdentityHashMap.java @@ -31,14 +31,14 @@ * Implements a combination of WeakHashMap and IdentityHashMap. * Useful for caches that need to key off of a == comparison * instead of a .equals. - * + * * * This class is not a general-purpose Map implementation! While * this class implements the Map interface, it intentionally violates * Map's general contract, which mandates the use of the equals method * when comparing objects. This class is designed for use only in the * rare cases wherein reference-equality semantics are required. - * + * * Note that this implementation is not synchronized. * */ @@ -144,7 +144,7 @@ private synchronized void reap() { class IdentityWeakReference extends WeakReference { int hash; - + @SuppressWarnings("unchecked") IdentityWeakReference(Object obj) { super((K)obj, queue); diff --git a/lang/java/avro/src/test/java/org/apache/avro/AvroTestUtil.java b/lang/java/avro/src/test/java/org/apache/avro/AvroTestUtil.java index e920e46326e..c1d2df6036f 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/AvroTestUtil.java +++ b/lang/java/avro/src/test/java/org/apache/avro/AvroTestUtil.java @@ -26,11 +26,11 @@ public class AvroTestUtil { private AvroTestUtil() { } - /** + /** * Create a temporary file in a test-appropriate directory. - * + * * @param testClass The test case class requesting the file creation - * @param name The name of the file to be created + * @param name The name of the file to be created */ public static File tempFile(Class testClass, String name) { File testClassDir = new File(TMPDIR, testClass.getName()); @@ -38,11 +38,11 @@ public static File tempFile(Class testClass, String name) { return new File(testClassDir, name); } - /** + /** * Create a temporary directory in a test-appropriate directory. - * + * * @param testClass The test case class requesting the directory creation - * @param name The name of the directory to be created + * @param name The name of the directory to be created */ public static File tempDirectory(Class testClass, String name) { File tmpFile = tempFile(testClass, name); diff --git a/lang/java/avro/src/test/java/org/apache/avro/FooBarSpecificRecord.java b/lang/java/avro/src/test/java/org/apache/avro/FooBarSpecificRecord.java index d0846f1688e..babcd3622c6 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/FooBarSpecificRecord.java +++ b/lang/java/avro/src/test/java/org/apache/avro/FooBarSpecificRecord.java @@ -1,6 +1,6 @@ /** * Autogenerated by Avro - * + * * DO NOT EDIT DIRECTLY * * Licensed to the Apache Software Foundation (ASF) under one @@ -19,7 +19,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.avro; +package org.apache.avro; @SuppressWarnings("all") @org.apache.avro.specific.AvroGenerated public class FooBarSpecificRecord extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { @@ -35,7 +35,7 @@ public class FooBarSpecificRecord extends org.apache.avro.specific.SpecificRecor /** * Default constructor. Note that this does not initialize fields * to their default values from the schema. If that is desired then - * one should use newBuilder(). + * one should use newBuilder(). */ public FooBarSpecificRecord() {} @@ -51,7 +51,7 @@ public FooBarSpecificRecord(java.lang.Integer id, java.lang.String name, java.ut } public org.apache.avro.Schema getSchema() { return SCHEMA$; } - // Used by DatumWriter. Applications should not call. + // Used by DatumWriter. Applications should not call. public java.lang.Object get(int field$) { switch (field$) { case 0: return id; @@ -62,7 +62,7 @@ public java.lang.Object get(int field$) { default: throw new org.apache.avro.AvroRuntimeException("Bad index"); } } - // Used by DatumReader. Applications should not call. + // Used by DatumReader. Applications should not call. @SuppressWarnings(value="unchecked") public void put(int field$, java.lang.Object value$) { switch (field$) { @@ -154,17 +154,17 @@ public void setTypeEnum(org.apache.avro.TypeEnum value) { public static org.apache.avro.FooBarSpecificRecord.Builder newBuilder() { return new org.apache.avro.FooBarSpecificRecord.Builder(); } - + /** Creates a new FooBarSpecificRecord RecordBuilder by copying an existing Builder */ public static org.apache.avro.FooBarSpecificRecord.Builder newBuilder(org.apache.avro.FooBarSpecificRecord.Builder other) { return new org.apache.avro.FooBarSpecificRecord.Builder(other); } - + /** Creates a new FooBarSpecificRecord RecordBuilder by copying an existing FooBarSpecificRecord instance */ public static org.apache.avro.FooBarSpecificRecord.Builder newBuilder(org.apache.avro.FooBarSpecificRecord other) { return new org.apache.avro.FooBarSpecificRecord.Builder(other); } - + /** * RecordBuilder for FooBarSpecificRecord instances. */ @@ -181,7 +181,7 @@ public static class Builder extends org.apache.avro.specific.SpecificRecordBuild private Builder() { super(org.apache.avro.FooBarSpecificRecord.SCHEMA$); } - + /** Creates a Builder by copying an existing Builder */ private Builder(org.apache.avro.FooBarSpecificRecord.Builder other) { super(other); @@ -206,7 +206,7 @@ private Builder(org.apache.avro.FooBarSpecificRecord.Builder other) { fieldSetFlags()[4] = true; } } - + /** Creates a Builder by copying an existing FooBarSpecificRecord instance */ private Builder(org.apache.avro.FooBarSpecificRecord other) { super(org.apache.avro.FooBarSpecificRecord.SCHEMA$); @@ -236,20 +236,20 @@ private Builder(org.apache.avro.FooBarSpecificRecord other) { public java.lang.Integer getId() { return id; } - + /** Sets the value of the 'id' field */ public org.apache.avro.FooBarSpecificRecord.Builder setId(int value) { validate(fields()[0], value); this.id = value; fieldSetFlags()[0] = true; - return this; + return this; } - + /** Checks whether the 'id' field has been set */ public boolean hasId() { return fieldSetFlags()[0]; } - + /** Clears the value of the 'id' field */ public org.apache.avro.FooBarSpecificRecord.Builder clearId() { fieldSetFlags()[0] = false; @@ -260,20 +260,20 @@ public org.apache.avro.FooBarSpecificRecord.Builder clearId() { public java.lang.String getName() { return name; } - + /** Sets the value of the 'name' field */ public org.apache.avro.FooBarSpecificRecord.Builder setName(java.lang.String value) { validate(fields()[1], value); this.name = value; fieldSetFlags()[1] = true; - return this; + return this; } - + /** Checks whether the 'name' field has been set */ public boolean hasName() { return fieldSetFlags()[1]; } - + /** Clears the value of the 'name' field */ public org.apache.avro.FooBarSpecificRecord.Builder clearName() { name = null; @@ -285,20 +285,20 @@ public org.apache.avro.FooBarSpecificRecord.Builder clearName() { public java.util.List getNicknames() { return nicknames; } - + /** Sets the value of the 'nicknames' field */ public org.apache.avro.FooBarSpecificRecord.Builder setNicknames(java.util.List value) { validate(fields()[2], value); this.nicknames = value; fieldSetFlags()[2] = true; - return this; + return this; } - + /** Checks whether the 'nicknames' field has been set */ public boolean hasNicknames() { return fieldSetFlags()[2]; } - + /** Clears the value of the 'nicknames' field */ public org.apache.avro.FooBarSpecificRecord.Builder clearNicknames() { nicknames = null; @@ -310,20 +310,20 @@ public org.apache.avro.FooBarSpecificRecord.Builder clearNicknames() { public java.util.List getRelatedids() { return relatedids; } - + /** Sets the value of the 'relatedids' field */ public org.apache.avro.FooBarSpecificRecord.Builder setRelatedids(java.util.List value) { validate(fields()[3], value); this.relatedids = value; fieldSetFlags()[3] = true; - return this; + return this; } - + /** Checks whether the 'relatedids' field has been set */ public boolean hasRelatedids() { return fieldSetFlags()[3]; } - + /** Clears the value of the 'relatedids' field */ public org.apache.avro.FooBarSpecificRecord.Builder clearRelatedids() { relatedids = null; @@ -335,20 +335,20 @@ public org.apache.avro.FooBarSpecificRecord.Builder clearRelatedids() { public org.apache.avro.TypeEnum getTypeEnum() { return typeEnum; } - + /** Sets the value of the 'typeEnum' field */ public org.apache.avro.FooBarSpecificRecord.Builder setTypeEnum(org.apache.avro.TypeEnum value) { validate(fields()[4], value); this.typeEnum = value; fieldSetFlags()[4] = true; - return this; + return this; } - + /** Checks whether the 'typeEnum' field has been set */ public boolean hasTypeEnum() { return fieldSetFlags()[4]; } - + /** Clears the value of the 'typeEnum' field */ public org.apache.avro.FooBarSpecificRecord.Builder clearTypeEnum() { typeEnum = null; @@ -373,7 +373,7 @@ public FooBarSpecificRecord build() { } private static final org.apache.avro.io.DatumWriter - WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$); + WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$); @Override public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException { @@ -381,7 +381,7 @@ public FooBarSpecificRecord build() { } private static final org.apache.avro.io.DatumReader - READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$); + READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$); @Override public void readExternal(java.io.ObjectInput in) throws java.io.IOException { diff --git a/lang/java/avro/src/test/java/org/apache/avro/GenerateBlockingData.java b/lang/java/avro/src/test/java/org/apache/avro/GenerateBlockingData.java index 72a632be075..1e9f89507c4 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/GenerateBlockingData.java +++ b/lang/java/avro/src/test/java/org/apache/avro/GenerateBlockingData.java @@ -39,7 +39,7 @@ public class GenerateBlockingData { private static final int SYNC_INTERVAL = 1000; private static ByteArrayOutputStream buffer = new ByteArrayOutputStream(2*SYNC_INTERVAL); - + private static EncoderFactory factory = EncoderFactory.get(); private static Encoder bufOut = EncoderFactory.get().blockingBinaryEncoder( buffer, null); @@ -53,24 +53,24 @@ private static void writeBlock(Encoder vout, FileOutputStream out) buffer.reset(); blockCount = 0; } - + public static void main(String[] args) throws Exception { if(args.length != 3) { System.out.println( "Usage: GenerateBlockingData "); System.exit(-1); } - + Schema sch = Schema.parse(new File(args[0])); File outputFile = new File(args[1]); int numObjects = Integer.parseInt(args[2]); - + FileOutputStream out = new FileOutputStream(outputFile, false); DatumWriter dout = new GenericDatumWriter(); dout.setSchema(sch); Encoder vout = factory.directBinaryEncoder(out, null); vout.writeLong(numObjects); // metadata:the count of objects in the file - + for (Object datum : new RandomData(sch, numObjects)) { dout.write(datum, bufOut); blockCount++; diff --git a/lang/java/avro/src/test/java/org/apache/avro/RandomData.java b/lang/java/avro/src/test/java/org/apache/avro/RandomData.java index c92a9806285..2dad5187cbe 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/RandomData.java +++ b/lang/java/avro/src/test/java/org/apache/avro/RandomData.java @@ -48,7 +48,7 @@ public RandomData(Schema schema, int count, long seed) { this.seed = seed; this.count = count; } - + public Iterator iterator() { return new Iterator() { private int n; @@ -61,7 +61,7 @@ public Object next() { public void remove() { throw new UnsupportedOperationException(); } }; } - + @SuppressWarnings(value="unchecked") private static Object generate(Schema schema, Random random, int d) { switch (schema.getType()) { diff --git a/lang/java/avro/src/test/java/org/apache/avro/TestDataFile.java b/lang/java/avro/src/test/java/org/apache/avro/TestDataFile.java index 21c99d83b53..e0674964cf2 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/TestDataFile.java +++ b/lang/java/avro/src/test/java/org/apache/avro/TestDataFile.java @@ -252,7 +252,7 @@ public void testGenericAppend() throws IOException { } finally { reader.close(); } - } + } public void testReadWithHeader() throws IOException { File file = makeFile(); diff --git a/lang/java/avro/src/test/java/org/apache/avro/TestDataFileConcat.java b/lang/java/avro/src/test/java/org/apache/avro/TestDataFileConcat.java index e80685712ae..b30c7b18908 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/TestDataFileConcat.java +++ b/lang/java/avro/src/test/java/org/apache/avro/TestDataFileConcat.java @@ -48,7 +48,7 @@ public TestDataFileConcat(CodecFactory codec, CodecFactory codec2, Boolean recom this.codec = codec; this.codec2 = codec2; this.recompress = recompress; - LOG.info("Testing concatenating files, " + codec2 + " into " + codec + + LOG.info("Testing concatenating files, " + codec2 + " into " + codec + " with recompress=" + recompress); } @@ -134,7 +134,7 @@ public void testConcatenateFiles() throws IOException { } finally { writer2.close(); } - DataFileWriter concatinto = + DataFileWriter concatinto = new DataFileWriter(new GenericDatumWriter()) .setSyncInterval(syncInterval); concatinto.appendTo(file1); @@ -180,5 +180,5 @@ public void testConcatenateFiles() throws IOException { } } - + } diff --git a/lang/java/avro/src/test/java/org/apache/avro/TestDataFileCustomSync.java b/lang/java/avro/src/test/java/org/apache/avro/TestDataFileCustomSync.java index 9270e8c8ec0..e3f37912453 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/TestDataFileCustomSync.java +++ b/lang/java/avro/src/test/java/org/apache/avro/TestDataFileCustomSync.java @@ -64,7 +64,7 @@ private static byte[] generateSync() { } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } - } + } @Test(expected = IOException.class) public void testInvalidSync() throws IOException { diff --git a/lang/java/avro/src/test/java/org/apache/avro/TestProtocol.java b/lang/java/avro/src/test/java/org/apache/avro/TestProtocol.java index 007c273d6e6..295ee38b920 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/TestProtocol.java +++ b/lang/java/avro/src/test/java/org/apache/avro/TestProtocol.java @@ -32,19 +32,19 @@ public class TestProtocol { p2.addProp("a","2"); assertFalse(p1.equals(p2)); } - + @Test public void testSplitProtocolBuild() { Protocol p = new Protocol("P", null, "foo"); p.addProp("property", "some value"); - + String protocolString = p.toString(); final int mid = protocolString.length() / 2; String[] parts = { protocolString.substring(0, mid), protocolString.substring(mid), - }; - + }; + Protocol parsedStringProtocol = org.apache.avro.Protocol.parse(protocolString); Protocol parsedArrayOfStringProtocol = org.apache.avro.Protocol.parse(protocolString.substring(0, mid), diff --git a/lang/java/avro/src/test/java/org/apache/avro/TestSchema.java b/lang/java/avro/src/test/java/org/apache/avro/TestSchema.java index ba2cab49d72..242ee8ca092 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/TestSchema.java +++ b/lang/java/avro/src/test/java/org/apache/avro/TestSchema.java @@ -29,7 +29,7 @@ import org.apache.avro.Schema.Type; import org.junit.Test; -public class TestSchema { +public class TestSchema { @Test public void testSplitSchemaBuild() { Schema s = SchemaBuilder @@ -38,10 +38,10 @@ public void testSplitSchemaBuild() { .name("clientProtocol").type().optional().stringType() .name("meta").type().optional().map().values().bytesType() .endRecord(); - + String schemaString = s.toString(); final int mid = schemaString.length() / 2; - + Schema parsedStringSchema = new org.apache.avro.Schema.Parser().parse(s.toString()); Schema parsedArrayOfStringSchema = new org.apache.avro.Schema.Parser().parse diff --git a/lang/java/avro/src/test/java/org/apache/avro/TestSchemaBuilder.java b/lang/java/avro/src/test/java/org/apache/avro/TestSchemaBuilder.java index 58a1a6f5493..70dc1e52e23 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/TestSchemaBuilder.java +++ b/lang/java/avro/src/test/java/org/apache/avro/TestSchemaBuilder.java @@ -72,13 +72,13 @@ public void testRecord() { Assert.assertEquals(new Schema.Field("f2", optional, null, true), fields.get(2)); } - + @Test public void testDoc() { Schema s = SchemaBuilder.fixed("myfixed").doc("mydoc").size(1); Assert.assertEquals("mydoc", s.getDoc()); } - + @Test public void testProps() { Schema s = SchemaBuilder.builder().intBuilder() @@ -113,7 +113,7 @@ public void testNamespaces() { .fields() .name("myint").type().intType().noDefault() .endRecord(); - + Assert.assertEquals("myrecord", s1.getName()); Assert.assertEquals("myrecord", s2.getName()); Assert.assertEquals("myrecord", s3.getName()); @@ -137,7 +137,7 @@ public void testMissingRecordName() { .name("f0").type().stringType().noDefault() .endRecord(); } - + @Test public void testBoolean() { Schema.Type type = Schema.Type.BOOLEAN; @@ -147,7 +147,7 @@ public void testBoolean() { .booleanBuilder().prop("p", "v").endBoolean(); Assert.assertEquals(expected, built1); } - + @Test public void testInt() { Schema.Type type = Schema.Type.INT; @@ -157,7 +157,7 @@ public void testInt() { .intBuilder().prop("p", "v").endInt(); Assert.assertEquals(expected, built1); } - + @Test public void testLong() { Schema.Type type = Schema.Type.LONG; @@ -167,7 +167,7 @@ public void testLong() { .longBuilder().prop("p", "v").endLong(); Assert.assertEquals(expected, built1); } - + @Test public void testFloat() { Schema.Type type = Schema.Type.FLOAT; @@ -177,7 +177,7 @@ public void testFloat() { .floatBuilder().prop("p", "v").endFloat(); Assert.assertEquals(expected, built1); } - + @Test public void testDuble() { Schema.Type type = Schema.Type.DOUBLE; @@ -187,7 +187,7 @@ public void testDuble() { .doubleBuilder().prop("p", "v").endDouble(); Assert.assertEquals(expected, built1); } - + @Test public void testString() { Schema.Type type = Schema.Type.STRING; @@ -197,7 +197,7 @@ public void testString() { .stringBuilder().prop("p", "v").endString(); Assert.assertEquals(expected, built1); } - + @Test public void testBytes() { Schema.Type type = Schema.Type.BYTES; @@ -207,7 +207,7 @@ public void testBytes() { .bytesBuilder().prop("p", "v").endBytes(); Assert.assertEquals(expected, built1); } - + @Test public void testNull() { Schema.Type type = Schema.Type.NULL; @@ -218,7 +218,7 @@ public void testNull() { Assert.assertEquals(expected, built1); } - + private Schema primitive(Schema.Type type, Schema bare) { // test creation of bare schema by name Schema bareByName = SchemaBuilder.builder().type(type.getName()); @@ -229,7 +229,7 @@ private Schema primitive(Schema.Type type, Schema bare) { p.addProp("p", "v"); return p; } - + // @Test // public void testError() { @@ -328,16 +328,16 @@ public void testUnionAndNullable() { types.add(Schema.create(Schema.Type.LONG)); types.add(Schema.create(Schema.Type.NULL)); Schema expected = Schema.createUnion(types); - + Schema schema = SchemaBuilder.unionOf() .longType().and() .nullType().endUnion(); Assert.assertEquals(expected, schema); - + schema = SchemaBuilder.nullable().longType(); Assert.assertEquals(expected, schema); } - + @Test public void testFields() { Schema rec = SchemaBuilder.record("Rec").fields() @@ -353,7 +353,7 @@ public void testFields() { Assert.assertEquals(Order.IGNORE, rec.getField("ignored").order()); Assert.assertTrue(rec.getField("aliased").aliases().contains("anAlias")); } - + @Test public void testFieldShortcuts() { Schema full = SchemaBuilder.record("Blah").fields() @@ -379,7 +379,7 @@ public void testFieldShortcuts() { .name("obytes").type().optional().bytesType() .name("nbytes").type().nullable().bytesType().bytesDefault(new byte[] {1,2,3}) .endRecord(); - + Schema shortcut = SchemaBuilder.record("Blah").fields() .requiredBoolean("rbool") .optionalBoolean("obool") @@ -403,10 +403,10 @@ public void testFieldShortcuts() { .optionalBytes("obytes") .nullableBytes("nbytes", new byte[] {1,2,3}) .endRecord(); - + Assert.assertEquals(full, shortcut); } - + @Test public void testNames() { // no contextual namespace @@ -425,11 +425,11 @@ public void testNames() { checkField(r, expected, "f3"); checkField(r, expected, "f4"); checkField(r, expected, "f5"); - + // context namespace Schema f = SchemaBuilder.builder("").fixed("Foo").size(1); Assert.assertEquals(Schema.createFixed("Foo", null, null, 1), f); - + // context namespace from record matches r = SchemaBuilder.record("Rec").namespace("org.foo").fields() .name("f0").type().fixed("MyFixed").size(1).noDefault() @@ -465,7 +465,7 @@ public void testNames() { checkField(r, expected, "f3"); checkField(r, expected, "f4"); checkField(r, expected, "f5"); - + // context namespace from record, nested has no namespace expected = Schema.createFixed("MyFixed", null, null, 1); r = SchemaBuilder.record("Rec").namespace("org.rec").fields() @@ -474,18 +474,18 @@ public void testNames() { .endRecord(); checkField(r, expected, "f0"); checkField(r, expected, "f1"); - + // mimic names of primitives, but with a namesapce. This is OK SchemaBuilder.fixed("org.test.long").size(1); SchemaBuilder.fixed("long").namespace("org.test").size(1); SchemaBuilder.builder("org.test").fixed("long").size(1); } - + private void checkField(Schema r, Schema expected, String name) { Assert.assertEquals(expected, r.getField(name).schema()); } - + @Test(expected=SchemaParseException.class) public void testNamesFailRedefined() { SchemaBuilder.record("Rec").fields() @@ -498,12 +498,12 @@ public void testNamesFailRedefined() { public void testNamesFailAbsent() { SchemaBuilder.builder().type("notdefined"); } - + @Test(expected=AvroTypeException.class) public void testNameReserved() { SchemaBuilder.fixed("long").namespace("").size(1); } - + @Test public void testFieldTypesAndDefaultValues() { byte[] bytedef = new byte[]{3}; @@ -513,21 +513,21 @@ public void testFieldTypesAndDefaultValues() { mapdef.put("a", "A"); ArrayList arrdef = new ArrayList(); arrdef.add("arr"); - + Schema rec = SchemaBuilder.record("inner").fields() .name("f").type().intType().noDefault() .endRecord(); - + Schema rec2 = SchemaBuilder.record("inner2").fields() .name("f2").type().intType().noDefault() .endRecord(); - - GenericData.Record recdef = + + GenericData.Record recdef = new GenericRecordBuilder(rec).set("f", 1).build(); - + GenericData.Record recdef2 = new GenericRecordBuilder(rec2).set("f2", 2).build(); - + Schema r = SchemaBuilder.record("r").fields() .name("boolF").type().booleanType().booleanDefault(false) .name("intF").type().intType().intDefault(1) @@ -580,10 +580,10 @@ public void testFieldTypesAndDefaultValues() { .name("f2").type().intType().noDefault() .endRecord().and().intType().endUnion().recordDefault(recdef2) .endRecord(); - + GenericData.Record newRec = new GenericRecordBuilder(r).build(); - + Assert.assertEquals(false, newRec.get("boolF")); Assert.assertEquals(false, newRec.get("boolU")); Assert.assertEquals(1, newRec.get("intF")); @@ -602,18 +602,18 @@ public void testFieldTypesAndDefaultValues() { Assert.assertEquals(bufdef, newRec.get("bytesU")); Assert.assertNull(newRec.get("nullF")); Assert.assertNull(newRec.get("nullU")); - Assert.assertArrayEquals(bytedef, + Assert.assertArrayEquals(bytedef, ((GenericData.Fixed)newRec.get("fixedF1")).bytes()); - Assert.assertArrayEquals(bytedef, + Assert.assertArrayEquals(bytedef, ((GenericData.Fixed)newRec.get("fixedF2")).bytes()); - Assert.assertArrayEquals(bytedef, + Assert.assertArrayEquals(bytedef, ((GenericData.Fixed)newRec.get("fixedF3")).bytes()); - Assert.assertArrayEquals(bytedef, + Assert.assertArrayEquals(bytedef, ((GenericData.Fixed)newRec.get("fixedU")).bytes()); Assert.assertEquals("S", newRec.get("enumF").toString()); Assert.assertEquals("SS", newRec.get("enumU").toString()); @SuppressWarnings("unchecked") - Map map = + Map map = (Map) newRec.get("mapF"); Assert.assertEquals(mapdef.size(), map.size()); for(Map.Entry e : map.entrySet()) { @@ -622,7 +622,7 @@ public void testFieldTypesAndDefaultValues() { } Assert.assertEquals(newRec.get("mapF"), newRec.get("mapU")); @SuppressWarnings("unchecked") - GenericData.Array arr = + GenericData.Array arr = (GenericData.Array) newRec.get("arrayF"); Assert.assertEquals(arrdef.size(), arr.size()); for(CharSequence c : arr) { @@ -633,15 +633,15 @@ public void testFieldTypesAndDefaultValues() { Assert.assertEquals(recdef2, newRec.get("recordU")); Assert.assertEquals("S", newRec.get("byName").toString()); } - + @Test(expected=SchemaBuilderException.class) public void testBadDefault() { SchemaBuilder.record("r").fields() .name("f").type(Schema.create(Schema.Type.INT)).withDefault(new Object()) .endRecord(); } - - @Test + + @Test public void testUnionFieldBuild() { SchemaBuilder.record("r").fields() .name("allUnion").type().unionOf() diff --git a/lang/java/avro/src/test/java/org/apache/avro/TestSchemaNormalization.java b/lang/java/avro/src/test/java/org/apache/avro/TestSchemaNormalization.java index f8c04130d89..cb8a6d7d645 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/TestSchemaNormalization.java +++ b/lang/java/avro/src/test/java/org/apache/avro/TestSchemaNormalization.java @@ -111,7 +111,7 @@ public static long altFingerprint(String s) { s.getBytes("UTF-8")); return altExtend(SchemaNormalization.EMPTY64, 64, tmp, POSTFIX); } catch (java.io.UnsupportedEncodingException e) - { throw new RuntimeException(e); } + { throw new RuntimeException(e); } } private static long altExtend(long poly, int degree, long fp, byte[] b) { diff --git a/lang/java/avro/src/test/java/org/apache/avro/TypeEnum.java b/lang/java/avro/src/test/java/org/apache/avro/TypeEnum.java index 3cff7fe7964..de91bb3d050 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/TypeEnum.java +++ b/lang/java/avro/src/test/java/org/apache/avro/TypeEnum.java @@ -1,6 +1,6 @@ /** * Autogenerated by Avro - * + * * DO NOT EDIT DIRECTLY * * Licensed to the Apache Software Foundation (ASF) under one @@ -19,10 +19,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.avro; +package org.apache.avro; @SuppressWarnings("all") @org.apache.avro.specific.AvroGenerated -public enum TypeEnum { +public enum TypeEnum { a, b, c ; public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"enum\",\"name\":\"TypeEnum\",\"namespace\":\"org.apache.avro\",\"symbols\":[\"a\",\"b\",\"c\"]}"); public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } diff --git a/lang/java/avro/src/test/java/org/apache/avro/data/RecordBuilderBaseTest.java b/lang/java/avro/src/test/java/org/apache/avro/data/RecordBuilderBaseTest.java index c3f236add7c..0a47e73ab5a 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/data/RecordBuilderBaseTest.java +++ b/lang/java/avro/src/test/java/org/apache/avro/data/RecordBuilderBaseTest.java @@ -34,57 +34,57 @@ public class RecordBuilderBaseTest { private static Set primitives; private static Set nonNullPrimitives; - + @BeforeClass() public static void setUpBeforeClass() { primitives = new HashSet(Arrays.asList(Type.values())); - primitives.removeAll(Arrays.asList(new Type[] { - Type.RECORD, Type.ENUM, Type.ARRAY, Type.MAP, Type.UNION, Type.FIXED + primitives.removeAll(Arrays.asList(new Type[] { + Type.RECORD, Type.ENUM, Type.ARRAY, Type.MAP, Type.UNION, Type.FIXED })); - + nonNullPrimitives = new HashSet(primitives); nonNullPrimitives.remove(Type.NULL); } - + @Test - public void testIsValidValueWithPrimitives() { + public void testIsValidValueWithPrimitives() { // Verify that a non-null value is valid for all primitives: for (Type type : primitives) { Field f = new Field("f", Schema.create(type), null, null); Assert.assertTrue(RecordBuilderBase.isValidValue(f, new Object())); } - + // Verify that null is not valid for all non-null primitives: for (Type type : nonNullPrimitives) { Field f = new Field("f", Schema.create(type), null, null); Assert.assertFalse(RecordBuilderBase.isValidValue(f, null)); } } - + @Test public void testIsValidValueWithNullField() { // Verify that null is a valid value for null fields: Assert.assertTrue(RecordBuilderBase.isValidValue( new Field("f", Schema.create(Type.NULL), null, null), null)); } - + @Test public void testIsValidValueWithUnion() { // Verify that null values are not valid for a union with no null type: - Schema unionWithoutNull = Schema.createUnion(Arrays.asList(new Schema[] { + Schema unionWithoutNull = Schema.createUnion(Arrays.asList(new Schema[] { Schema.create(Type.STRING), Schema.create(Type.BOOLEAN) })); - + Assert.assertTrue(RecordBuilderBase.isValidValue( new Field("f", unionWithoutNull, null, null), new Object())); Assert.assertFalse(RecordBuilderBase.isValidValue( new Field("f", unionWithoutNull, null, null), null)); - + // Verify that null values are valid for a union with a null type: - Schema unionWithNull = Schema.createUnion(Arrays.asList(new Schema[] { + Schema unionWithNull = Schema.createUnion(Arrays.asList(new Schema[] { Schema.create(Type.STRING), Schema.create(Type.NULL) })); - + Assert.assertTrue(RecordBuilderBase.isValidValue( new Field("f", unionWithNull, null, null), new Object())); Assert.assertTrue(RecordBuilderBase.isValidValue( diff --git a/lang/java/avro/src/test/java/org/apache/avro/file/TestBZip2Codec.java b/lang/java/avro/src/test/java/org/apache/avro/file/TestBZip2Codec.java index febcaef89e7..2a9cad2cff9 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/file/TestBZip2Codec.java +++ b/lang/java/avro/src/test/java/org/apache/avro/file/TestBZip2Codec.java @@ -24,39 +24,39 @@ import static org.junit.Assert.assertTrue; public class TestBZip2Codec { - + @Test public void testBZip2CompressionAndDecompression() throws IOException { Codec codec = CodecFactory.fromString("bzip2").createInstance(); assertTrue(codec instanceof BZip2Codec); assertTrue(codec.getName().equals("bzip2")); - + //This is 3 times the byte buffer on the BZip2 decompress plus some extra final int inputByteSize = BZip2Codec.DEFAULT_BUFFER_SIZE * 3 + 42; - + byte[] inputByteArray = new byte[inputByteSize]; - + //Generate something that will compress well for (int i = 0; i < inputByteSize; i++) { inputByteArray[i] = (byte)(65 + i % 10); } - + ByteBuffer inputByteBuffer = ByteBuffer.allocate(inputByteSize * 2); inputByteBuffer.put(inputByteArray); - + ByteBuffer compressedBuffer = codec.compress(inputByteBuffer); - + //Make sure something returned assertTrue(compressedBuffer.array().length > 0); //Make sure the compressed output is smaller then the original assertTrue(compressedBuffer.array().length < inputByteArray.length); - + ByteBuffer decompressedBuffer = codec.decompress(compressedBuffer); - + //The original array should be the same length as the decompressed array assertTrue(decompressedBuffer.array().length == inputByteArray.length); - - //Every byte in the outputByteArray should equal every byte in the input array + + //Every byte in the outputByteArray should equal every byte in the input array byte[] outputByteArray = decompressedBuffer.array(); for (int i = 0; i < inputByteSize; i++) { inputByteArray[i] = outputByteArray[i]; diff --git a/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericData.java b/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericData.java index b8b59e244c7..7b33971cfcd 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericData.java +++ b/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericData.java @@ -47,12 +47,12 @@ import org.junit.Test; public class TestGenericData { - + @Test(expected=AvroRuntimeException.class) public void testrecordConstructorNullSchema() throws Exception { new GenericData.Record(null); } - + @Test(expected=AvroRuntimeException.class) public void testrecordConstructorWrongSchema() throws Exception { new GenericData.Record(Schema.create(Schema.Type.INT)); @@ -62,7 +62,7 @@ public void testrecordConstructorWrongSchema() throws Exception { public void testArrayConstructorNullSchema() throws Exception { new GenericData.Array(1, null); } - + @Test(expected=AvroRuntimeException.class) public void testArrayConstructorWrongSchema() throws Exception { new GenericData.Array(1, Schema.create(Schema.Type.INT)); @@ -95,7 +95,7 @@ public void testRecordPutInvalidField() throws Exception { Record r = new GenericData.Record(s); r.put("invalidFieldName", "someValue"); } - + @Test /** Make sure that even with nulls, hashCode() doesn't throw NPE. */ public void testHashCode() { @@ -109,7 +109,7 @@ public void testHashCode() { r.put(0, stuff); GenericData.get().hashCode(r, schema); } - + @Test public void testEquals() { Schema s = recordSchema(); @@ -118,7 +118,7 @@ public void testEquals() { GenericRecord r2 = new GenericData.Record(s); Collection l0 = new ArrayDeque(); List l1 = new ArrayList(); - GenericArray l2 = + GenericArray l2 = new GenericData.Array(1,s.getFields().get(0).schema()); String foo = "foo"; l0.add(new StringBuffer(foo)); @@ -131,13 +131,13 @@ public void testEquals() { assertEquals(r0, r2); assertEquals(r1, r2); } - + private Schema recordSchema() { List fields = new ArrayList(); fields.add(new Field("anArray", Schema.createArray(Schema.create(Type.STRING)), null, null)); Schema schema = Schema.createRecord("arrayFoo", "test", "mytest", false); schema.setFields(fields); - + return schema; } @@ -172,7 +172,7 @@ public void testRecordGetFieldDoesntExist() throws Exception { GenericData.Record record = new GenericData.Record(schema); assertNull(record.get("does not exist")); } - + @Test public void testArrayReversal() { Schema schema = Schema.createArray(Schema.create(Schema.Type.INT)); @@ -236,8 +236,8 @@ public void testArrayAddAtLocation() assertEquals(new Integer(6), array.get(0)); assertEquals(8, array.size()); try { - array.get(9); - fail("Expected IndexOutOfBoundsException after adding elements"); + array.get(9); + fail("Expected IndexOutOfBoundsException after adding elements"); } catch (IndexOutOfBoundsException e){} } @Test @@ -297,24 +297,24 @@ public void testArraySet() assertEquals(10, array.size()); assertEquals(new Integer(55), array.get(5)); } - + @Test public void testToStringIsJson() throws JsonParseException, IOException { Field stringField = new Field("string", Schema.create(Type.STRING), null, null); Field enumField = new Field("enum", Schema.createEnum("my_enum", "doc", null, Arrays.asList("a", "b", "c")), null, null); Schema schema = Schema.createRecord("my_record", "doc", "mytest", false); schema.setFields(Arrays.asList(stringField, enumField)); - + GenericRecord r = new GenericData.Record(schema); // \u2013 is EN DASH r.put(stringField.name(), "hello\nthere\"\tyou\u2013}"); r.put(enumField.name(), new GenericData.EnumSymbol(enumField.schema(),"a")); - + String json = r.toString(); JsonFactory factory = new JsonFactory(); JsonParser parser = factory.createJsonParser(json); ObjectMapper mapper = new ObjectMapper(); - + // will throw exception if string is not parsable json mapper.readTree(parser); } @@ -356,7 +356,7 @@ public void testCompare() { fields.add(integerField); Schema record = Schema.createRecord("test", null, null, false); record.setFields(fields); - + ByteArrayOutputStream b1 = new ByteArrayOutputStream(5); ByteArrayOutputStream b2 = new ByteArrayOutputStream(5); BinaryEncoder b1Enc = EncoderFactory.get().binaryEncoder(b1, null); @@ -389,7 +389,7 @@ public void testCompare() { fail("IOException while writing records to output stream."); } } - + @Test public void testEnumCompare() { Schema s = Schema.createEnum("Kind",null,null,Arrays.asList("Z","Y","X")); @@ -410,10 +410,10 @@ public void testByteBufferDeepCopy() { Field byte_field = new Field("bytes", Schema.create(Type.BYTES), null, null); schema.setFields(Arrays.asList(byte_field)); - + GenericRecord record = new GenericData.Record(schema); record.put(byte_field.name(), buffer); - + GenericRecord copy = GenericData.get().deepCopy(schema, record); ByteBuffer buffer_copy = (ByteBuffer) copy.get(byte_field.name()); @@ -461,7 +461,7 @@ private enum anEnum { ONE,TWO,THREE }; public void validateRequiresGenericSymbolForEnumSchema() { final Schema schema = Schema.createEnum("my_enum", "doc", "namespace", Arrays.asList("ONE","TWO","THREE")); final GenericData gd = GenericData.get(); - + /* positive cases */ assertTrue(gd.validate(schema, new GenericData.EnumSymbol(schema, "ONE"))); assertTrue(gd.validate(schema, new GenericData.EnumSymbol(schema, anEnum.ONE))); diff --git a/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericDatumWriter.java b/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericDatumWriter.java index ed528748e55..f93a326c4dc 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericDatumWriter.java +++ b/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericDatumWriter.java @@ -61,7 +61,7 @@ public void testWrite() throws IOException { Encoder e = EncoderFactory.get().jsonEncoder(s, bao); w.write(r, e); e.flush(); - + Object o = new GenericDatumReader(s).read(null, DecoderFactory.get().jsonDecoder(s, new ByteArrayInputStream(bao.toByteArray()))); assertEquals(r, o); @@ -81,7 +81,7 @@ public void testArrayConcurrentModification() throws Exception { final TestEncoder e = new TestEncoder(EncoderFactory.get() .directBinaryEncoder(bao, null), sizeWrittenSignal, eltAddedSignal); - + // call write in another thread ExecutorService executor = Executors.newSingleThreadExecutor(); Future result = executor.submit(new Callable() { @@ -103,7 +103,7 @@ public Void call() throws Exception { assertTrue(ex.getCause() instanceof ConcurrentModificationException); } } - + @Test public void testMapConcurrentModification() throws Exception { @@ -119,7 +119,7 @@ public void testMapConcurrentModification() throws Exception { final TestEncoder e = new TestEncoder(EncoderFactory.get() .directBinaryEncoder(bao, null), sizeWrittenSignal, eltAddedSignal); - + // call write in another thread ExecutorService executor = Executors.newSingleThreadExecutor(); Future result = executor.submit(new Callable() { @@ -141,20 +141,20 @@ public Void call() throws Exception { assertTrue(ex.getCause() instanceof ConcurrentModificationException); } } - + static class TestEncoder extends Encoder { - + Encoder e; CountDownLatch sizeWrittenSignal; CountDownLatch eltAddedSignal; - + TestEncoder(Encoder encoder, CountDownLatch sizeWrittenSignal, CountDownLatch eltAddedSignal) { this.e = encoder; this.sizeWrittenSignal = sizeWrittenSignal; this.eltAddedSignal = eltAddedSignal; } - + @Override public void writeArrayStart() throws IOException { e.writeArrayStart(); @@ -176,7 +176,7 @@ public void writeMapStart() throws IOException { // ignore } } - + @Override public void flush() throws IOException { e.flush(); } @Override diff --git a/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericRecordBuilder.java b/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericRecordBuilder.java index 8f7dee55294..cc641f78318 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericRecordBuilder.java +++ b/lang/java/avro/src/test/java/org/apache/avro/generic/TestGenericRecordBuilder.java @@ -37,15 +37,15 @@ public class TestGenericRecordBuilder { public void testGenericBuilder() { Schema schema = recordSchema(); GenericRecordBuilder builder = new GenericRecordBuilder(schema); - + // Verify that builder has no fields set after initialization: for (Field field : schema.getFields()) { - Assert.assertFalse("RecordBuilder should not have field " + field.name(), + Assert.assertFalse("RecordBuilder should not have field " + field.name(), builder.has(field.name())); Assert.assertNull("Field " + field.name() + " should be null", builder.get(field.name())); } - + // Set field in builder: builder.set("intField", 1); List anArray = Arrays.asList(new String[] { "one", "two", "three" }); @@ -54,47 +54,47 @@ public void testGenericBuilder() { Assert.assertEquals(anArray, builder.get("anArray")); Assert.assertFalse("id should not be set", builder.has("id")); Assert.assertNull(builder.get("id")); - + // Build the record, and verify that fields are set: Record record = builder.build(); Assert.assertEquals(new Integer(1), record.get("intField")); Assert.assertEquals(anArray, record.get("anArray")); Assert.assertNotNull(record.get("id")); Assert.assertEquals("0", record.get("id").toString()); - + // Test copy constructors: Assert.assertEquals(builder, new GenericRecordBuilder(builder)); Assert.assertEquals(record, new GenericRecordBuilder(record).build()); - + // Test clear: builder.clear("intField"); Assert.assertFalse(builder.has("intField")); Assert.assertNull(builder.get("intField")); } - + @Test(expected=org.apache.avro.AvroRuntimeException.class) public void attemptToSetNonNullableFieldToNull() { new GenericRecordBuilder(recordSchema()).set("intField", null); } - + @Test(expected=org.apache.avro.AvroRuntimeException.class) public void buildWithoutSettingRequiredFields1() { new GenericRecordBuilder(recordSchema()).build(); } - + @Test() public void buildWithoutSettingRequiredFields2() { try { new GenericRecordBuilder(recordSchema()). set("anArray", Arrays.asList(new String[] { "one" })). build(); - Assert.fail("Should have thrown " + + Assert.fail("Should have thrown " + AvroRuntimeException.class.getCanonicalName()); } catch (AvroRuntimeException e) { Assert.assertTrue(e.getMessage().contains("intField")); } } - + /** Creates a test record schema */ private static Schema recordSchema() { List fields = new ArrayList(); diff --git a/lang/java/avro/src/test/java/org/apache/avro/io/LegacyBinaryEncoder.java b/lang/java/avro/src/test/java/org/apache/avro/io/LegacyBinaryEncoder.java index ea8d7785d52..e8b1b0a44d6 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/io/LegacyBinaryEncoder.java +++ b/lang/java/avro/src/test/java/org/apache/avro/io/LegacyBinaryEncoder.java @@ -43,11 +43,11 @@ */ public class LegacyBinaryEncoder extends Encoder { protected OutputStream out; - + private interface ByteWriter { void write(ByteBuffer bytes) throws IOException; } - + private static final class SimpleByteWriter implements ByteWriter { private final OutputStream out; @@ -61,7 +61,7 @@ public void write(ByteBuffer bytes) throws IOException { out.write(bytes.array(), bytes.position(), bytes.remaining()); } } - + private final ByteWriter byteWriter; /** Create a writer that sends its output to the underlying stream @@ -80,7 +80,7 @@ public void flush() throws IOException { @Override public void writeNull() throws IOException { } - + @Override public void writeBoolean(boolean b) throws IOException { out.write(b ? 1 : 0); @@ -95,7 +95,7 @@ public void writeInt(int n) throws IOException { public void writeLong(long n) throws IOException { encodeLong(n, out); } - + @Override public void writeFloat(float f) throws IOException { encodeFloat(f, out); @@ -110,29 +110,29 @@ public void writeDouble(double d) throws IOException { public void writeString(Utf8 utf8) throws IOException { encodeString(utf8.getBytes(), 0, utf8.getByteLength()); } - + @Override public void writeString(String string) throws IOException { byte[] bytes = Utf8.getBytesFor(string); encodeString(bytes, 0, bytes.length); } - + private void encodeString(byte[] bytes, int offset, int length) throws IOException { encodeLong(length, out); out.write(bytes, offset, length); } - + @Override public void writeBytes(ByteBuffer bytes) throws IOException { byteWriter.write(bytes); } - + @Override public void writeBytes(byte[] bytes, int start, int len) throws IOException { encodeLong(len, out); out.write(bytes, start, len); } - + @Override public void writeFixed(byte[] bytes, int start, int len) throws IOException { out.write(bytes, start, len); @@ -153,7 +153,7 @@ public void setItemCount(long itemCount) throws IOException { writeLong(itemCount); } } - + @Override public void startItem() throws IOException { } @@ -176,7 +176,7 @@ public void writeMapEnd() throws IOException { public void writeIndex(int unionIndex) throws IOException { encodeLong(unionIndex, out); } - + protected static void encodeLong(long n, OutputStream o) throws IOException { n = (n << 1) ^ (n >> 63); // move sign to low-order bit while ((n & ~0x7F) != 0) { diff --git a/lang/java/avro/src/test/java/org/apache/avro/io/TestBinaryDecoder.java b/lang/java/avro/src/test/java/org/apache/avro/io/TestBinaryDecoder.java index aa3e1d7eb0d..572be6029fb 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/io/TestBinaryDecoder.java +++ b/lang/java/avro/src/test/java/org/apache/avro/io/TestBinaryDecoder.java @@ -52,7 +52,7 @@ public class TestBinaryDecoder { public TestBinaryDecoder(boolean useDirect) { this.useDirect = useDirect; } - + @Parameters public static Collection data() { return Arrays.asList(new Object[][] { @@ -60,7 +60,7 @@ public static Collection data() { { false }, }); } - + private Decoder newDecoderWithNoData() throws IOException { return newDecoder(new byte[0]); } @@ -68,7 +68,7 @@ private Decoder newDecoderWithNoData() throws IOException { private Decoder newDecoder(byte[] bytes, int start, int len) throws IOException { return factory.binaryDecoder(bytes, start, len, null); - + } private Decoder newDecoder(InputStream in) { @@ -89,37 +89,37 @@ private Decoder newDecoder(byte[] bytes) throws IOException { public void testEOFBoolean() throws IOException { newDecoderWithNoData().readBoolean(); } - + @Test(expected=EOFException.class) public void testEOFInt() throws IOException { newDecoderWithNoData().readInt(); } - + @Test(expected=EOFException.class) public void testEOFLong() throws IOException { newDecoderWithNoData().readLong(); } - + @Test(expected=EOFException.class) public void testEOFFloat() throws IOException { newDecoderWithNoData().readFloat(); } - + @Test(expected=EOFException.class) public void testEOFDouble() throws IOException { newDecoderWithNoData().readDouble(); } - + @Test(expected=EOFException.class) public void testEOFBytes() throws IOException { newDecoderWithNoData().readBytes(null); } - + @Test(expected=EOFException.class) public void testEOFString() throws IOException { newDecoderWithNoData().readString(new Utf8("a")); } - + @Test(expected=EOFException.class) public void testEOFFixed() throws IOException { newDecoderWithNoData().readFixed(new byte[1]); @@ -129,32 +129,32 @@ public void testEOFFixed() throws IOException { public void testEOFEnum() throws IOException { newDecoderWithNoData().readEnum(); } - + @Test public void testReuse() throws IOException { ByteBufferOutputStream bbo1 = new ByteBufferOutputStream(); ByteBufferOutputStream bbo2 = new ByteBufferOutputStream(); byte[] b1 = new byte[] { 1, 2 }; - + BinaryEncoder e1 = e_factory.binaryEncoder(bbo1, null); e1.writeBytes(b1); e1.flush(); - + BinaryEncoder e2 = e_factory.binaryEncoder(bbo2, null); e2.writeBytes(b1); e2.flush(); - + DirectBinaryDecoder d = new DirectBinaryDecoder( new ByteBufferInputStream(bbo1.getBufferList())); ByteBuffer bb1 = d.readBytes(null); Assert.assertEquals(b1.length, bb1.limit() - bb1.position()); - + d.configure(new ByteBufferInputStream(bbo2.getBufferList())); ByteBuffer bb2 = d.readBytes(null); Assert.assertEquals(b1.length, bb2.limit() - bb2.position()); - + } - + private static byte[] data = null; private static int seed = -1; private static Schema schema = null; @@ -180,7 +180,7 @@ public static void generateData() throws IOException { writer.setSchema(schema); ByteArrayOutputStream baos = new ByteArrayOutputStream(8192); BinaryEncoder encoder = e_factory.binaryEncoder(baos, null); - + for (Object datum : new RandomData(schema, count, seed)) { writer.write(datum, encoder); records.add(datum); @@ -193,14 +193,14 @@ public static void generateData() throws IOException { public void testDecodeFromSources() throws IOException { GenericDatumReader reader = new GenericDatumReader(); reader.setSchema(schema); - + ByteArrayInputStream is = new ByteArrayInputStream(data); ByteArrayInputStream is2 = new ByteArrayInputStream(data); ByteArrayInputStream is3 = new ByteArrayInputStream(data); Decoder fromInputStream = newDecoder(is); Decoder fromArray = newDecoder(data); - + byte[] data2 = new byte[data.length + 30]; Arrays.fill(data2, (byte)0xff); System.arraycopy(data, 0, data2, 15, data.length); @@ -213,7 +213,7 @@ public void testDecodeFromSources() throws IOException { BinaryDecoder initOnArray = factory.binaryDecoder(is3, null); initOnArray = factory.binaryDecoder( data, 0, data.length, initOnArray); - + for (Object datum : records) { Assert.assertEquals( "InputStream based BinaryDecoder result does not match", @@ -272,7 +272,7 @@ public void testInputStreamProxyDetached() throws IOException { Assert.assertFalse(bad.read() == check2.read()); } } - + @Test public void testInputStreamPartiallyUsed() throws IOException { BinaryDecoder bd = factory.binaryDecoder( @@ -281,7 +281,7 @@ public void testInputStreamPartiallyUsed() throws IOException { InputStream check = new ByteArrayInputStream(data); // triggers buffer fill if unused and tests isEnd() try { - Assert.assertFalse(bd.isEnd()); + Assert.assertFalse(bd.isEnd()); } catch (UnsupportedOperationException e) { // this is ok if its a DirectBinaryDecoder. if (bd.getClass() != DirectBinaryDecoder.class) { @@ -296,7 +296,7 @@ public void testInputStreamPartiallyUsed() throws IOException { private void validateInputStreamReads(InputStream test, InputStream check) throws IOException { byte[] bt = new byte[7]; - byte[] bc = new byte[7]; + byte[] bc = new byte[7]; while (true) { int t = test.read(); int c = check.read(); @@ -318,7 +318,7 @@ private void validateInputStreamReads(InputStream test, InputStream check) Assert.assertFalse(test.getClass() != ByteArrayInputStream.class && test.markSupported()); test.close(); } - + private void validateInputStreamSkips(InputStream test, InputStream check) throws IOException { while(true) { long t2 = test.skip(19); @@ -383,7 +383,7 @@ public void testLongTooShort() throws IOException { Arrays.fill(badint, (byte)0xff); newDecoder(badint).readLong(); } - + @Test(expected=EOFException.class) public void testFloatTooShort() throws IOException { byte[] badint = new byte[3]; @@ -435,7 +435,7 @@ private void skipGenerated(Decoder bd) throws IOException { bd.skipFixed(8); long leftover = bd.skipArray(); // booleans are one byte, array trailer is one byte - bd.skipFixed((int)leftover + 1); + bd.skipFixed((int)leftover + 1); bd.skipFixed(0); bd.readLong(); } @@ -447,14 +447,14 @@ private void skipGenerated(Decoder bd) throws IOException { } Assert.assertTrue(null != eof); } - + @Test(expected = EOFException.class) public void testEOF() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); Encoder e = EncoderFactory.get().binaryEncoder(baos, null); e.writeLong(0x10000000000000l); e.flush(); - + Decoder d = newDecoder(new ByteArrayInputStream(baos.toByteArray())); Assert.assertEquals(0x10000000000000l, d.readLong()); d.readInt(); diff --git a/lang/java/avro/src/test/java/org/apache/avro/io/TestBinaryEncoderFidelity.java b/lang/java/avro/src/test/java/org/apache/avro/io/TestBinaryEncoderFidelity.java index 997ab949afa..505798aa980 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/io/TestBinaryEncoderFidelity.java +++ b/lang/java/avro/src/test/java/org/apache/avro/io/TestBinaryEncoderFidelity.java @@ -28,7 +28,7 @@ import org.junit.Test; public class TestBinaryEncoderFidelity { - + static byte[] legacydata; static byte[] complexdata; EncoderFactory factory = EncoderFactory.get(); @@ -116,7 +116,7 @@ public static void generateData(Encoder e, boolean useReadOnlyByteBuffer) throws } e.flush(); } - + static void generateComplexData(Encoder e) throws IOException { e.writeArrayStart(); e.setItemCount(1); @@ -136,7 +136,7 @@ static void generateComplexData(Encoder e) throws IOException { e.writeMapEnd(); e.flush(); } - + @BeforeClass public static void generateLegacyData() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -147,7 +147,7 @@ public static void generateLegacyData() throws IOException { generateComplexData(e); complexdata = baos.toByteArray(); } - + @Test public void testBinaryEncoder() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -162,7 +162,7 @@ public void testBinaryEncoder() throws IOException { Assert.assertEquals(complexdata.length, result2.length); Assert.assertArrayEquals(complexdata, result2); } - + @Test public void testDirectBinaryEncoder() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -178,7 +178,7 @@ public void testDirectBinaryEncoder() throws IOException { Assert.assertArrayEquals(complexdata, result2); } - + @Test public void testBlockingBinaryEncoder() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); diff --git a/lang/java/avro/src/test/java/org/apache/avro/io/TestBlockingIO.java b/lang/java/avro/src/test/java/org/apache/avro/io/TestBlockingIO.java index 95729fe55f0..f6cb76b8247 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/io/TestBlockingIO.java +++ b/lang/java/avro/src/test/java/org/apache/avro/io/TestBlockingIO.java @@ -47,33 +47,33 @@ public TestBlockingIO (int sz, int dp, String inp) { this.iDepth = dp; this.sInput = inp; } - + private static class Tests { private final JsonParser parser; private final Decoder input; private final int depth; public Tests(int bufferSize, int depth, String input) throws IOException { - + this.depth = depth; byte[] in = input.getBytes("UTF-8"); JsonFactory f = new JsonFactory(); JsonParser p = f.createJsonParser( new ByteArrayInputStream(input.getBytes("UTF-8"))); - + ByteArrayOutputStream os = new ByteArrayOutputStream(); EncoderFactory factory = new EncoderFactory() .configureBlockSize(bufferSize); Encoder cos = factory.blockingBinaryEncoder(os, null); serialize(cos, p, os); cos.flush(); - + byte[] bb = os.toByteArray(); // dump(bb); this.input = DecoderFactory.get().binaryDecoder(bb, null); this.parser = f.createJsonParser(new ByteArrayInputStream(in)); } - + public void scan() throws IOException { Stack countStack = new Stack(); long count = 0; @@ -208,7 +208,7 @@ protected static void dump(byte[] bb) { private static class S { public final long count; public final boolean isArray; - + public S(long count, boolean isArray) { this.count = count; this.isArray = isArray; @@ -270,7 +270,7 @@ private static void skipArray(JsonParser parser, Decoder input, int depth) } parser.skipChildren(); } - + private static void checkString(String s, Decoder input, int n) throws IOException { ByteBuffer buf = input.readBytes(null); @@ -279,14 +279,14 @@ private static void checkString(String s, Decoder input, int n) buf.remaining(), UTF_8); assertEquals(s, s2); } - + private static void serialize(Encoder cos, JsonParser p, ByteArrayOutputStream os) throws IOException { boolean[] isArray = new boolean[100]; int[] counts = new int[100]; int stackTop = -1; - + while (p.nextToken() != null) { switch (p.getCurrentToken()) { case END_ARRAY: diff --git a/lang/java/avro/src/test/java/org/apache/avro/io/TestBlockingIO2.java b/lang/java/avro/src/test/java/org/apache/avro/io/TestBlockingIO2.java index 6438a605a6b..5bb6c84ac78 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/io/TestBlockingIO2.java +++ b/lang/java/avro/src/test/java/org/apache/avro/io/TestBlockingIO2.java @@ -38,7 +38,7 @@ public class TestBlockingIO2 { private final Decoder decoder; private final String calls; private Object[] values; - + public TestBlockingIO2 (int bufferSize, int skipLevel, String calls) throws IOException { @@ -50,13 +50,13 @@ public TestBlockingIO2 (int bufferSize, int skipLevel, String calls) TestValidatingIO.generate(encoder, calls, values); encoder.flush(); - + byte[] bb = os.toByteArray(); - + decoder = DecoderFactory.get().binaryDecoder(bb, null); this.calls = calls; } - + @Test public void testScan() throws IOException { TestValidatingIO.check(decoder, calls, values, -1); diff --git a/lang/java/avro/src/test/java/org/apache/avro/io/TestEncoders.java b/lang/java/avro/src/test/java/org/apache/avro/io/TestEncoders.java index 46a9025f48a..4d16f163505 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/io/TestEncoders.java +++ b/lang/java/avro/src/test/java/org/apache/avro/io/TestEncoders.java @@ -41,7 +41,7 @@ public void testBinaryEncoderInit() throws IOException { BinaryEncoder enc = factory.binaryEncoder(out, null); Assert.assertTrue(enc == factory.binaryEncoder(out, enc)); } - + @Test(expected=NullPointerException.class) public void testBadBinaryEncoderInit() { factory.binaryEncoder(null, null); @@ -53,21 +53,21 @@ public void testBlockingBinaryEncoderInit() throws IOException { BinaryEncoder reuse = null; reuse = factory.blockingBinaryEncoder(out, reuse); Assert.assertTrue(reuse == factory.blockingBinaryEncoder(out, reuse)); - // comparison + // comparison } - + @Test(expected=NullPointerException.class) public void testBadBlockintBinaryEncoderInit() { factory.binaryEncoder(null, null); } - + @Test public void testDirectBinaryEncoderInit() throws IOException { OutputStream out = new ByteArrayOutputStream(); BinaryEncoder enc = factory.directBinaryEncoder(out, null); Assert.assertTrue(enc == factory.directBinaryEncoder(out, enc)); } - + @Test(expected=NullPointerException.class) public void testBadDirectBinaryEncoderInit() { factory.directBinaryEncoder(null, null); @@ -82,12 +82,12 @@ public void testJsonEncoderInit() throws IOException { new JsonFactory().createJsonGenerator(out, JsonEncoding.UTF8)); enc.configure(out); } - + @Test(expected=NullPointerException.class) public void testBadJsonEncoderInitOS() throws IOException { factory.jsonEncoder(Schema.create(Type.INT), (OutputStream)null); } - + @Test(expected=NullPointerException.class) public void testBadJsonEncoderInit() throws IOException { factory.jsonEncoder(Schema.create(Type.INT), (JsonGenerator)null); @@ -119,7 +119,7 @@ public void testJsonRecordOrdering() throws IOException { String value = "{\"b\": 2, \"a\": 1}"; Schema schema = new Schema.Parser().parse("{\"type\": \"record\", \"name\": \"ab\", \"fields\": [" + "{\"name\": \"a\", \"type\": \"int\"}, {\"name\": \"b\", \"type\": \"int\"}" + - "]}"); + "]}"); GenericDatumReader reader = new GenericDatumReader(schema); Decoder decoder = DecoderFactory.get().jsonDecoder(schema, value); Object o = reader.read(null, decoder); diff --git a/lang/java/avro/src/test/java/org/apache/avro/io/TestJsonDecoder.java b/lang/java/avro/src/test/java/org/apache/avro/io/TestJsonDecoder.java index 7946beb3142..4ac07eb80a3 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/io/TestJsonDecoder.java +++ b/lang/java/avro/src/test/java/org/apache/avro/io/TestJsonDecoder.java @@ -26,7 +26,7 @@ import org.junit.Assert; public class TestJsonDecoder { - + @Test public void testInt() throws Exception { checkNumeric("int", 1); } @@ -44,7 +44,7 @@ public class TestJsonDecoder { } private void checkNumeric(String type, Object value) throws Exception { - String def = + String def = "{\"type\":\"record\",\"name\":\"X\",\"fields\":" +"[{\"type\":\""+type+"\",\"name\":\"n\"}]}"; Schema schema = Schema.parse(def); diff --git a/lang/java/avro/src/test/java/org/apache/avro/io/TestResolvingIO.java b/lang/java/avro/src/test/java/org/apache/avro/io/TestResolvingIO.java index d5f1b06d41a..3cdc7e5c69a 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/io/TestResolvingIO.java +++ b/lang/java/avro/src/test/java/org/apache/avro/io/TestResolvingIO.java @@ -51,7 +51,7 @@ public TestResolvingIO (Encoding encoding, this.sJsRdrSchm = jsonReaderSchema; this.sRdrCls = readerCalls; } - + @Test public void testIdentical() throws IOException { performTest(eEnc, iSkipL, sJsWrtSchm, sWrtCls, sJsWrtSchm, sWrtCls); @@ -66,7 +66,7 @@ public void testCompatible() throws IOException { private void performTest(Encoding encoding, int skipLevel, String jsonWriterSchema, - String writerCalls, + String writerCalls, String jsonReaderSchema, String readerCalls) throws IOException { for (int i = 0; i < COUNT; i++) { @@ -74,7 +74,7 @@ private void performTest(Encoding encoding, jsonReaderSchema, readerCalls, encoding, skipLevel); } } - + private void testOnce(String jsonWriterSchema, String writerCalls, String jsonReaderSchema, @@ -83,7 +83,7 @@ private void testOnce(String jsonWriterSchema, int skipLevel) throws IOException { Object[] values = TestValidatingIO.randomValues(writerCalls); Object[] expected = TestValidatingIO.randomValues(readerCalls); - + Schema writerSchema = new Schema.Parser().parse(jsonWriterSchema); byte[] bytes = TestValidatingIO.make(writerSchema, writerCalls, values, encoding); @@ -114,7 +114,7 @@ static void check(Schema wsc, Schema rsc, byte[] bytes, Decoder vi = new ResolvingDecoder(wsc, rsc, bvi); TestValidatingIO.check(vi, calls, values, skipLevel); } - + @Parameterized.Parameters public static Collection data2() { return Arrays.asList(TestValidatingIO.convertTo2dArray(encodings, skipLevels, testSchemas())); diff --git a/lang/java/avro/src/test/java/org/apache/avro/io/TestResolvingIOResolving.java b/lang/java/avro/src/test/java/org/apache/avro/io/TestResolvingIOResolving.java index e6377b5ff3d..b722e766ac1 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/io/TestResolvingIOResolving.java +++ b/lang/java/avro/src/test/java/org/apache/avro/io/TestResolvingIOResolving.java @@ -190,8 +190,8 @@ private static Object[][] dataForResolvingTests() { + "{\"name\":\"f3\", \"type\":\"double\"}]}", "BLD", new Object[] { true, 100L, 10.75d } }, // Array of record with arrays. - { "{ \"type\": \"array\", \"items\":" + - "{\"type\":\"record\",\"name\":\"r\",\"fields\":[" + { "{ \"type\": \"array\", \"items\":" + + "{\"type\":\"record\",\"name\":\"r\",\"fields\":[" + "{\"name\":\"f0\", \"type\":\"boolean\"}," + "{\"name\":\"f1\", \"type\": {\"type\":\"array\", \"items\": \"boolean\" }}" + "]}}", "[c2sB[c2sBsB]sB[c3sBsBsB]]", diff --git a/lang/java/avro/src/test/java/org/apache/avro/io/TestValidatingIO.java b/lang/java/avro/src/test/java/org/apache/avro/io/TestValidatingIO.java index bfec06d2899..792a98764d3 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/io/TestValidatingIO.java +++ b/lang/java/avro/src/test/java/org/apache/avro/io/TestValidatingIO.java @@ -48,10 +48,10 @@ enum Encoding { BLOCKING_BINARY, JSON, } - + private static final Logger LOG = LoggerFactory.getLogger(TestValidatingIO.class); - + private Encoding eEnc; private int iSkipL; private String sJsSch; @@ -64,7 +64,7 @@ public TestValidatingIO (Encoding enc, int skip, String js, String cls) { this.sCl = cls; } private static final int COUNT = 1; - + @Test public void testMain() throws IOException { for (int i = 0; i < COUNT; i++) { @@ -98,7 +98,7 @@ public static byte[] make(Schema sc, String calls, bvo = factory.jsonEncoder(sc, ba); break; } - + Encoder vo = factory.validatingEncoder(sc, bvo); generate(vo, calls, values); vo.flush(); @@ -108,22 +108,22 @@ public static byte[] make(Schema sc, String calls, public static class InputScanner { private final char[] chars; private int cpos = 0; - + public InputScanner(char[] chars) { this.chars = chars; } - + public boolean next() { if (cpos < chars.length) { cpos++; } return cpos != chars.length; } - + public char cur() { return chars[cpos]; } - + public boolean isDone() { return cpos == chars.length; } @@ -319,7 +319,7 @@ private static void check(Schema sc, byte[] bytes, String calls, Decoder vi = new ValidatingDecoder(sc, bvi); check(vi, calls, values, skipLevel); } - + public static void check(Decoder vi, String calls, Object[] values, final int skipLevel) throws IOException { InputScanner cs = new InputScanner(calls.toCharArray()); @@ -523,16 +523,16 @@ private static int skip(InputScanner cs, Decoder vi, boolean isArray) public static Collection data() { return Arrays.asList(convertTo2dArray(encodings, skipLevels, testSchemas())); } - + private static Object[][] encodings = new Object[][] { { Encoding.BINARY }, { Encoding.BLOCKING_BINARY }, { Encoding.JSON } - }; + }; private static Object[][] skipLevels = new Object[][] { { -1 }, { 0 }, { 1 }, { 2 }, }; - + public static Object[][] convertTo2dArray(final Object[][]... values) { ArrayList ret = new ArrayList(); @@ -582,7 +582,7 @@ public void remove() { } }; } - + /** * Concatenates the input sequences in order and forms a longer sequence. */ @@ -730,7 +730,7 @@ public static Object[][] testSchemas() { + "{\"name\":\"f6\", \"type\":\"string\"}," + "{\"name\":\"f7\", \"type\":\"bytes\"}]}", "NBILFDS10b25" }, - + // record of records { "{\"type\":\"record\",\"name\":\"outer\",\"fields\":[" + "{\"name\":\"f1\", \"type\":{\"type\":\"record\", " @@ -796,14 +796,14 @@ public static Object[][] testSchemas() { { "[\"boolean\", {\"type\":\"array\", \"items\":\"int\"} ]", "U1[c1sI]" }, - + // Recursion { "{\"type\": \"record\", \"name\": \"Node\", \"fields\": [" + "{\"name\":\"label\", \"type\":\"string\"}," + "{\"name\":\"children\", \"type\":" + "{\"type\": \"array\", \"items\": \"Node\" }}]}", "S10[c1sS10[]]" }, - + { "{\"type\": \"record\", \"name\": \"Lisp\", \"fields\": [" + "{\"name\":\"value\", \"type\":[\"null\", \"string\"," + "{\"type\": \"record\", \"name\": \"Cons\", \"fields\": [" @@ -822,16 +822,16 @@ public static Object[][] testSchemas() { + "{\"name\":\"car\", \"type\":\"Lisp\"}," + "{\"name\":\"cdr\", \"type\":\"Lisp\"}]}]}]}", "U2U1S10U0N"}, - + // Deep recursion { "{\"type\": \"record\", \"name\": \"Node\", \"fields\": [" + "{\"name\":\"children\", \"type\":" + "{\"type\": \"array\", \"items\": \"Node\" }}]}", "[c1s[c1s[c1s[c1s[c1s[c1s[c1s[c1s[c1s[c1s[c1s[]]]]]]]]]]]]" }, - + }; } - + static void dump(byte[] bb) { int col = 0; for (byte b : bb) { @@ -844,17 +844,17 @@ static void dump(byte[] bb) { System.out.println(); } - static void print(Encoding encoding, int skipLevel, Schema writerSchema, + static void print(Encoding encoding, int skipLevel, Schema writerSchema, Schema readerSchema, Object[] writtenValues, Object[] expectedValues) { - LOG.debug("{} Skip Level {}", encoding, skipLevel); + LOG.debug("{} Skip Level {}", encoding, skipLevel); printSchemaAndValues("Writer", writerSchema, writtenValues); printSchemaAndValues("Reader", readerSchema, expectedValues); } private static void printSchemaAndValues(String schemaType, Schema schema, Object[] values) { - LOG.debug("{} Schema {}", schemaType, schema); + LOG.debug("{} Schema {}", schemaType, schema); for (Object value : values) { LOG.debug("{} -> {}", value, value.getClass().getSimpleName()); } - } + } } diff --git a/lang/java/avro/src/test/java/org/apache/avro/io/parsing/TestResolvingGrammarGenerator.java b/lang/java/avro/src/test/java/org/apache/avro/io/parsing/TestResolvingGrammarGenerator.java index 142d104d50c..2d9a83e9d33 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/io/parsing/TestResolvingGrammarGenerator.java +++ b/lang/java/avro/src/test/java/org/apache/avro/io/parsing/TestResolvingGrammarGenerator.java @@ -47,7 +47,7 @@ public class TestResolvingGrammarGenerator { private final Schema schema; private final JsonNode data; - + public TestResolvingGrammarGenerator(String jsonSchema, String jsonData) throws IOException { this.schema = Schema.parse(jsonSchema); @@ -61,9 +61,9 @@ public TestResolvingGrammarGenerator(String jsonSchema, String jsonData) public void test() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); EncoderFactory factory = EncoderFactory.get(); - Encoder e = factory.validatingEncoder(schema, + Encoder e = factory.validatingEncoder(schema, factory.binaryEncoder(baos, null)); - + ResolvingGrammarGenerator.encode(e, schema, data); e.flush(); } @@ -91,7 +91,7 @@ public void testRecordMissingRequiredFieldError() throws Exception { "Found ns.MyRecord, expecting ns.MyRecord, missing required field field2", typeException.getMessage()); } } - + @Parameterized.Parameters public static Collection data() { Collection ret = Arrays.asList( diff --git a/lang/java/avro/src/test/java/org/apache/avro/io/parsing/TestResolvingGrammarGenerator2.java b/lang/java/avro/src/test/java/org/apache/avro/io/parsing/TestResolvingGrammarGenerator2.java index 1b5ac6f9d63..ea9ed1a5f63 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/io/parsing/TestResolvingGrammarGenerator2.java +++ b/lang/java/avro/src/test/java/org/apache/avro/io/parsing/TestResolvingGrammarGenerator2.java @@ -26,7 +26,7 @@ import org.junit.Test; /** ResolvingGrammarGenerator tests that are not Parameterized.*/ -public class TestResolvingGrammarGenerator2 { +public class TestResolvingGrammarGenerator2 { @Test public void testFixed() throws java.io.IOException { new ResolvingGrammarGenerator().generate (Schema.createFixed("MyFixed", null, null, 10), diff --git a/lang/java/avro/src/test/java/org/apache/avro/reflect/TestByteBuffer.java b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestByteBuffer.java index e48fd1436c8..602d39edc8a 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/reflect/TestByteBuffer.java +++ b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestByteBuffer.java @@ -67,9 +67,9 @@ static class X{ @Test public void test() throws Exception{ Schema schema = ReflectData.get().getSchema(X.class); ByteArrayOutputStream bout = new ByteArrayOutputStream(); - writeOneXAsAvro(schema, bout); + writeOneXAsAvro(schema, bout); X record = readOneXFromAvro(schema, bout); - + String expected = getmd5(content); String actual = getmd5(record.content); assertEquals("md5 for result differed from input",expected,actual); diff --git a/lang/java/avro/src/test/java/org/apache/avro/reflect/TestNonStringMapKeys.java b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestNonStringMapKeys.java index 41f508c2782..3267529a516 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/reflect/TestNonStringMapKeys.java +++ b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestNonStringMapKeys.java @@ -59,7 +59,7 @@ public void testNonStringMapKeys() throws Exception { String testType = "NonStringKeysTest"; Company [] entityObjs = {entityObj1, entityObj2}; byte[] bytes = testSerialization(testType, entityObj1, entityObj2); - List records = + List records = (List) testGenericDatumRead(testType, bytes, entityObjs); GenericRecord record = records.get(0); @@ -76,7 +76,7 @@ public void testNonStringMapKeys() throws Exception { Object id = ((GenericRecord)key).get("id"); Object name = ((GenericRecord)value).get("name").toString(); assertTrue ( - (id.equals(1) && name.equals("Foo")) || + (id.equals(1) && name.equals("Foo")) || (id.equals(2) && name.equals("Bar")) ); @@ -92,7 +92,7 @@ public void testNonStringMapKeys() throws Exception { id = e.getKey().getId(); name = e.getValue().getName(); assertTrue ( - (id.equals(1) && name.equals("Foo")) || + (id.equals(1) && name.equals("Foo")) || (id.equals(2) && name.equals("Bar")) ); } @@ -103,7 +103,7 @@ public void testNonStringMapKeys() throws Exception { GenericRecord jsonRecord = testJsonDecoder(testType, jsonBytes, entityObj1); assertEquals ("JSON decoder output not same as Binary Decoder", record, jsonRecord); } - + @Test public void testNonStringMapKeysInNestedMaps() throws Exception { @@ -119,7 +119,7 @@ public void testNonStringMapKeysInNestedMaps() throws Exception { Object employees = record.get("employees"); assertTrue ("Unable to read 'employees' map", employees instanceof GenericArray); GenericArray employeesMapArray = ((GenericArray)employees); - + Object employeeMapElement = employeesMapArray.get(0); assertTrue (employeeMapElement instanceof GenericRecord); Object key = ((GenericRecord)employeeMapElement).get(ReflectData.NS_MAP_KEY); @@ -129,11 +129,11 @@ public void testNonStringMapKeysInNestedMaps() throws Exception { GenericRecord employeeInfo = (GenericRecord)value; Object name = employeeInfo.get("name").toString(); assertEquals ("Foo", name); - + Object companyMap = employeeInfo.get("companyMap"); assertTrue (companyMap instanceof GenericArray); GenericArray companyMapArray = (GenericArray)companyMap; - + Object companyMapElement = companyMapArray.get(0); assertTrue (companyMapElement instanceof GenericRecord); key = ((GenericRecord)companyMapElement).get(ReflectData.NS_MAP_KEY); @@ -142,7 +142,7 @@ public void testNonStringMapKeysInNestedMaps() throws Exception { if (value instanceof Utf8) value = ((Utf8)value).toString(); assertEquals ("CompanyFoo", value); - + List records2 = (List) testReflectDatumRead(testType, bytes, entityObjs); Company2 co = records2.get(0); @@ -180,7 +180,7 @@ public void testRecordNameInvariance() throws Exception { Object map1obj = record.get("map1"); assertTrue ("Unable to read map1", map1obj instanceof GenericArray); GenericArray map1array = ((GenericArray)map1obj); - + Object map1element = map1array.get(0); assertTrue (map1element instanceof GenericRecord); Object key = ((GenericRecord)map1element).get(ReflectData.NS_MAP_KEY); @@ -190,7 +190,7 @@ public void testRecordNameInvariance() throws Exception { Object map2obj = record.get("map2"); assertEquals (map1obj, map2obj); - + List records2 = (List) testReflectDatumRead(testType, bytes, entityObjs); SameMapSignature entity = records2.get(0); @@ -221,9 +221,9 @@ public void testRecordNameInvariance() throws Exception { byte[] jsonBytes = testJsonEncoder (testType, entityObj1); assertNotNull ("Unable to serialize using jsonEncoder", jsonBytes); GenericRecord jsonRecord = testJsonDecoder(testType, jsonBytes, entityObj1); - assertEquals ("JSON decoder output not same as Binary Decoder", + assertEquals ("JSON decoder output not same as Binary Decoder", record.get("map1"), jsonRecord.get("map1")); - assertEquals ("JSON decoder output not same as Binary Decoder", + assertEquals ("JSON decoder output not same as Binary Decoder", record.get("map2"), jsonRecord.get("map2")); } @@ -280,7 +280,7 @@ public byte[] testSerialization(String testType, T ... entityObjs) throws Ex /** * Test that non-string map-keys are readable through ReflectDatumReader * This methoud should form the original map and should not return any - * array of {key, value} as done by {@link #testGenericDatumRead()} + * array of {key, value} as done by {@link #testGenericDatumRead()} */ private List testReflectDatumRead (String testType, byte[] bytes, T ... entityObjs) throws IOException { @@ -349,15 +349,15 @@ private Company2 buildCompany2 () { Company2 co = new Company2 (); HashMap employees = new HashMap(); co.setEmployees(employees); - + EmployeeId2 empId = new EmployeeId2(1); EmployeeInfo2 empInfo = new EmployeeInfo2("Foo"); HashMap companyMap = new HashMap(); empInfo.setCompanyMap(companyMap); companyMap.put(14, "CompanyFoo"); - + employees.put(11, empInfo); - + return co; } diff --git a/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java index 6c29ccced78..a281a06be24 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java +++ b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflect.java @@ -50,9 +50,9 @@ import org.junit.Test; public class TestReflect { - + EncoderFactory factory = new EncoderFactory(); - + // test primitive type inference @Test public void testVoid() { check(Void.TYPE, "\"null\""); @@ -154,13 +154,13 @@ public static class R1 { mapField.put("foo", "bar"); listField.add("foo"); } - + @Override public boolean equals(Object o) { if (!(o instanceof R1)) return false; R1 that = (R1)o; return mapField.equals(that.mapField) - && Arrays.equals(this.arrayField, that.arrayField) + && Arrays.equals(this.arrayField, that.arrayField) && listField.equals(that.listField); } } @@ -179,7 +179,7 @@ public boolean equals(Object o) { "{\"type\":\"array\",\"items\":\"string\"" +",\"java-class\":\"java.util.List\"}"); } - + @Test public void testR1() throws Exception { checkReadWrite(new R1()); } @@ -188,12 +188,12 @@ public boolean equals(Object o) { public static class R2 { private String[] arrayField; private Collection collectionField; - + @Override public boolean equals(Object o) { if (!(o instanceof R2)) return false; R2 that = (R2)o; - return Arrays.equals(this.arrayField, that.arrayField) + return Arrays.equals(this.arrayField, that.arrayField) && collectionField.equals(that.collectionField); } } @@ -209,7 +209,7 @@ public boolean equals(Object o) { // test array i/o of unboxed type public static class R3 { private int[] intArray; - + @Override public boolean equals(Object o) { if (!(o instanceof R3)) return false; @@ -230,7 +230,7 @@ public static class R4 { public short[] shorts; public byte b; public char c; - + @Override public boolean equals(Object o) { if (!(o instanceof R4)) return false; @@ -335,7 +335,7 @@ public boolean equals(Object o) { return this.text.equals(((R10)o).text); } } - + @Test public void testR10() throws Exception { Schema r10Schema = ReflectData.get().getSchema(R10.class); assertEquals(Schema.Type.STRING, r10Schema.getType()); @@ -354,7 +354,7 @@ public boolean equals(Object o) { return this.text.equals(that.text); } } - + @Test public void testR11() throws Exception { Schema r11Record = ReflectData.get().getSchema(R11.class); assertEquals(Schema.Type.RECORD, r11Record.getType()); @@ -414,7 +414,7 @@ public static class R12 { // fields ("{\"type\":\"array\",\"items\":[\"null\",\"string\"]}"), s.getField("strings").schema()); } - + @AvroSchema("\"null\"") // record public class R13 {} @@ -422,7 +422,7 @@ public class R13 {} Schema s = ReflectData.get().getSchema(R13.class); assertEquals(Schema.Type.NULL, s.getType()); } - + public interface P4 { @AvroSchema("\"int\"") // message value Object foo(@AvroSchema("\"int\"")Object x); // message param @@ -506,45 +506,45 @@ public static class R { int a; long b; } +"{\"name\":\"a\",\"type\":\"int\"}," +"{\"name\":\"b\",\"type\":\"long\"}]}"); } - + public static class RAvroIgnore { @AvroIgnore int a; } @Test public void testAnnotationAvroIgnore() throws Exception { check(RAvroIgnore.class, "{\"type\":\"record\",\"name\":\"RAvroIgnore\",\"namespace\":" +"\"org.apache.avro.reflect.TestReflect$\",\"fields\":[]}"); } - + public static class RAvroMeta { @AvroMeta(key="K", value="V") int a; } @Test public void testAnnotationAvroMeta() throws Exception { check(RAvroMeta.class, "{\"type\":\"record\",\"name\":\"RAvroMeta\",\"namespace\":" - +"\"org.apache.avro.reflect.TestReflect$\",\"fields\":[" + +"\"org.apache.avro.reflect.TestReflect$\",\"fields\":[" +"{\"name\":\"a\",\"type\":\"int\",\"K\":\"V\"}]}"); } - + public static class RAvroName { @AvroName("b") int a; } @Test public void testAnnotationAvroName() throws Exception { check(RAvroName.class, "{\"type\":\"record\",\"name\":\"RAvroName\",\"namespace\":" - +"\"org.apache.avro.reflect.TestReflect$\",\"fields\":[" + +"\"org.apache.avro.reflect.TestReflect$\",\"fields\":[" +"{\"name\":\"b\",\"type\":\"int\"}]}"); } - + public static class RAvroNameCollide { @AvroName("b") int a; int b; } @Test(expected=Exception.class) public void testAnnotationAvroNameCollide() throws Exception { check(RAvroNameCollide.class, "{\"type\":\"record\",\"name\":\"RAvroNameCollide\",\"namespace\":" - +"\"org.apache.avro.reflect.TestReflect$\",\"fields\":[" - +"{\"name\":\"b\",\"type\":\"int\"}," + +"\"org.apache.avro.reflect.TestReflect$\",\"fields\":[" + +"{\"name\":\"b\",\"type\":\"int\"}," +"{\"name\":\"b\",\"type\":\"int\"}]}"); } - + public static class RAvroStringableField { @Stringable int a; } public void testAnnotationAvroStringableFields() throws Exception { check(RAvroStringableField.class, "{\"type\":\"record\",\"name\":\"RAvroNameCollide\",\"namespace\":" - +"\"org.apache.avro.reflect.TestReflect$\",\"fields\":[" + +"\"org.apache.avro.reflect.TestReflect$\",\"fields\":[" +"{\"name\":\"a\",\"type\":\"String\"}]}"); } - - - + + + private void check(Object o, String schemaJson) { check(o.getClass(), schemaJson); @@ -557,14 +557,14 @@ private void check(Type type, String schemaJson) { @Test public void testRecordIO() throws IOException { Schema schm = ReflectData.get().getSchema(SampleRecord.class); - ReflectDatumWriter writer = + ReflectDatumWriter writer = new ReflectDatumWriter(schm); ByteArrayOutputStream out = new ByteArrayOutputStream(); SampleRecord record = new SampleRecord(); record.x = 5; record.y = 10; writer.write(record, factory.directBinaryEncoder(out, null)); - ReflectDatumReader reader = + ReflectDatumReader reader = new ReflectDatumReader(schm); SampleRecord decoded = reader.read(null, DecoderFactory.get().binaryDecoder( @@ -575,19 +575,19 @@ public void testRecordIO() throws IOException { public static class AvroEncRecord { @AvroEncode(using=DateAsLongEncoding.class) java.util.Date date; - - @Override + + @Override public boolean equals(Object o) { if (!(o instanceof AvroEncRecord)) return false; return date.equals(((AvroEncRecord)o).date); } } - + public static class multipleAnnotationRecord { @AvroIgnore @Stringable Integer i1; - + @AvroIgnore @Nullable Integer i2; @@ -595,27 +595,27 @@ public static class multipleAnnotationRecord { @AvroIgnore @AvroName("j") Integer i3; - + @AvroIgnore @AvroEncode(using=DateAsLongEncoding.class) java.util.Date i4; - + @Stringable @Nullable Integer i5; - + @Stringable @AvroName("j6") - Integer i6 = 6; - + Integer i6 = 6; + @Stringable @AvroEncode(using=DateAsLongEncoding.class) java.util.Date i7 = new java.util.Date(7L); - + @Nullable @AvroName("j8") - Integer i8; - + Integer i8; + @Nullable @AvroEncode(using=DateAsLongEncoding.class) java.util.Date i9; @@ -630,11 +630,11 @@ public static class multipleAnnotationRecord { @AvroEncode(using=DateAsLongEncoding.class) java.util.Date i11; } - + @Test public void testMultipleAnnotations() throws IOException { Schema schm = ReflectData.get().getSchema(multipleAnnotationRecord.class); - ReflectDatumWriter writer = + ReflectDatumWriter writer = new ReflectDatumWriter(schm); ByteArrayOutputStream out = new ByteArrayOutputStream(); multipleAnnotationRecord record = new multipleAnnotationRecord(); @@ -649,9 +649,9 @@ public void testMultipleAnnotations() throws IOException { record.i9 = new java.util.Date(9L); record.i10 = new java.util.Date(10L); record.i11 = new java.util.Date(11L); - + writer.write(record, factory.directBinaryEncoder(out, null)); - ReflectDatumReader reader = + ReflectDatumReader reader = new ReflectDatumReader(schm); multipleAnnotationRecord decoded = reader.read(new multipleAnnotationRecord(), DecoderFactory.get().binaryDecoder( @@ -668,8 +668,8 @@ public void testMultipleAnnotations() throws IOException { assertTrue(decoded.i10.getTime() == 10); assertTrue(decoded.i11.getTime() == 11); } - - + + @Test public void testAvroEncodeInducing() throws IOException { Schema schm = ReflectData.get().getSchema(AvroEncRecord.class); @@ -677,29 +677,29 @@ public void testAvroEncodeInducing() throws IOException { "\":\"org.apache.avro.reflect.TestReflect$\",\"fields\":[{\"name\":\"date\"," + "\"type\":{\"type\":\"long\",\"CustomEncoding\":\"DateAsLongEncoding\"}}]}"); } - + @Test public void testAvroEncodeIO() throws IOException { Schema schm = ReflectData.get().getSchema(AvroEncRecord.class); - ReflectDatumWriter writer = + ReflectDatumWriter writer = new ReflectDatumWriter(schm); ByteArrayOutputStream out = new ByteArrayOutputStream(); AvroEncRecord record = new AvroEncRecord(); record.date = new java.util.Date(948833323L); writer.write(record, factory.directBinaryEncoder(out, null)); - ReflectDatumReader reader = + ReflectDatumReader reader = new ReflectDatumReader(schm); AvroEncRecord decoded = reader.read(new AvroEncRecord(), DecoderFactory.get().binaryDecoder( out.toByteArray(), null)); assertEquals(record, decoded); } - + @Test public void testRecordWithNullIO() throws IOException { ReflectData reflectData = ReflectData.AllowNull.get(); Schema schm = reflectData.getSchema(AnotherSampleRecord.class); - ReflectDatumWriter writer = + ReflectDatumWriter writer = new ReflectDatumWriter(schm); ByteArrayOutputStream out = new ByteArrayOutputStream(); // keep record.a null and see if that works @@ -709,7 +709,7 @@ public void testRecordWithNullIO() throws IOException { AnotherSampleRecord b = new AnotherSampleRecord(10); writer.write(b, e); e.flush(); - ReflectDatumReader reader = + ReflectDatumReader reader = new ReflectDatumReader(schm); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); Decoder d = DecoderFactory.get().binaryDecoder(in, null); @@ -761,7 +761,7 @@ public boolean equals(Object obj) { return false; return true; } - + public static class AnotherSampleRecord { private Integer a = null; private SampleRecord s = null; @@ -823,7 +823,7 @@ public static interface P3 { } @Test(expected=AvroTypeException.class) - public void testOverloadedMethod() { + public void testOverloadedMethod() { ReflectData.get().getProtocol(P3.class); } @@ -860,17 +860,17 @@ public void testReflectWithinGeneric() throws Exception { // test that this instance can be written & re-read checkBinary(schema, record); } - + @Test public void testPrimitiveArray() throws Exception { testPrimitiveArrays(false); } - + @Test public void testPrimitiveArrayBlocking() throws Exception { testPrimitiveArrays(true); } - + private void testPrimitiveArrays(boolean blocking) throws Exception { testPrimitiveArray(boolean.class, blocking); testPrimitiveArray(byte.class, blocking); @@ -984,7 +984,7 @@ public static void checkBinary(ReflectData reflectData, Schema schema, Object datum, boolean equals) throws IOException { checkBinary(reflectData, schema, datum, equals, false); } - + private static void checkBinary(ReflectData reflectData, Schema schema, Object datum, boolean equals, boolean blocking) throws IOException { ReflectDatumWriter writer = new ReflectDatumWriter(schema); @@ -1026,20 +1026,20 @@ private static class AliasA { } @AvroAlias(alias="a", space="") private static class AliasB { } @AvroAlias(alias="a") - private static class AliasC { } - + private static class AliasC { } + @Test public void testAvroAlias() { check(AliasA.class, "{\"type\":\"record\",\"name\":\"AliasA\",\"namespace\":\"org.apache.avro.reflect.TestReflect$\",\"fields\":[],\"aliases\":[\"b.a\"]}"); check(AliasB.class, "{\"type\":\"record\",\"name\":\"AliasB\",\"namespace\":\"org.apache.avro.reflect.TestReflect$\",\"fields\":[],\"aliases\":[\"a\"]}"); - check(AliasC.class, "{\"type\":\"record\",\"name\":\"AliasC\",\"namespace\":\"org.apache.avro.reflect.TestReflect$\",\"fields\":[],\"aliases\":[\"a\"]}"); + check(AliasC.class, "{\"type\":\"record\",\"name\":\"AliasC\",\"namespace\":\"org.apache.avro.reflect.TestReflect$\",\"fields\":[],\"aliases\":[\"a\"]}"); } private static class DefaultTest { @AvroDefault("1") int foo; - } - + } + @Test public void testAvroDefault() { check(DefaultTest.class, diff --git a/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflectionUtil.java b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflectionUtil.java index 4414d20270f..9d017f285bd 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflectionUtil.java +++ b/lang/java/avro/src/test/java/org/apache/avro/reflect/TestReflectionUtil.java @@ -35,13 +35,13 @@ public void testUnsafeWhenNotExists() throws Exception { Class testerClass = cl.loadClass(Tester.class.getName()); testerClass.getDeclaredMethod("checkUnsafe").invoke(testerClass.newInstance()); } - + public static final class Tester { public Tester() {} public void checkUnsafe() { ReflectionUtil.getFieldAccess(); } - + } private static final class NoUnsafe extends ClassLoader { diff --git a/lang/java/avro/src/test/java/org/apache/avro/util/CaseFinder.java b/lang/java/avro/src/test/java/org/apache/avro/util/CaseFinder.java index ddfc2a892ef..2f24a743951 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/util/CaseFinder.java +++ b/lang/java/avro/src/test/java/org/apache/avro/util/CaseFinder.java @@ -187,7 +187,7 @@ private static String processHereDoc(BufferedReader in, String docStart) // Determine if this is a single-line heredoc, and process if it is String singleLineText = m.group(2); if (singleLineText.length() != 0) { - if (! singleLineText.startsWith(" ")) + if (! singleLineText.startsWith(" ")) throw new IOException("Single-line heredoc missing initial space (\""+docStart+"\")"); return singleLineText.substring(1); } diff --git a/lang/java/avro/src/test/java/org/apache/avro/util/TestUtf8.java b/lang/java/avro/src/test/java/org/apache/avro/util/TestUtf8.java index 758e3e5fd7a..2c5e771bf28 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/util/TestUtf8.java +++ b/lang/java/avro/src/test/java/org/apache/avro/util/TestUtf8.java @@ -35,9 +35,9 @@ public class TestUtf8 { assertEquals(bs[i], u.getBytes()[i]); } } - + @Test public void testArrayReusedWhenLargerThanRequestedSize() throws UnsupportedEncodingException { - byte[] bs = "55555".getBytes("UTF-8"); + byte[] bs = "55555".getBytes("UTF-8"); Utf8 u = new Utf8(bs); assertEquals(5, u.getByteLength()); byte[] content = u.getBytes(); diff --git a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/ProtocolTask.java b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/ProtocolTask.java index 23f8d7e53c4..36bf67b51c8 100644 --- a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/ProtocolTask.java +++ b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/ProtocolTask.java @@ -38,22 +38,22 @@ public class ProtocolTask extends Task { private StringType stringType = StringType.CharSequence; private final ArrayList filesets = new ArrayList(); - + /** Set the schema file. */ public void setFile(File file) { this.src = file; } - + /** Set the output directory */ public void setDestdir(File dir) { this.dest = dir; } - + /** Set the string type. */ public void setStringType(StringType type) { this.stringType = type; } - + /** Get the string type. */ public StringType getStringType() { return this.stringType; } - + /** Add a fileset. */ public void addFileset(FileSet set) { filesets.add(set); } - + /** Run the compiler. */ @Override public void execute() { @@ -74,7 +74,7 @@ public void execute() { } } } - + protected void doCompile(File src, File dir) throws IOException { Protocol protocol = Protocol.parse(src); SpecificCompiler compiler = new SpecificCompiler(protocol); diff --git a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java index 6faf3687287..823a2ef298d 100644 --- a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java +++ b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java @@ -103,7 +103,7 @@ public boolean isCreateAllArgsConstructor() { } /* Reserved words for accessor/mutator methods */ - private static final Set ACCESSOR_MUTATOR_RESERVED_WORDS = + private static final Set ACCESSOR_MUTATOR_RESERVED_WORDS = new HashSet(Arrays.asList(new String[] { "class", "schema", "classSchema" })); @@ -111,7 +111,7 @@ public boolean isCreateAllArgsConstructor() { // Add reserved words to accessor/mutator reserved words ACCESSOR_MUTATOR_RESERVED_WORDS.addAll(RESERVED_WORDS); } - + /* Reserved words for error types */ private static final Set ERROR_RESERVED_WORDS = new HashSet( Arrays.asList(new String[] { "message", "cause" })); @@ -119,14 +119,14 @@ public boolean isCreateAllArgsConstructor() { // Add accessor/mutator reserved words to error reserved words ERROR_RESERVED_WORDS.addAll(ACCESSOR_MUTATOR_RESERVED_WORDS); } - - private static final String FILE_HEADER = + + private static final String FILE_HEADER = "/**\n" + " * Autogenerated by Avro\n" + - " * \n" + + " *\n" + " * DO NOT EDIT DIRECTLY\n" + " */\n"; - + public SpecificCompiler(Protocol protocol) { this(); // enqueue all types @@ -141,7 +141,7 @@ public SpecificCompiler(Schema schema) { enqueue(schema); this.protocol = null; } - + SpecificCompiler() { this.templateDir = System.getProperty("org.apache.avro.specific.templates", @@ -206,7 +206,7 @@ private void initializeVelocity() { velocityEngine.addProperty("resource.loader", "class, file"); velocityEngine.addProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); - velocityEngine.addProperty("file.resource.loader.class", + velocityEngine.addProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.FileResourceLoader"); velocityEngine.addProperty("file.resource.loader.path", "/, ."); velocityEngine.setProperty("runtime.references.strict", true); @@ -547,7 +547,7 @@ private String getStringType(JsonNode overrideClassProperty) { default: throw new RuntimeException("Unknown string type: "+stringType); } } - + private static final Schema NULL_SCHEMA = Schema.create(Schema.Type.NULL); /** Utility for template use. Returns the java type for a Schema. */ @@ -628,7 +628,7 @@ public String javaSplit(String s) throws IOException { b.append("\""); // final quote return b.toString(); } - + /** Utility for template use. Escapes quotes and backslashes. */ public static String javaEscape(Object o) { return o.toString().replace("\\","\\\\").replace("\"", "\\\""); @@ -638,7 +638,7 @@ public static String javaEscape(Object o) { public static String escapeForJavadoc(String s) { return s.replace("*/", "*/"); } - + /** Utility for template use. Returns empty string for null. */ public static String nullToEmpty(String x) { return x == null ? "" : x; @@ -648,19 +648,19 @@ public static String nullToEmpty(String x) { public static String mangle(String word) { return mangle(word, false); } - + /** Utility for template use. Adds a dollar sign to reserved words. */ public static String mangle(String word, boolean isError) { return mangle(word, isError ? ERROR_RESERVED_WORDS : RESERVED_WORDS); } - + /** Utility for template use. Adds a dollar sign to reserved words. */ public static String mangle(String word, Set reservedWords) { return mangle(word, reservedWords, false); } - + /** Utility for template use. Adds a dollar sign to reserved words. */ - public static String mangle(String word, Set reservedWords, + public static String mangle(String word, Set reservedWords, boolean isMethod) { if (word.contains(".")) { // If the 'word' is really a full path of a class we must mangle just the classname @@ -669,15 +669,15 @@ public static String mangle(String word, Set reservedWords, String className = word.substring(lastDot + 1); return packageName + mangle(className, reservedWords, isMethod); } - if (reservedWords.contains(word) || + if (reservedWords.contains(word) || (isMethod && reservedWords.contains( - Character.toLowerCase(word.charAt(0)) + + Character.toLowerCase(word.charAt(0)) + ((word.length() > 1) ? word.substring(1) : "")))) { return word + "$"; } return word; } - + /** Utility for use by templates. Return schema fingerprint as a long. */ public static long fingerprint64(Schema schema) { return SchemaNormalization.parsingFingerprint64(schema); @@ -692,7 +692,7 @@ public static long fingerprint64(Schema schema) { public static String generateGetMethod(Schema schema, Field field) { return generateMethodName(schema, field, "get", ""); } - + /** * Generates the name of a field mutator method. * @param schema the schema in which the field is defined. @@ -702,7 +702,7 @@ public static String generateGetMethod(Schema schema, Field field) { public static String generateSetMethod(Schema schema, Field field) { return generateMethodName(schema, field, "set", ""); } - + /** * Generates the name of a field "has" method. * @param schema the schema in which the field is defined. @@ -712,7 +712,7 @@ public static String generateSetMethod(Schema schema, Field field) { public static String generateHasMethod(Schema schema, Field field) { return generateMethodName(schema, field, "has", ""); } - + /** * Generates the name of a field "clear" method. * @param schema the schema in which the field is defined. @@ -722,7 +722,7 @@ public static String generateHasMethod(Schema schema, Field field) { public static String generateClearMethod(Schema schema, Field field) { return generateMethodName(schema, field, "clear", ""); } - + /** Utility for use by templates. Does this schema have a Builder method? */ public static boolean hasBuilder(Schema schema) { switch (schema.getType()) { @@ -779,20 +779,20 @@ public static String generateHasBuilderMethod(Schema schema, Field field) { * @param postfix method name postfix, e.g. "" or "Builder". * @return the generated method name. */ - private static String generateMethodName(Schema schema, Field field, + private static String generateMethodName(Schema schema, Field field, String prefix, String postfix) { - // Check for the special case in which the schema defines two fields whose + // Check for the special case in which the schema defines two fields whose // names are identical except for the case of the first character: char firstChar = field.name().charAt(0); String conflictingFieldName = (Character.isLowerCase(firstChar) ? Character.toUpperCase(firstChar) : Character.toLowerCase(firstChar)) + (field.name().length() > 1 ? field.name().substring(1) : ""); boolean fieldNameConflict = schema.getField(conflictingFieldName) != null; - + StringBuilder methodBuilder = new StringBuilder(prefix); - String fieldName = mangle(field.name(), - schema.isError() ? ERROR_RESERVED_WORDS : + String fieldName = mangle(field.name(), + schema.isError() ? ERROR_RESERVED_WORDS : ACCESSOR_MUTATOR_RESERVED_WORDS, true); boolean nextCharToUpper = true; @@ -809,7 +809,7 @@ else if (nextCharToUpper) { } } methodBuilder.append(postfix); - + // If there is a field name conflict append $0 or $1 if (fieldNameConflict) { if (methodBuilder.charAt(methodBuilder.length() - 1) != '$') { @@ -820,7 +820,7 @@ else if (nextCharToUpper) { return methodBuilder.toString(); } - + /** Tests whether an unboxed Java type can be set to null */ public static boolean isUnboxedJavaTypeNullable(Schema schema) { switch (schema.getType()) { @@ -838,7 +838,7 @@ public static void main(String[] args) throws Exception { //compileSchema(new File(args[0]), new File(args[1])); compileProtocol(new File(args[0]), new File(args[1])); } - + public static final class Slf4jLogChute implements LogChute { private Logger logger = LoggerFactory.getLogger("AvroVelocityLogChute"); @Override diff --git a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/enum.vm b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/enum.vm index 2056b1daf99..2117cd415f4 100644 --- a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/enum.vm +++ b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/enum.vm @@ -16,8 +16,8 @@ ## limitations under the License. ## #if ($schema.getNamespace()) -package $schema.getNamespace(); -#end +package $schema.getNamespace(); +#end @SuppressWarnings("all") #if ($schema.getDoc()) /** $schema.getDoc() */ @@ -26,7 +26,7 @@ package $schema.getNamespace(); @$annotation #end @org.apache.avro.specific.AvroGenerated -public enum ${this.mangle($schema.getName())} { +public enum ${this.mangle($schema.getName())} { #foreach ($symbol in ${schema.getEnumSymbols()})${this.mangle($symbol)}#if ($velocityHasNext), #end#end ; public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("${this.javaEscape($schema.toString())}"); diff --git a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/fixed.vm b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/fixed.vm index aff35971608..b19e1b1e660 100644 --- a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/fixed.vm +++ b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/fixed.vm @@ -16,7 +16,7 @@ ## limitations under the License. ## #if ($schema.getNamespace()) -package $schema.getNamespace(); +package $schema.getNamespace(); #end @SuppressWarnings("all") #if ($schema.getDoc()) @@ -32,22 +32,22 @@ public class ${this.mangle($schema.getName())} extends org.apache.avro.specific. public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("${this.javaEscape($schema.toString())}"); public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } public org.apache.avro.Schema getSchema() { return SCHEMA$; } - + /** Creates a new ${this.mangle($schema.getName())} */ public ${this.mangle($schema.getName())}() { super(); } - + /** * Creates a new ${this.mangle($schema.getName())} with the given bytes. - * @param bytes The bytes to create the new ${this.mangle($schema.getName())}. + * @param bytes The bytes to create the new ${this.mangle($schema.getName())}. */ public ${this.mangle($schema.getName())}(byte[] bytes) { super(bytes); } private static final org.apache.avro.io.DatumWriter - WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$); + WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$); @Override public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException { @@ -55,7 +55,7 @@ public class ${this.mangle($schema.getName())} extends org.apache.avro.specific. } private static final org.apache.avro.io.DatumReader - READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$); + READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$); @Override public void readExternal(java.io.ObjectInput in) throws java.io.IOException { diff --git a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm index d0c19683a3a..3e26df58042 100644 --- a/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm +++ b/lang/java/compiler/src/main/velocity/org/apache/avro/compiler/specific/templates/java/classic/record.vm @@ -16,7 +16,7 @@ ## limitations under the License. ## #if ($schema.getNamespace()) -package $schema.getNamespace(); +package $schema.getNamespace(); #end import org.apache.avro.specific.SpecificData; @@ -47,7 +47,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or public ${this.mangle($schema.getName())}() { super(); } - + public ${this.mangle($schema.getName())}(Object value) { super(value); } @@ -59,14 +59,14 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or public ${this.mangle($schema.getName())}(Object value, Throwable cause) { super(value, cause); } - + #else -#if ($schema.getFields().size() > 0) +#if ($schema.getFields().size() > 0) /** * Default constructor. Note that this does not initialize fields * to their default values from the schema. If that is desired then - * one should use newBuilder(). + * one should use newBuilder(). */ public ${this.mangle($schema.getName())}() {} #if ($this.isCreateAllArgsConstructor()) @@ -96,7 +96,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or #end public org.apache.avro.Schema getSchema() { return SCHEMA$; } - // Used by DatumWriter. Applications should not call. + // Used by DatumWriter. Applications should not call. public java.lang.Object get(int field$) { switch (field$) { #set ($i = 0) @@ -107,7 +107,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or default: throw new org.apache.avro.AvroRuntimeException("Bad index"); } } - // Used by DatumReader. Applications should not call. + // Used by DatumReader. Applications should not call. @SuppressWarnings(value="unchecked") public void put(int field$, java.lang.Object value$) { switch (field$) { @@ -151,7 +151,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or public static #if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder newBuilder() { return new #if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder(); } - + /** * Creates a new ${this.mangle($schema.getName())} RecordBuilder by copying an existing Builder. * @param other The existing builder to copy. @@ -160,7 +160,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or public static #if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder newBuilder(#if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder other) { return new #if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder(other); } - + /** * Creates a new ${this.mangle($schema.getName())} RecordBuilder by copying an existing $this.mangle($schema.getName()) instance. * @param other The existing instance to copy. @@ -169,7 +169,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or public static #if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder newBuilder(#if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())} other) { return new #if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder(other); } - + /** * RecordBuilder for ${this.mangle($schema.getName())} instances. */ @@ -191,7 +191,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or private Builder() { super(SCHEMA$); } - + /** * Creates a Builder by copying an existing Builder. * @param other The existing Builder to copy. @@ -210,7 +210,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or #end #end } - + /** * Creates a Builder by copying an existing $this.mangle($schema.getName()) instance * @param other The existing instance to copy. @@ -235,7 +235,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or super.setValue(value); return this; } - + @Override public #if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder clearValue() { super.clearValue(); @@ -247,7 +247,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or super.setCause(cause); return this; } - + @Override public #if ($schema.getNamespace())$schema.getNamespace().#end${this.mangle($schema.getName())}.Builder clearCause() { super.clearCause(); @@ -280,7 +280,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or #end this.${this.mangle($field.name(), $schema.isError())} = value; fieldSetFlags()[$field.pos()] = true; - return this; + return this; } /** @@ -376,7 +376,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or } private static final org.apache.avro.io.DatumWriter - WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$); + WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$); @Override public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException { @@ -384,7 +384,7 @@ public class ${this.mangle($schema.getName())}#if ($schema.isError()) extends or } private static final org.apache.avro.io.DatumReader - READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$); + READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$); @Override public void readExternal(java.io.ObjectInput in) throws java.io.IOException { diff --git a/lang/java/compiler/src/test/idl/putOnClassPath/OnTheClasspath.avdl b/lang/java/compiler/src/test/idl/putOnClassPath/OnTheClasspath.avdl index 4533c54d56c..233c0f635f2 100644 --- a/lang/java/compiler/src/test/idl/putOnClassPath/OnTheClasspath.avdl +++ b/lang/java/compiler/src/test/idl/putOnClassPath/OnTheClasspath.avdl @@ -18,7 +18,7 @@ @namespace("org.on.the.classpath") protocol OnTheClasspath { - import idl "nestedtypes.avdl"; - record FromAfar { - } + import idl "nestedtypes.avdl"; + record FromAfar { + } } diff --git a/lang/java/compiler/src/test/idl/putOnClassPath/nestedtypes.avdl b/lang/java/compiler/src/test/idl/putOnClassPath/nestedtypes.avdl index a8aafe49b74..6d2e1dae274 100644 --- a/lang/java/compiler/src/test/idl/putOnClassPath/nestedtypes.avdl +++ b/lang/java/compiler/src/test/idl/putOnClassPath/nestedtypes.avdl @@ -18,6 +18,6 @@ @namespace("org.on.the.classpath") protocol OnTheClasspathTypes { - record NestedType { - } + record NestedType { + } } diff --git a/lang/java/compiler/src/test/java/org/apache/avro/compiler/idl/TestIdl.java b/lang/java/compiler/src/test/java/org/apache/avro/compiler/idl/TestIdl.java index 7e4f68608eb..52403a220a3 100644 --- a/lang/java/compiler/src/test/java/org/apache/avro/compiler/idl/TestIdl.java +++ b/lang/java/compiler/src/test/java/org/apache/avro/compiler/idl/TestIdl.java @@ -89,7 +89,7 @@ public void runTests() throws Exception { if (! "run".equals(TEST_MODE)) return; int passed = 0, failed = 0; - + for (GenTest t : tests) { try { t.run(); @@ -136,7 +136,7 @@ private String generate() throws Exception { String newPath = currentWorkPath + "src" + File.separator + "test" + File.separator + "idl" + File.separator + "putOnClassPath" + File.separator; - URL[] newPathURL = new URL[]{new URL(newPath)}; + URL[] newPathURL = new URL[]{new URL(newPath)}; URLClassLoader ucl = new URLClassLoader(newPathURL, cl); Idl parser = new Idl(in, ucl); diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/CallFuture.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/CallFuture.java index 77561d3aa6b..588ea7dc68a 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/CallFuture.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/CallFuture.java @@ -32,14 +32,14 @@ public class CallFuture implements Future, Callback { private final Callback chainedCallback; private T result = null; private Throwable error = null; - + /** * Creates a CallFuture. */ public CallFuture() { this(null); } - + /** * Creates a CallFuture with a chained Callback which will be invoked * when this CallFuture's Callback methods are invoked. @@ -48,9 +48,9 @@ public CallFuture() { public CallFuture(Callback chainedCallback) { this.chainedCallback = chainedCallback; } - + /** - * Sets the RPC response, and unblocks all threads waiting on {@link #get()} + * Sets the RPC response, and unblocks all threads waiting on {@link #get()} * or {@link #get(long, TimeUnit)}. * @param result the RPC result to set. */ @@ -62,9 +62,9 @@ public void handleResult(T result) { chainedCallback.handleResult(result); } } - + /** - * Sets an error thrown during RPC execution, and unblocks all threads waiting + * Sets an error thrown during RPC execution, and unblocks all threads waiting * on {@link #get()} or {@link #get(long, TimeUnit)}. * @param error the RPC error to set. */ @@ -79,21 +79,21 @@ public void handleError(Throwable error) { /** * Gets the value of the RPC result without blocking. - * Using {@link #get()} or {@link #get(long, TimeUnit)} is usually - * preferred because these methods block until the result is available or - * an error occurs. - * @return the value of the response, or null if no result was returned or + * Using {@link #get()} or {@link #get(long, TimeUnit)} is usually + * preferred because these methods block until the result is available or + * an error occurs. + * @return the value of the response, or null if no result was returned or * the RPC has not yet completed. */ public T getResult() { return result; } - + /** * Gets the error that was thrown during RPC execution. Does not block. - * Either {@link #get()} or {@link #get(long, TimeUnit)} should be called + * Either {@link #get()} or {@link #get(long, TimeUnit)} should be called * first because these methods block until the RPC has completed. - * @return the RPC error that was thrown, or null if no error has occurred or + * @return the RPC error that was thrown, or null if no error has occurred or * if the RPC has not yet completed. */ public Throwable getError() { @@ -132,7 +132,7 @@ public T get(long timeout, TimeUnit unit) throw new TimeoutException(); } } - + /** * Waits for the CallFuture to complete without returning the result. * @throws InterruptedException if interrupted. @@ -140,7 +140,7 @@ public T get(long timeout, TimeUnit unit) public void await() throws InterruptedException { latch.await(); } - + /** * Waits for the CallFuture to complete without returning the result. * @param timeout the maximum time to wait. @@ -148,7 +148,7 @@ public void await() throws InterruptedException { * @throws InterruptedException if interrupted. * @throws TimeoutException if the wait timed out. */ - public void await(long timeout, TimeUnit unit) + public void await(long timeout, TimeUnit unit) throws InterruptedException, TimeoutException { if (!latch.await(timeout, unit)) { throw new TimeoutException(); diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/Callback.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/Callback.java index fdad4a70bf4..a09972553f8 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/Callback.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/Callback.java @@ -20,8 +20,8 @@ /** * Interface for receiving asynchronous callbacks. - * For each request with an asynchronous callback, - * either {@link #handleResult(Object)} or {@link #handleError(Throwable)} + * For each request with an asynchronous callback, + * either {@link #handleResult(Object)} or {@link #handleError(Throwable)} * will be invoked. */ public interface Callback { @@ -30,7 +30,7 @@ public interface Callback { * @param result the result returned in the callback. */ void handleResult(T result); - + /** * Receives an error. * @param error the error returned in the callback. diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/DatagramServer.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/DatagramServer.java index f0a8f1bfea5..4990bf0cff0 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/DatagramServer.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/DatagramServer.java @@ -66,7 +66,7 @@ public void run() { } } } - + public void close() { this.interrupt(); } public static void main(String[] arg) throws Exception { diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/HttpTransceiver.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/HttpTransceiver.java index 9f6572f0571..11c9ebb7ff6 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/HttpTransceiver.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/HttpTransceiver.java @@ -31,13 +31,13 @@ /** An HTTP-based {@link Transceiver} implementation. */ public class HttpTransceiver extends Transceiver { - static final String CONTENT_TYPE = "avro/binary"; + static final String CONTENT_TYPE = "avro/binary"; private URL url; private Proxy proxy; private HttpURLConnection connection; private int timeout; - + public HttpTransceiver(URL url) { this.url = url; } public HttpTransceiver(URL url, Proxy proxy) { @@ -49,7 +49,7 @@ public HttpTransceiver(URL url, Proxy proxy) { public void setTimeout(int timeout) { this.timeout = timeout; } public String getRemoteName() { return this.url.toString(); } - + public synchronized List readBuffers() throws IOException { InputStream in = connection.getInputStream(); try { diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/NettyServer.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/NettyServer.java index a86ebbeb664..534f0bfc529 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/NettyServer.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/NettyServer.java @@ -62,13 +62,13 @@ public class NettyServer implements Server { "avro-netty-server"); private final ChannelFactory channelFactory; private final CountDownLatch closed = new CountDownLatch(1); - private final ExecutionHandler executionHandler; - + private final ExecutionHandler executionHandler; + public NettyServer(Responder responder, InetSocketAddress addr) { this(responder, addr, new NioServerSocketChannelFactory (Executors .newCachedThreadPool(), Executors.newCachedThreadPool())); } - + public NettyServer(Responder responder, InetSocketAddress addr, ChannelFactory channelFactory) { this(responder, addr, channelFactory, null); @@ -123,12 +123,12 @@ public ChannelPipeline getPipeline() throws Exception { } }, executionHandler); } - + @Override public void start() { // No-op. } - + @Override public void close() { ChannelGroupFuture future = allChannels.close(); @@ -136,7 +136,7 @@ public void close() { channelFactory.releaseExternalResources(); closed.countDown(); } - + @Override public int getPort() { return ((InetSocketAddress) serverChannel.getLocalAddress()).getPort(); @@ -146,7 +146,7 @@ public int getPort() { public void join() throws InterruptedException { closed.await(); } - + /** * * @return The number of clients currently connected to this server. @@ -158,12 +158,12 @@ public int getNumActiveConnections() { } /** - * Avro server handler for the Netty transport + * Avro server handler for the Netty transport */ class NettyServerAvroHandler extends SimpleChannelUpstreamHandler { private NettyTransceiver connectionMetadata = new NettyTransceiver(); - + @Override public void handleUpstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { @@ -189,7 +189,7 @@ public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) { // response will be null for oneway messages. if(res != null) { dataPack.setDatas(res); - e.getChannel().write(dataPack); + e.getChannel().write(dataPack); } } catch (IOException ex) { LOG.warn("unexpect error"); diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/NettyTransceiver.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/NettyTransceiver.java index a8a2e3df393..0d7dfb7247c 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/NettyTransceiver.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/NettyTransceiver.java @@ -61,24 +61,24 @@ public class NettyTransceiver extends Transceiver { /** If not specified, the default connection timeout will be used (60 sec). */ public static final long DEFAULT_CONNECTION_TIMEOUT_MILLIS = 60 * 1000L; - public static final String NETTY_CONNECT_TIMEOUT_OPTION = + public static final String NETTY_CONNECT_TIMEOUT_OPTION = "connectTimeoutMillis"; public static final String NETTY_TCP_NODELAY_OPTION = "tcpNoDelay"; public static final String NETTY_KEEPALIVE_OPTION = "keepAlive"; public static final boolean DEFAULT_TCP_NODELAY_VALUE = true; - + private static final Logger LOG = LoggerFactory.getLogger(NettyTransceiver.class .getName()); private final AtomicInteger serialGenerator = new AtomicInteger(0); - private final Map>> requests = + private final Map>> requests = new ConcurrentHashMap>>(); - + private final ChannelFactory channelFactory; private final long connectTimeoutMillis; private final ClientBootstrap bootstrap; private final InetSocketAddress remoteAddr; - + volatile ChannelFuture channelFuture; volatile boolean stopping; private final Object channelFutureLock = new Object(); @@ -101,7 +101,7 @@ public class NettyTransceiver extends Transceiver { /** * Creates a NettyTransceiver, and attempts to connect to the given address. - * {@link #DEFAULT_CONNECTION_TIMEOUT_MILLIS} is used for the connection + * {@link #DEFAULT_CONNECTION_TIMEOUT_MILLIS} is used for the connection * timeout. * @param addr the address to connect to. * @throws IOException if an error occurs connecting to the given address. @@ -109,75 +109,75 @@ public class NettyTransceiver extends Transceiver { public NettyTransceiver(InetSocketAddress addr) throws IOException { this(addr, DEFAULT_CONNECTION_TIMEOUT_MILLIS); } - + /** * Creates a NettyTransceiver, and attempts to connect to the given address. * @param addr the address to connect to. - * @param connectTimeoutMillis maximum amount of time to wait for connection - * establishment in milliseconds, or null to use + * @param connectTimeoutMillis maximum amount of time to wait for connection + * establishment in milliseconds, or null to use * {@link #DEFAULT_CONNECTION_TIMEOUT_MILLIS}. * @throws IOException if an error occurs connecting to the given address. */ - public NettyTransceiver(InetSocketAddress addr, + public NettyTransceiver(InetSocketAddress addr, Long connectTimeoutMillis) throws IOException { this(addr, new NioClientSocketChannelFactory( Executors.newCachedThreadPool(new NettyTransceiverThreadFactory( - "Avro " + NettyTransceiver.class.getSimpleName() + " Boss")), + "Avro " + NettyTransceiver.class.getSimpleName() + " Boss")), Executors.newCachedThreadPool(new NettyTransceiverThreadFactory( - "Avro " + NettyTransceiver.class.getSimpleName() + " I/O Worker"))), + "Avro " + NettyTransceiver.class.getSimpleName() + " I/O Worker"))), connectTimeoutMillis); } /** * Creates a NettyTransceiver, and attempts to connect to the given address. - * {@link #DEFAULT_CONNECTION_TIMEOUT_MILLIS} is used for the connection + * {@link #DEFAULT_CONNECTION_TIMEOUT_MILLIS} is used for the connection * timeout. * @param addr the address to connect to. * @param channelFactory the factory to use to create a new Netty Channel. * @throws IOException if an error occurs connecting to the given address. */ - public NettyTransceiver(InetSocketAddress addr, ChannelFactory channelFactory) + public NettyTransceiver(InetSocketAddress addr, ChannelFactory channelFactory) throws IOException { this(addr, channelFactory, buildDefaultBootstrapOptions(null)); } - + /** * Creates a NettyTransceiver, and attempts to connect to the given address. * @param addr the address to connect to. * @param channelFactory the factory to use to create a new Netty Channel. - * @param connectTimeoutMillis maximum amount of time to wait for connection - * establishment in milliseconds, or null to use + * @param connectTimeoutMillis maximum amount of time to wait for connection + * establishment in milliseconds, or null to use * {@link #DEFAULT_CONNECTION_TIMEOUT_MILLIS}. * @throws IOException if an error occurs connecting to the given address. */ - public NettyTransceiver(InetSocketAddress addr, ChannelFactory channelFactory, + public NettyTransceiver(InetSocketAddress addr, ChannelFactory channelFactory, Long connectTimeoutMillis) throws IOException { - this(addr, channelFactory, + this(addr, channelFactory, buildDefaultBootstrapOptions(connectTimeoutMillis)); } - + /** * Creates a NettyTransceiver, and attempts to connect to the given address. - * It is strongly recommended that the {@link #NETTY_CONNECT_TIMEOUT_OPTION} - * option be set to a reasonable timeout value (a Long value in milliseconds) - * to prevent connect/disconnect attempts from hanging indefinitely. It is - * also recommended that the {@link #NETTY_TCP_NODELAY_OPTION} option be set + * It is strongly recommended that the {@link #NETTY_CONNECT_TIMEOUT_OPTION} + * option be set to a reasonable timeout value (a Long value in milliseconds) + * to prevent connect/disconnect attempts from hanging indefinitely. It is + * also recommended that the {@link #NETTY_TCP_NODELAY_OPTION} option be set * to true to minimize RPC latency. * @param addr the address to connect to. * @param channelFactory the factory to use to create a new Netty Channel. - * @param nettyClientBootstrapOptions map of Netty ClientBootstrap options + * @param nettyClientBootstrapOptions map of Netty ClientBootstrap options * to use. * @throws IOException if an error occurs connecting to the given address. */ - public NettyTransceiver(InetSocketAddress addr, ChannelFactory channelFactory, + public NettyTransceiver(InetSocketAddress addr, ChannelFactory channelFactory, Map nettyClientBootstrapOptions) throws IOException { if (channelFactory == null) { throw new NullPointerException("channelFactory is null"); } - + // Set up. this.channelFactory = channelFactory; - this.connectTimeoutMillis = (Long) + this.connectTimeoutMillis = (Long) nettyClientBootstrapOptions.get(NETTY_CONNECT_TIMEOUT_OPTION); bootstrap = new ClientBootstrap(channelFactory); remoteAddr = addr; @@ -195,7 +195,7 @@ public ChannelPipeline getPipeline() throws Exception { }); if (nettyClientBootstrapOptions != null) { - LOG.debug("Using Netty bootstrap options: " + + LOG.debug("Using Netty bootstrap options: " + nettyClientBootstrapOptions); bootstrap.setOptions(nettyClientBootstrapOptions); } @@ -220,19 +220,19 @@ public ChannelPipeline getPipeline() throws Exception { stateLock.readLock().unlock(); } } - + /** - * Creates a Netty ChannelUpstreamHandler for handling events on the + * Creates a Netty ChannelUpstreamHandler for handling events on the * Netty client channel. * @return the ChannelUpstreamHandler to use. */ protected ChannelUpstreamHandler createNettyClientAvroHandler() { return new NettyClientAvroHandler(); } - + /** * Creates the default options map for the Netty ClientBootstrap. - * @param connectTimeoutMillis connection timeout in milliseconds, or null + * @param connectTimeoutMillis connection timeout in milliseconds, or null * if no timeout is desired. * @return the map of Netty bootstrap options. */ @@ -241,25 +241,25 @@ protected static Map buildDefaultBootstrapOptions( Map options = new HashMap(3); options.put(NETTY_TCP_NODELAY_OPTION, DEFAULT_TCP_NODELAY_VALUE); options.put(NETTY_KEEPALIVE_OPTION, true); - options.put(NETTY_CONNECT_TIMEOUT_OPTION, - connectTimeoutMillis == null ? DEFAULT_CONNECTION_TIMEOUT_MILLIS : + options.put(NETTY_CONNECT_TIMEOUT_OPTION, + connectTimeoutMillis == null ? DEFAULT_CONNECTION_TIMEOUT_MILLIS : connectTimeoutMillis); return options; } - + /** * Tests whether the given channel is ready for writing. * @return true if the channel is open and ready; false otherwise. */ private static boolean isChannelReady(Channel channel) { - return (channel != null) && + return (channel != null) && channel.isOpen() && channel.isBound() && channel.isConnected(); } - + /** - * Gets the Netty channel. If the channel is not connected, first attempts + * Gets the Netty channel. If the channel is not connected, first attempts * to connect. - * NOTE: The stateLock read lock *must* be acquired before calling this + * NOTE: The stateLock read lock *must* be acquired before calling this * method. * @return the Netty channel * @throws IOException if an error occurs connecting the channel. @@ -283,13 +283,13 @@ private Channel getChannel() throws IOException { channelFuture.await(connectTimeoutMillis); } catch (InterruptedException e) { Thread.currentThread().interrupt(); // Reset interrupt flag - throw new IOException("Interrupted while connecting to " + + throw new IOException("Interrupted while connecting to " + remoteAddr); } synchronized(channelFutureLock) { if (!channelFuture.isSuccess()) { - throw new IOException("Error connecting to " + remoteAddr, + throw new IOException("Error connecting to " + remoteAddr, channelFuture.getCause()); } channel = channelFuture.getChannel(); @@ -305,20 +305,20 @@ private Channel getChannel() throws IOException { } return channel; } - + /** * Closes the connection to the remote peer if connected. */ private void disconnect() { disconnect(false, false, null); } - + /** * Closes the connection to the remote peer if connected. * @param awaitCompletion if true, will block until the close has completed. - * @param cancelPendingRequests if true, will drain the requests map and + * @param cancelPendingRequests if true, will drain the requests map and * send an IOException to all Callbacks. - * @param cause if non-null and cancelPendingRequests is true, this Throwable + * @param cause if non-null and cancelPendingRequests is true, this Throwable * will be passed to all Callbacks. */ private void disconnect(boolean awaitCompletion, boolean cancelPendingRequests, @@ -337,7 +337,7 @@ private void disconnect(boolean awaitCompletion, boolean cancelPendingRequests, if (channelFutureToCancel != null) { channelFutureToCancel.cancel(); } - + if (stateReadLockHeld) { stateLock.readLock().unlock(); } @@ -354,9 +354,9 @@ private void disconnect(boolean awaitCompletion, boolean cancelPendingRequests, channel = null; remote = null; if (cancelPendingRequests) { - // Remove all pending requests (will be canceled after relinquishing + // Remove all pending requests (will be canceled after relinquishing // write lock). - requestsToCancel = + requestsToCancel = new ConcurrentHashMap>>(requests); requests.clear(); } @@ -367,17 +367,17 @@ private void disconnect(boolean awaitCompletion, boolean cancelPendingRequests, } stateLock.writeLock().unlock(); } - + // Cancel any pending requests by sending errors to the callbacks: if ((requestsToCancel != null) && !requestsToCancel.isEmpty()) { LOG.debug("Removing " + requestsToCancel.size() + " pending request(s)."); for (Callback> request : requestsToCancel.values()) { request.handleError( - cause != null ? cause : + cause != null ? cause : new IOException(getClass().getSimpleName() + " closed")); } } - + // Close the channel: if (channelToClose != null) { ChannelFuture closeFuture = channelToClose.close(); @@ -391,35 +391,35 @@ private void disconnect(boolean awaitCompletion, boolean cancelPendingRequests, } } } - + /** * Netty channels are thread-safe, so there is no need to acquire locks. * This method is a no-op. */ @Override public void lockChannel() { - + } - + /** * Netty channels are thread-safe, so there is no need to acquire locks. * This method is a no-op. */ @Override public void unlockChannel() { - + } /** * Closes this transceiver and disconnects from the remote peer. - * Cancels all pending RPCs, sends an IOException to all pending callbacks, + * Cancels all pending RPCs, sends an IOException to all pending callbacks, * and blocks until the close has completed. */ @Override public void close() { close(true); } - + /** * Closes this transceiver and disconnects from the remote peer. * Cancels all pending RPCs and sends an IOException to all pending callbacks. @@ -450,7 +450,7 @@ public String getRemoteName() throws IOException { * Override as non-synchronized method because the method is thread safe. */ @Override - public List transceive(List request) + public List transceive(List request) throws IOException { try { CallFuture> transceiverFuture = new CallFuture>(); @@ -464,9 +464,9 @@ public List transceive(List request) return null; } } - + @Override - public void transceive(List request, + public void transceive(List request, Callback> callback) throws IOException { stateLock.readLock().lock(); try { @@ -478,7 +478,7 @@ public void transceive(List request, stateLock.readLock().unlock(); } } - + @Override public void writeBuffers(List buffers) throws IOException { ChannelFuture writeFuture; @@ -489,7 +489,7 @@ public void writeBuffers(List buffers) throws IOException { } finally { stateLock.readLock().unlock(); } - + if (!writeFuture.isDone()) { try { writeFuture.await(); @@ -502,10 +502,10 @@ public void writeBuffers(List buffers) throws IOException { throw new IOException("Error writing buffers", writeFuture.getCause()); } } - + /** * Writes a NettyDataPack, reconnecting to the remote peer if necessary. - * NOTE: The stateLock read lock *must* be acquired before calling this + * NOTE: The stateLock read lock *must* be acquired before calling this * method. * @param dataPack the data pack to write. * @return the Netty ChannelFuture for the write operation. @@ -517,9 +517,9 @@ private ChannelFuture writeDataPack(NettyDataPack dataPack) throws IOException { @Override public List readBuffers() throws IOException { - throw new UnsupportedOperationException(); + throw new UnsupportedOperationException(); } - + @Override public Protocol getRemote() { stateLock.readLock().lock(); @@ -549,23 +549,23 @@ public void setRemote(Protocol protocol) { stateLock.writeLock().unlock(); } } - + /** - * A ChannelFutureListener for channel write operations that notifies + * A ChannelFutureListener for channel write operations that notifies * a {@link Callback} if an error occurs while writing to the channel. */ protected class WriteFutureListener implements ChannelFutureListener { protected final Callback> callback; - + /** - * Creates a WriteFutureListener that notifies the given callback + * Creates a WriteFutureListener that notifies the given callback * if an error occurs writing data to the channel. * @param callback the callback to notify, or null to skip notification. */ public WriteFutureListener(Callback> callback) { this.callback = callback; } - + @Override public void operationComplete(ChannelFuture future) throws Exception { if (!future.isSuccess() && (callback != null)) { @@ -576,7 +576,7 @@ public void operationComplete(ChannelFuture future) throws Exception { } /** - * Avro client handler for the Netty transport + * Avro client handler for the Netty transport */ protected class NettyClientAvroHandler extends SimpleChannelUpstreamHandler { @@ -618,7 +618,7 @@ public void messageReceived(ChannelHandlerContext ctx, final MessageEvent e) { @Override public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) { - disconnect(false, true, e.getCause()); + disconnect(false, true, e.getCause()); } } @@ -629,18 +629,18 @@ public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) { protected static class NettyTransceiverThreadFactory implements ThreadFactory { private final AtomicInteger threadId = new AtomicInteger(0); private final String prefix; - + /** - * Creates a NettyTransceiverThreadFactory that creates threads with the + * Creates a NettyTransceiverThreadFactory that creates threads with the * specified name. - * @param prefix the name prefix to use for all threads created by this - * ThreadFactory. A unique ID will be appended to this prefix to form the + * @param prefix the name prefix to use for all threads created by this + * ThreadFactory. A unique ID will be appended to this prefix to form the * final thread name. */ public NettyTransceiverThreadFactory(String prefix) { this.prefix = prefix; } - + @Override public Thread newThread(Runnable r) { Thread thread = new Thread(r); diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/NettyTransportCodec.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/NettyTransportCodec.java index 1668c5e3afe..9a96a3722c5 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/NettyTransportCodec.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/NettyTransportCodec.java @@ -31,23 +31,23 @@ import org.jboss.netty.handler.codec.oneone.OneToOneEncoder; /** - * Data structure, encoder and decoder classes for the Netty transport. + * Data structure, encoder and decoder classes for the Netty transport. */ public class NettyTransportCodec { /** - * Transport protocol data structure when using Netty. + * Transport protocol data structure when using Netty. */ public static class NettyDataPack { private int serial; // to track each call in client side private List datas; public NettyDataPack() {} - + public NettyDataPack(int serial, List datas) { this.serial = serial; this.datas = datas; } - + public void setSerial(int serial) { this.serial = serial; } @@ -55,7 +55,7 @@ public void setSerial(int serial) { public int getSerial() { return serial; } - + public void setDatas(List datas) { this.datas = datas; } @@ -63,19 +63,19 @@ public void setDatas(List datas) { public List getDatas() { return datas; } - + } - + /** - * Protocol encoder which converts NettyDataPack which contains the - * Responder's output List<ByteBuffer> to ChannelBuffer needed + * Protocol encoder which converts NettyDataPack which contains the + * Responder's output List<ByteBuffer> to ChannelBuffer needed * by Netty. */ public static class NettyFrameEncoder extends OneToOneEncoder { /** * encode msg to ChannelBuffer - * @param msg NettyDataPack from + * @param msg NettyDataPack from * NettyServerAvroHandler/NettyClientAvroHandler in the pipeline * @return encoded ChannelBuffer */ @@ -94,7 +94,7 @@ protected Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) return ChannelBuffers .wrappedBuffer(bbs.toArray(new ByteBuffer[bbs.size()])); } - + private ByteBuffer getPackHeader(NettyDataPack dataPack) { ByteBuffer header = ByteBuffer.allocate(8); header.putInt(dataPack.getSerial()); @@ -112,8 +112,8 @@ private ByteBuffer getLengthHeader(ByteBuffer buf) { } /** - * Protocol decoder which converts Netty's ChannelBuffer to - * NettyDataPack which contains a List<ByteBuffer> needed + * Protocol decoder which converts Netty's ChannelBuffer to + * NettyDataPack which contains a List<ByteBuffer> needed * by Avro Responder. */ public static class NettyFrameDecoder extends FrameDecoder { @@ -127,7 +127,7 @@ public static class NettyFrameDecoder extends FrameDecoder { public NettyFrameDecoder() { maxMem = Runtime.getRuntime().maxMemory(); } - + /** * decode buffer to NettyDataPack */ @@ -148,9 +148,9 @@ protected Object decode(ChannelHandlerContext ctx, Channel channel, return null; } } - + } - + private boolean decodePackHeader(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception { if (buffer.readableBytes()<8) { @@ -173,7 +173,7 @@ private boolean decodePackHeader(ChannelHandlerContext ctx, Channel channel, return true; } - + private boolean decodePackBody(ChannelHandlerContext ctx, Channel channel, ChannelBuffer buffer) throws Exception { if (buffer.readableBytes() < 4) { @@ -181,7 +181,7 @@ private boolean decodePackBody(ChannelHandlerContext ctx, Channel channel, } buffer.markReaderIndex(); - + int length = buffer.readInt(); if (buffer.readableBytes() < length) { @@ -193,10 +193,10 @@ private boolean decodePackBody(ChannelHandlerContext ctx, Channel channel, buffer.readBytes(bb); bb.flip(); dataPack.getDatas().add(bb); - + return dataPack.getDatas().size()==listSize; } } - + } diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/RPCContext.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/RPCContext.java index 99a88aca33d..9eeefc421a8 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/RPCContext.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/RPCContext.java @@ -34,33 +34,33 @@ * */ public class RPCContext { - + private HandshakeRequest handshakeRequest; private HandshakeResponse handshakeResponse; protected Map requestCallMeta, responseCallMeta; - + protected Object response; protected Exception error; private Message message; List requestPayload; List responsePayload; - + /** Set the handshake request of this RPC. */ public void setHandshakeRequest(HandshakeRequest handshakeRequest) { this.handshakeRequest = handshakeRequest; } - + /** Get the handshake request of this RPC. */ public HandshakeRequest getHandshakeRequest() { return this.handshakeRequest; } - + /** Set the handshake response of this RPC. */ public void setHandshakeResponse(HandshakeResponse handshakeResponse) { this.handshakeResponse = handshakeResponse; } - + /** Get the handshake response of this RPC. */ public HandshakeResponse getHandshakeResponse() { return this.handshakeResponse; @@ -77,11 +77,11 @@ public Map requestHandshakeMeta() { handshakeRequest.meta = new HashMap(); return handshakeRequest.meta; } - + void setRequestHandshakeMeta(Map newmeta) { handshakeRequest.meta = newmeta; } - + /** * This is an access method for the handshake state * provided by the server back to the client @@ -93,11 +93,11 @@ public Map responseHandshakeMeta() { handshakeResponse.meta = new HashMap(); return handshakeResponse.meta; } - + void setResponseHandshakeMeta(Map newmeta) { handshakeResponse.meta = newmeta; } - + /** * This is an access method for the per-call state * provided by the client to the server. @@ -110,11 +110,11 @@ public Map requestCallMeta() { } return requestCallMeta; } - + void setRequestCallMeta(Map newmeta) { requestCallMeta = newmeta; } - + /** * This is an access method for the per-call state * provided by the server back to the client. @@ -127,16 +127,16 @@ public Map responseCallMeta() { } return responseCallMeta; } - + void setResponseCallMeta(Map newmeta) { responseCallMeta = newmeta; } - + void setResponse(Object response) { this.response = response; this.error = null; } - + /** * The response object generated at the server, * if it exists. If an exception was generated, @@ -147,12 +147,12 @@ void setResponse(Object response) { public Object response() { return response; } - + void setError(Exception error) { this.response = null; this.error = error; } - + /** * The exception generated at the server, * or null if no such exception has occured @@ -162,7 +162,7 @@ void setError(Exception error) { public Exception error() { return error; } - + /** * Indicates whether an exception was generated * at the server @@ -172,41 +172,41 @@ public Exception error() { public boolean isError() { return error != null; } - + /** Sets the {@link Message} corresponding to this RPC */ public void setMessage(Message message) { - this.message = message; + this.message = message; } - + /** Returns the {@link Message} corresponding to this RPC - * @return this RPC's {@link Message} + * @return this RPC's {@link Message} */ public Message getMessage() { return message; } - + /** Sets the serialized payload of the request in this RPC. Will * not include handshake or meta-data. */ public void setRequestPayload(List payload) { this.requestPayload = payload; } - + /** Returns the serialized payload of the request in this RPC. Will only be - * generated from a Requestor and will not include handshake or meta-data. + * generated from a Requestor and will not include handshake or meta-data. * If the request payload has not been set yet, returns null. - * + * * @return this RPC's request payload.*/ public List getRequestPayload() { return this.requestPayload; } - + /** Returns the serialized payload of the response in this RPC. Will only be - * generated from a Responder and will not include handshake or meta-data. + * generated from a Responder and will not include handshake or meta-data. * If the response payload has not been set yet, returns null. - * + * * @return this RPC's response payload.*/ public List getResponsePayload() { return this.responsePayload; } - + /** Sets the serialized payload of the response in this RPC. Will * not include handshake or meta-data. */ public void setResponsePayload(List payload) { diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/RPCPlugin.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/RPCPlugin.java index 64e1231536e..0dba9af0665 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/RPCPlugin.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/RPCPlugin.java @@ -24,20 +24,20 @@ * and can be set or queried by subsequent instrumentation points. */ public class RPCPlugin { - + /** * Called on the client before the initial RPC handshake to * setup any handshake metadata for this plugin * @param context the handshake rpc context */ public void clientStartConnect(RPCContext context) { } - + /** * Called on the server during the RPC handshake * @param context the handshake rpc context */ public void serverConnecting(RPCContext context) { } - + /** * Called on the client after the initial RPC handshake * @param context the handshake rpc context @@ -49,22 +49,22 @@ public void clientFinishConnect(RPCContext context) { } * @param context the per-call rpc context (in/out parameter) */ public void clientSendRequest(RPCContext context) { } - - + + /** * This method is invoked at the RPC server when the request is received, * but before the call itself is executed * @param context the per-call rpc context (in/out parameter) */ public void serverReceiveRequest(RPCContext context) { } - + /** * This method is invoked at the server before the response is executed, * but before the response has been formulated * @param context the per-call rpc context (in/out parameter) */ public void serverSendResponse(RPCContext context) { } - + /** * This method is invoked at the client after the call is executed, * and after the client receives the response @@ -72,5 +72,5 @@ public void serverSendResponse(RPCContext context) { } */ public void clientReceiveResponse(RPCContext context) { } - + } diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/Requestor.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/Requestor.java index 53799451dfe..4dfeb7ce3ce 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/Requestor.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/Requestor.java @@ -64,7 +64,7 @@ public abstract class Requestor { private volatile boolean sendLocalText; private final Transceiver transceiver; private final ReentrantLock handshakeLock = new ReentrantLock(); - + protected final List rpcMetaPlugins; public Protocol getLocal() { return local; } @@ -77,7 +77,7 @@ protected Requestor(Protocol local, Transceiver transceiver) this.rpcMetaPlugins = new CopyOnWriteArrayList(); } - + /** * Adds a new plugin to manipulate RPC metadata. Plugins * are executed in the order that they are added. @@ -88,7 +88,7 @@ public void addRPCPlugin(RPCPlugin plugin) { } private static final EncoderFactory ENCODER_FACTORY = new EncoderFactory(); - + /** Writes a request message and reads a response or error message. */ public Object request(String messageName, Object request) throws Exception { @@ -96,10 +96,10 @@ public Object request(String messageName, Object request) Request rpcRequest = new Request(messageName, request, new RPCContext()); CallFuture future = /* only need a Future for two-way messages */ rpcRequest.getMessage().isOneWay() ? null : new CallFuture(); - + // Send request request(rpcRequest, future); - + if (future == null) // the message is one-way, so return immediately return null; try { // the message is two-way, wait for the result @@ -112,7 +112,7 @@ public Object request(String messageName, Object request) } } } - + /** * Writes a request message and returns the result through a Callback. * Clients can also use a Future interface by creating a new CallFuture, @@ -120,15 +120,15 @@ public Object request(String messageName, Object request) * @param the return type of the message. * @param messageName the name of the message to invoke. * @param request the request data to send. - * @param callback the callback which will be invoked when the response is returned + * @param callback the callback which will be invoked when the response is returned * or an error occurs. * @throws Exception if an error occurs sending the message. */ - public void request(String messageName, Object request, Callback callback) + public void request(String messageName, Object request, Callback callback) throws Exception { request(new Request(messageName, request, new RPCContext()), callback); } - + /** Writes a request message and returns the result through a Callback. */ void request(Request request, Callback callback) throws Exception { @@ -166,7 +166,7 @@ void request(Request request, Callback callback) } } } - + if (request.getMessage().isOneWay()) { t.lockChannel(); try { @@ -181,7 +181,7 @@ void request(Request request, Callback callback) t.transceive(request.getBytes(), new TransceiverCallback(request, callback)); } - + } private static final ConcurrentMap REMOTE_HASHES = @@ -212,14 +212,14 @@ private void writeHandshake(Encoder out) throws IOException { handshake.serverHash = remoteHash; if (sendLocalText) handshake.clientProtocol = local.toString(); - + RPCContext context = new RPCContext(); context.setHandshakeRequest(handshake); for (RPCPlugin plugin : rpcMetaPlugins) { plugin.clientStartConnect(context); } handshake.meta = context.requestHandshakeMeta(); - + HANDSHAKE_WRITER.write(handshake, out); } @@ -246,7 +246,7 @@ private boolean readHandshake(Decoder in) throws IOException { default: throw new AvroRuntimeException("Unexpected match: "+handshake.match); } - + RPCContext context = new RPCContext(); context.setHandshakeResponse(handshake); for (RPCPlugin plugin : rpcMetaPlugins) { @@ -315,14 +315,14 @@ public Object readError(Schema schema, Decoder in) throws IOException { /** Reads an error message. */ public abstract Exception readError(Schema writer, Schema reader, Decoder in) throws IOException; - + /** * Handles callbacks from transceiver invocations. */ protected class TransceiverCallback implements Callback> { private final Request request; private final Callback callback; - + /** * Creates a TransceiverCallback. * @param request the request to set. @@ -332,7 +332,7 @@ public TransceiverCallback(Request request, Callback callback) { this.request = request; this.callback = callback; } - + @Override @SuppressWarnings("unchecked") public void handleResult(List responseBytes) { @@ -350,7 +350,7 @@ public void handleResult(List responseBytes) { } catch (Exception e) { LOG.error("Error handling transceiver callback: " + e, e); } - + // Read response; invoke callback Response response = new Response(request, in); Object responseObject; @@ -370,13 +370,13 @@ public void handleResult(List responseBytes) { LOG.error("Error in callback handler: " + t, t); } } - + @Override public void handleError(Throwable error) { callback.handleError(error); } } - + /** * Encapsulates/generates a request. */ @@ -387,7 +387,7 @@ class Request { private final BinaryEncoder encoder; private Message message; private List requestBytes; - + /** * Creates a Request. * @param messageName the name of the message to invoke. @@ -397,7 +397,7 @@ class Request { public Request(String messageName, Object request, RPCContext context) { this(messageName, request, context, null); } - + /** * Creates a Request. * @param messageName the name of the message to invoke. @@ -413,7 +413,7 @@ public Request(String messageName, Object request, RPCContext context, this.encoder = ENCODER_FACTORY.binaryEncoder(new ByteBufferOutputStream(), encoder); } - + /** * Copy constructor. * @param other Request from which to copy fields. @@ -424,7 +424,7 @@ public Request(Request other) { this.context = other.context; this.encoder = other.encoder; } - + /** * Gets the message name. * @return the message name. @@ -432,7 +432,7 @@ public Request(Request other) { public String getMessageName() { return messageName; } - + /** * Gets the RPC context. * @return the RPC context. @@ -440,7 +440,7 @@ public String getMessageName() { public RPCContext getContext() { return context; } - + /** * Gets the Message associated with this request. * @return this request's message. @@ -454,13 +454,13 @@ public Message getMessage() { } return message; } - + /** * Gets the request data, generating it first if necessary. * @return the request data. * @throws Exception if an error occurs generating the request data. */ - public List getBytes() + public List getBytes() throws Exception { if (requestBytes == null) { ByteBufferOutputStream bbo = new ByteBufferOutputStream(); @@ -493,14 +493,14 @@ public List getBytes() return requestBytes; } } - + /** * Encapsulates/parses a response. */ class Response { private final Request request; private final BinaryDecoder in; - + /** * Creates a Response. * @param request the Request associated with this response. @@ -508,7 +508,7 @@ class Response { public Response(Request request) { this(request, null); } - + /** * Creates a Creates a Response. * @param request the Request associated with this response. @@ -518,13 +518,13 @@ public Response(Request request, BinaryDecoder in) { this.request = request; this.in = in; } - + /** * Gets the RPC response, reading/deserializing it first if necessary. * @return the RPC response. * @throws Exception if an error occurs reading/deserializing the response. */ - public Object getResponse() + public Object getResponse() throws Exception { Message lm = request.getMessage(); Message rm = remote.getMessages().get(request.getMessageName()); @@ -538,7 +538,7 @@ public Object getResponse() ("Not both one-way messages: "+request.getMessageName()); if (lm.isOneWay() && t.isConnected()) return null; // one-way w/ handshake - + RPCContext context = request.getContext(); context.setResponseCallMeta(META_READER.read(null, in)); diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/Responder.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/Responder.java index 6a1a3ff4f75..322c3fb860b 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/Responder.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/Responder.java @@ -80,10 +80,10 @@ protected Responder(Protocol local) { /** Return the remote protocol. Accesses a {@link ThreadLocal} that's set * around calls to {@link #respond(Protocol.Message, Object)}. */ public static Protocol getRemote() { return REMOTE.get(); } - + /** Return the local protocol. */ public Protocol getLocal() { return local; } - + /** * Adds a new plugin to manipulate per-call metadata. Plugins * are executed in the order that they are added. @@ -98,7 +98,7 @@ public void addRPCPlugin(RPCPlugin plugin) { public List respond(List buffers) throws IOException { return respond(buffers, null); } - + /** Called by a server to deserialize a request, compute and serialize a * response or error. Transciever is used by connection-based servers to * track handshake status of connection. */ @@ -119,7 +119,7 @@ public List respond(List buffers, if (remote == null) // handshake failed return bbo.getBufferList(); handshake = bbo.getBufferList(); - + // read request using remote protocol specification context.setRequestCallMeta(META_READER.read(null, in)); String messageName = in.readString(null).toString(); @@ -134,7 +134,7 @@ public List respond(List buffers, +" in "+getLocal()); Object request = readRequest(rm.getRequest(), m.getRequest(), in); - + context.setMessage(rm); for (RPCPlugin plugin : rpcMetaPlugins) { plugin.serverReceiveRequest(context); @@ -145,7 +145,7 @@ public List respond(List buffers, throw new AvroRuntimeException("Not both one-way: "+messageName); Object response = null; - + try { REMOTE.set(remote); response = respond(m, request); @@ -157,7 +157,7 @@ public List respond(List buffers, } finally { REMOTE.set(null); } - + if (m.isOneWay() && wasConnected) // no response data return null; @@ -183,7 +183,7 @@ public List respond(List buffers, } out.flush(); payload = bbo.getBufferList(); - + // Grab meta-data from plugins context.setResponsePayload(payload); for (RPCPlugin plugin : rpcMetaPlugins) { @@ -225,7 +225,7 @@ private Protocol handshake(Decoder in, Encoder out, Transceiver connection) response.serverProtocol = local.toString(); response.serverHash = localHash; } - + RPCContext context = new RPCContext(); context.setHandshakeRequest(request); context.setHandshakeResponse(response); diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/SaslSocketTransceiver.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/SaslSocketTransceiver.java index 880c7a5d766..aba720ca92e 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/SaslSocketTransceiver.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/SaslSocketTransceiver.java @@ -55,7 +55,7 @@ private static enum Status { START, CONTINUE, FAIL, COMPLETE } private boolean saslResponsePiggybacked; private Protocol remote; - + private ByteBuffer readHeader = ByteBuffer.allocate(4); private ByteBuffer writeHeader = ByteBuffer.allocate(4); private ByteBuffer zeroHeader = ByteBuffer.allocate(4).putInt(0); @@ -128,7 +128,7 @@ private void open(boolean isClient) throws IOException { if (sasl.isComplete()) saslResponsePiggybacked = true; } - + while (!sasl.isComplete()) { Status status = readStatus(); ByteBuffer frame = readFrame(); @@ -140,7 +140,7 @@ private void open(boolean isClient) throws IOException { write(Status.FAIL, "Wrong mechanism: "+mechanism); throw new SaslException("Wrong mechanism: "+mechanism); } - case CONTINUE: + case CONTINUE: byte[] response; try { response = sasl.evaluate(frame.array()); @@ -213,7 +213,7 @@ private ByteBuffer readFrame() throws IOException { read(buffer); return buffer; } - + private void read(ByteBuffer buffer) throws IOException { buffer.clear(); while (buffer.hasRemaining()) diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/Server.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/Server.java index 4ae605325f0..aa0efe3b632 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/Server.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/Server.java @@ -28,8 +28,8 @@ public interface Server { /** Stop this server. */ void close(); - + /** Wait for this server to exit. */ void join() throws InterruptedException; - + } diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/SocketServer.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/SocketServer.java index 8db5d660776..580c16e9f60 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/SocketServer.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/SocketServer.java @@ -83,7 +83,7 @@ public void run() { } public void close() { - this.interrupt(); + this.interrupt(); group.interrupt(); } @@ -128,7 +128,7 @@ public void run() { } } - + public static void main(String[] arg) throws Exception { Responder responder = new GenericResponder(Protocol.parse("{\"protocol\": \"X\"}")) { diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/SocketTransceiver.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/SocketTransceiver.java index e2178c63dfa..50bc5be7024 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/SocketTransceiver.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/SocketTransceiver.java @@ -43,7 +43,7 @@ public class SocketTransceiver extends Transceiver { private ByteBuffer header = ByteBuffer.allocate(4); private Protocol remote; - + public SocketTransceiver(SocketAddress address) throws IOException { this(SocketChannel.open(address)); } diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/Transceiver.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/Transceiver.java index 898fd7768ec..820ba177b01 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/Transceiver.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/Transceiver.java @@ -31,14 +31,14 @@ public abstract class Transceiver implements Closeable { private final ReentrantLock channelLock = new ReentrantLock(); public abstract String getRemoteName() throws IOException; - + /** * Acquires an exclusive lock on the transceiver's channel. */ public void lockChannel() { channelLock.lock(); } - + /** * Releases the lock on the transceiver's channel if held by the calling thread. */ @@ -61,8 +61,8 @@ public List transceive(List request) unlockChannel(); } } - - /** + + /** * Called by {@link Requestor#request(String,Object,Callback)} for two-way messages using callbacks. */ public void transceive(List request, Callback> callback) diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/generic/GenericResponder.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/generic/GenericResponder.java index c5beac07ebd..1ed6bc7dd33 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/generic/GenericResponder.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/generic/GenericResponder.java @@ -38,7 +38,7 @@ public abstract class GenericResponder extends Responder { public GenericResponder(Protocol local) { this(local, GenericData.get()); - + } public GenericResponder(Protocol local, GenericData data) { diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/reflect/ReflectRequestor.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/reflect/ReflectRequestor.java index 84d798e43b8..29903ec7e90 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/reflect/ReflectRequestor.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/reflect/ReflectRequestor.java @@ -33,7 +33,7 @@ /** A {@link org.apache.avro.ipc.Requestor} for existing interfaces. */ public class ReflectRequestor extends SpecificRequestor { - + public ReflectRequestor(Class iface, Transceiver transceiver) throws IOException { this(iface, transceiver, new ReflectData(iface.getClassLoader())); @@ -43,19 +43,19 @@ protected ReflectRequestor(Protocol protocol, Transceiver transceiver) throws IOException { this(protocol, transceiver, ReflectData.get()); } - + public ReflectRequestor(Class iface, Transceiver transceiver, ReflectData data) throws IOException { this(data.getProtocol(iface), transceiver, data); } - + public ReflectRequestor(Protocol protocol, Transceiver transceiver, ReflectData data) throws IOException { super(protocol, transceiver, data); } - + public ReflectData getReflectData() { return (ReflectData)getSpecificData(); } @Override @@ -69,7 +69,7 @@ protected DatumReader getDatumReader(Schema writer, Schema reader) { } /** Create a proxy instance whose methods invoke RPCs. */ - public static T getClient(Class iface, Transceiver transciever) + public static T getClient(Class iface, Transceiver transciever) throws IOException { return getClient(iface, transciever, new ReflectData(iface.getClassLoader())); @@ -81,16 +81,16 @@ public static T getClient(Class iface, Transceiver transciever, ReflectData reflectData) throws IOException { Protocol protocol = reflectData.getProtocol(iface); return (T)Proxy.newProxyInstance - (reflectData.getClassLoader(), + (reflectData.getClassLoader(), new Class[] { iface }, new ReflectRequestor(protocol, transciever, reflectData)); } - + /** Create a proxy instance whose methods invoke RPCs. */ @SuppressWarnings("unchecked") - public static T getClient(Class iface, ReflectRequestor rreq) + public static T getClient(Class iface, ReflectRequestor rreq) throws IOException { - return (T)Proxy.newProxyInstance(rreq.getReflectData().getClassLoader(), + return (T)Proxy.newProxyInstance(rreq.getReflectData().getClassLoader(), new Class[] { iface }, rreq); } } diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/reflect/ReflectResponder.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/reflect/ReflectResponder.java index 3e669432ccf..b9d8effc76a 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/reflect/ReflectResponder.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/reflect/ReflectResponder.java @@ -35,7 +35,7 @@ public class ReflectResponder extends SpecificResponder { public ReflectResponder(Class iface, Object impl) { this(iface, impl, new ReflectData(impl.getClass().getClassLoader())); } - + public ReflectResponder(Protocol protocol, Object impl) { this(protocol, impl, new ReflectData(impl.getClass().getClassLoader())); } diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/specific/SpecificRequestor.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/specific/SpecificRequestor.java index d4647370b7c..5bcddc35c57 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/specific/SpecificRequestor.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/specific/SpecificRequestor.java @@ -124,12 +124,12 @@ else if (name.equals("toString")) { throw e; } } - + // Next, check for RuntimeExceptions: if (e instanceof RuntimeException) { throw e; } - + // Not an expected Exception, so wrap it in AvroRemoteException: throw new AvroRemoteException(e); } @@ -157,7 +157,7 @@ public void writeRequest(Schema schema, Object request, Encoder out) for (Schema.Field param : schema.getFields()) getDatumWriter(param.schema()).write(args[i++], out); } - + @Override public Object readResponse(Schema writer, Schema reader, Decoder in) throws IOException { @@ -203,7 +203,7 @@ public static T getClient(Class iface, SpecificRequestor requestor) /** Return the remote protocol for a proxy. */ public static Protocol getRemote(Object proxy) throws IOException { return ((Requestor)Proxy.getInvocationHandler(proxy)).getRemote(); - + } } diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/specific/SpecificResponder.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/specific/SpecificResponder.java index ae3a30d9ace..5e84d1496e3 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/specific/SpecificResponder.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/specific/SpecificResponder.java @@ -42,7 +42,7 @@ public class SpecificResponder extends GenericResponder { public SpecificResponder(Class iface, Object impl) { this(iface, impl, new SpecificData(impl.getClass().getClassLoader())); } - + public SpecificResponder(Protocol protocol, Object impl) { this(protocol, impl, new SpecificData(impl.getClass().getClassLoader())); } diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/Histogram.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/Histogram.java index 521e1c259fb..6fef833d78c 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/Histogram.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/Histogram.java @@ -39,8 +39,8 @@ class Histogram { /** * How many recent additions we should track. */ - public static final int MAX_HISTORY_SIZE = 20; - + public static final int MAX_HISTORY_SIZE = 20; + private Segmenter segmenter; private int[] counts; protected int totalCount; @@ -67,13 +67,13 @@ interface Segmenter { * is consistent with the segment numbers. */ Iterator getBuckets(); - + /** * Returns a List of bucket boundaries. Useful for printing * segmenters. */ List getBoundaryLabels(); - + /** * Returns the bucket labels as an array; */ @@ -116,7 +116,7 @@ public int size() { private String rangeAsString(T a, T b) { return String.format("[%s,%s)", a, b == null ? "infinity" : b); } - + @Override public ArrayList getBoundaryLabels() { ArrayList outArray = new ArrayList(index.keySet().size()); @@ -125,7 +125,7 @@ public ArrayList getBoundaryLabels() { } return outArray; } - + @Override public ArrayList getBucketLabels() { ArrayList outArray = new ArrayList(index.keySet().size()); @@ -135,14 +135,14 @@ public ArrayList getBucketLabels() { } return outArray; } - + @Override public Iterator getBuckets() { return new Iterator() { Iterator it = index.keySet().iterator(); T cur = it.next(); // there's always at least one element int pos = 0; - + @Override public boolean hasNext() { return (pos < index.keySet().size()); @@ -190,14 +190,14 @@ public void add(T value) { public int[] getHistogram() { return counts; } - + /** * Returns the underlying segmenter used for this histogram. */ public Segmenter getSegmenter() { return this.segmenter; } - + /** * Returns values recently added to this histogram. These are in reverse * order (most recent first). @@ -210,7 +210,7 @@ public List getRecentAdditions() { public int getCount() { return totalCount; } - + public String toString() { StringBuilder sb = new StringBuilder(); diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StaticServlet.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StaticServlet.java index c079ec5db63..88a50f83314 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StaticServlet.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StaticServlet.java @@ -29,7 +29,7 @@ */ public class StaticServlet extends DefaultServlet { public Resource getResource(String pathInContext) { - // Take only last slice of the URL as a filename, so we can adjust path. + // Take only last slice of the URL as a filename, so we can adjust path. // This also prevents mischief like '../../foo.css' String[] parts = pathInContext.split("/"); String filename = parts[parts.length - 1]; @@ -43,4 +43,4 @@ public Resource getResource(String pathInContext) { return null; } } -} +} diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StatsPlugin.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StatsPlugin.java index 565f532bdd9..6301bbefcaf 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StatsPlugin.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StatsPlugin.java @@ -36,7 +36,7 @@ /** * Collects count and latency statistics about RPC calls. Keeps * data for every method. Can be added to a Requestor (client) - * or Responder (server). + * or Responder (server). * * This uses milliseconds as the standard unit of measure * throughout the class, stored in floats. @@ -76,9 +76,9 @@ public class StatsPlugin extends RPCPlugin { 2000, 5000, 10000, - 50000, + 50000, 100000))); - + /** Per-method histograms. * Must be accessed while holding a lock. */ Map> methodTimings = @@ -86,10 +86,10 @@ public class StatsPlugin extends RPCPlugin { Map> sendPayloads = new HashMap>(); - + Map> receivePayloads = new HashMap>(); - + /** RPCs in flight. */ ConcurrentMap activeRpcs = new ConcurrentHashMap(); @@ -97,12 +97,12 @@ public class StatsPlugin extends RPCPlugin { /** How long I've been alive */ public Date startupTime = new Date(); - + private Segmenter floatSegmenter; private Segmenter integerSegmenter; /** Construct a plugin with custom Ticks and Segmenter implementations. */ - StatsPlugin(Ticks ticks, Segmenter floatSegmenter, + StatsPlugin(Ticks ticks, Segmenter floatSegmenter, Segmenter integerSegmenter) { this.floatSegmenter = floatSegmenter; this.integerSegmenter = integerSegmenter; @@ -114,7 +114,7 @@ public class StatsPlugin extends RPCPlugin { public StatsPlugin() { this(Stopwatch.SYSTEM_TICKS, LATENCY_SEGMENTER, PAYLOAD_SEGMENTER); } - + /** * Helper to get the size of an RPC payload. */ @@ -122,12 +122,12 @@ private int getPayloadSize(List payload) { if (payload == null) { return 0; } - + int size = 0; for (ByteBuffer bb: payload) { size = size + bb.limit(); } - + return size; } @@ -136,7 +136,7 @@ public void serverReceiveRequest(RPCContext context) { Stopwatch t = new Stopwatch(ticks); t.start(); this.activeRpcs.put(context, t); - + synchronized(receivePayloads) { IntegerHistogram h = receivePayloads.get(context.getMessage()); if (h == null) { @@ -146,13 +146,13 @@ public void serverReceiveRequest(RPCContext context) { h.add(getPayloadSize(context.getRequestPayload())); } } - + @Override public void serverSendResponse(RPCContext context) { Stopwatch t = this.activeRpcs.remove(context); t.stop(); publish(context, t); - + synchronized(sendPayloads) { IntegerHistogram h = sendPayloads.get(context.getMessage()); if (h == null) { @@ -162,13 +162,13 @@ public void serverSendResponse(RPCContext context) { h.add(getPayloadSize(context.getResponsePayload())); } } - + @Override public void clientSendRequest(RPCContext context) { Stopwatch t = new Stopwatch(ticks); t.start(); this.activeRpcs.put(context, t); - + synchronized(sendPayloads) { IntegerHistogram h = sendPayloads.get(context.getMessage()); if (h == null) { @@ -178,13 +178,13 @@ public void clientSendRequest(RPCContext context) { h.add(getPayloadSize(context.getRequestPayload())); } } - + @Override public void clientReceiveResponse(RPCContext context) { Stopwatch t = this.activeRpcs.remove(context); t.stop(); publish(context, t); - + synchronized(receivePayloads) { IntegerHistogram h = receivePayloads.get(context.getMessage()); if (h == null) { @@ -194,7 +194,7 @@ public void clientReceiveResponse(RPCContext context) { h.add(getPayloadSize(context.getRequestPayload())); } } - + /** Adds timing to the histograms. */ private void publish(RPCContext context, Stopwatch t) { Message message = context.getMessage(); @@ -218,7 +218,7 @@ private FloatHistogram createNewFloatHistogram() { private IntegerHistogram createNewIntegerHistogram() { return new IntegerHistogram(integerSegmenter); } - + /** Converts nanoseconds to milliseconds. */ static float nanosToMillis(long elapsedNanos) { return elapsedNanos / 1000000.0f; diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StatsServer.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StatsServer.java index 3ae8ada5a0e..1b2e54b1d0a 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StatsServer.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StatsServer.java @@ -21,32 +21,32 @@ import org.mortbay.jetty.servlet.ServletHolder; /* This is a server that displays live information from a StatsPlugin. - * + * * Typical usage is as follows: - * StatsPlugin plugin = new StatsPlugin(); + * StatsPlugin plugin = new StatsPlugin(); * requestor.addPlugin(plugin); * StatsServer server = new StatsServer(plugin, 8080); - * + * * */ public class StatsServer { Server httpServer; StatsPlugin plugin; - - /* Start a stats server on the given port, + + /* Start a stats server on the given port, * responsible for the given plugin. */ public StatsServer(StatsPlugin plugin, int port) throws Exception { this.httpServer = new Server(port); this.plugin = plugin; - + Context staticContext = new Context(httpServer, "/static"); staticContext.addServlet(new ServletHolder(new StaticServlet()), "/"); - + Context context = new Context(httpServer, "/"); context.addServlet(new ServletHolder(new StatsServlet(plugin)), "/"); - + httpServer.start(); } - + /* Stops this server. */ public void stop() throws Exception { this.httpServer.stop(); diff --git a/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StatsServlet.java b/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StatsServlet.java index 3af2ffd79a4..075bff2545f 100644 --- a/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StatsServlet.java +++ b/lang/java/ipc/src/main/java/org/apache/avro/ipc/stats/StatsServlet.java @@ -49,49 +49,49 @@ * This class follows the same synchronization conventions * as StatsPlugin, to avoid requiring StatsPlugin to serve * a copy of the data. - */ + */ public class StatsServlet extends HttpServlet { private final StatsPlugin statsPlugin; private VelocityEngine velocityEngine; - private static final SimpleDateFormat FORMATTER = + private static final SimpleDateFormat FORMATTER = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss"); public StatsServlet(StatsPlugin statsPlugin) throws UnavailableException { this.statsPlugin = statsPlugin; this.velocityEngine = new VelocityEngine(); - + // These two properties tell Velocity to use its own classpath-based loader velocityEngine.addProperty("resource.loader", "class"); velocityEngine.addProperty("class.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader"); - + velocityEngine.setProperty("runtime.references.strict", true); String logChuteName = "org.apache.velocity.runtime.log.NullLogChute"; velocityEngine.setProperty("runtime.log.logsystem.class", logChuteName); } - + /* Helper class to store per-message data which is passed to templates. - * + * * The template expects a list of charts, each of which is parameterized by * map key-value string attributes. */ public class RenderableMessage { // Velocity brakes if not public public String name; public int numCalls; public ArrayList> charts; - + public RenderableMessage(String name) { this.name = name; this.charts = new ArrayList>(); } - + public ArrayList> getCharts() { return this.charts; } - + public String getname() { return this.name; } - + public int getNumCalls() { return this.numCalls; } @@ -99,9 +99,9 @@ public int getNumCalls() { /* Surround each string in an array with * quotation marks and escape existing quotes. - * + * * This is useful when we have an array of strings that we want to turn into - * a javascript array declaration. + * a javascript array declaration. */ protected static List escapeStringArray(List input) { for (int i = 0; i < input.size(); i++) { @@ -109,16 +109,16 @@ protected static List escapeStringArray(List input) { } return input; } - + @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("text/html"); String url = req.getRequestURL().toString(); String[] parts = url.split("//")[1].split("/"); - + try { - writeStats(resp.getWriter()); + writeStats(resp.getWriter()); } catch (Exception e) { e.printStackTrace(); @@ -127,34 +127,34 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) void writeStats(Writer w) throws IOException { VelocityContext context = new VelocityContext(); - context.put("title", "Avro RPC Stats"); - + context.put("title", "Avro RPC Stats"); + ArrayList rpcs = new ArrayList(); // in flight rpcs - - ArrayList messages = + + ArrayList messages = new ArrayList(); - - for (Entry rpc : + + for (Entry rpc : this.statsPlugin.activeRpcs.entrySet()) { rpcs.add(renderActiveRpc(rpc.getKey(), rpc.getValue())); } - + // Get set of all seen messages Set keys = null; synchronized(this.statsPlugin.methodTimings) { keys = this.statsPlugin.methodTimings.keySet(); - + for (Message m: keys) { messages.add(renderMethod(m)); } } - + context.put("inFlightRpcs", rpcs); context.put("messages", messages); - + context.put("currTime", FORMATTER.format(new Date())); context.put("startupTime", FORMATTER.format(statsPlugin.startupTime)); - + Template t; try { t = velocityEngine.getTemplate( @@ -169,22 +169,22 @@ void writeStats(Writer w) throws IOException { t.merge(context, w); } - private String renderActiveRpc(RPCContext rpc, Stopwatch stopwatch) + private String renderActiveRpc(RPCContext rpc, Stopwatch stopwatch) throws IOException { String out = new String(); - out += rpc.getMessage().getName() + ": " + + out += rpc.getMessage().getName() + ": " + formatMillis(StatsPlugin.nanosToMillis(stopwatch.elapsedNanos())); return out; } - + private RenderableMessage renderMethod(Message message) { RenderableMessage out = new RenderableMessage(message.getName()); - + synchronized(this.statsPlugin.methodTimings) { FloatHistogram hist = this.statsPlugin.methodTimings.get(message); out.numCalls = hist.getCount(); - + HashMap latencyBar = new HashMap(); // Fill in chart attributes for velocity latencyBar.put("type", "bar"); @@ -193,22 +193,22 @@ private RenderableMessage renderMethod(Message message) { latencyBar.put("numCalls", Integer.toString(hist.getCount())); latencyBar.put("avg", Float.toString(hist.getMean())); latencyBar.put("stdDev", Float.toString(hist.getUnbiasedStdDev())); - latencyBar.put("labelStr", + latencyBar.put("labelStr", Arrays.toString(hist.getSegmenter().getBoundaryLabels().toArray())); latencyBar.put("boundaryStr", Arrays.toString(escapeStringArray(hist.getSegmenter(). getBucketLabels()).toArray())); - latencyBar.put("dataStr", Arrays.toString(hist.getHistogram())); + latencyBar.put("dataStr", Arrays.toString(hist.getHistogram())); out.charts.add(latencyBar); - + HashMap latencyDot = new HashMap(); latencyDot.put("title", "Latency"); latencyDot.put("type", "dot"); - latencyDot.put("dataStr", + latencyDot.put("dataStr", Arrays.toString(hist.getRecentAdditions().toArray())); out.charts.add(latencyDot); } - + synchronized(this.statsPlugin.sendPayloads) { IntegerHistogram hist = this.statsPlugin.sendPayloads.get(message); HashMap latencyBar = new HashMap(); @@ -219,22 +219,22 @@ private RenderableMessage renderMethod(Message message) { latencyBar.put("numCalls", Integer.toString(hist.getCount())); latencyBar.put("avg", Float.toString(hist.getMean())); latencyBar.put("stdDev", Float.toString(hist.getUnbiasedStdDev())); - latencyBar.put("labelStr", + latencyBar.put("labelStr", Arrays.toString(hist.getSegmenter().getBoundaryLabels().toArray())); latencyBar.put("boundaryStr", Arrays.toString(escapeStringArray(hist.getSegmenter(). getBucketLabels()).toArray())); - latencyBar.put("dataStr", Arrays.toString(hist.getHistogram())); + latencyBar.put("dataStr", Arrays.toString(hist.getHistogram())); out.charts.add(latencyBar); - + HashMap latencyDot = new HashMap(); latencyDot.put("title", "Send Payload"); latencyDot.put("type", "dot"); - latencyDot.put("dataStr", + latencyDot.put("dataStr", Arrays.toString(hist.getRecentAdditions().toArray())); out.charts.add(latencyDot); } - + synchronized(this.statsPlugin.receivePayloads) { IntegerHistogram hist = this.statsPlugin.receivePayloads.get(message); HashMap latencyBar = new HashMap(); @@ -245,25 +245,25 @@ private RenderableMessage renderMethod(Message message) { latencyBar.put("numCalls", Integer.toString(hist.getCount())); latencyBar.put("avg", Float.toString(hist.getMean())); latencyBar.put("stdDev", Float.toString(hist.getUnbiasedStdDev())); - latencyBar.put("labelStr", + latencyBar.put("labelStr", Arrays.toString(hist.getSegmenter().getBoundaryLabels().toArray())); latencyBar.put("boundaryStr", Arrays.toString(escapeStringArray(hist.getSegmenter(). getBucketLabels()).toArray())); - latencyBar.put("dataStr", Arrays.toString(hist.getHistogram())); + latencyBar.put("dataStr", Arrays.toString(hist.getHistogram())); out.charts.add(latencyBar); - + HashMap latencyDot = new HashMap(); latencyDot.put("title", "Recv Payload"); latencyDot.put("type", "dot"); - latencyDot.put("dataStr", + latencyDot.put("dataStr", Arrays.toString(hist.getRecentAdditions().toArray())); out.charts.add(latencyDot); } - + return out; } - + private CharSequence formatMillis(float millis) { return String.format("%.0fms", millis); } diff --git a/lang/java/ipc/src/test/java/org/apache/avro/DataFileInteropTest.java b/lang/java/ipc/src/test/java/org/apache/avro/DataFileInteropTest.java index dd64bf539d5..60862e2d20c 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/DataFileInteropTest.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/DataFileInteropTest.java @@ -32,7 +32,7 @@ public class DataFileInteropTest { - private static final File DATAFILE_DIR = + private static final File DATAFILE_DIR = new File(System.getProperty("test.dir", "/tmp")); @BeforeClass @@ -45,8 +45,8 @@ public static void printDir() { public void testGeneratedGeneric() throws IOException { System.out.println("Reading with generic:"); DatumReaderProvider provider = new DatumReaderProvider() { - @Override public DatumReader get() { - return new GenericDatumReader(); + @Override public DatumReader get() { + return new GenericDatumReader(); } }; readFiles(provider); @@ -56,15 +56,15 @@ public void testGeneratedGeneric() throws IOException { public void testGeneratedSpecific() throws IOException { System.out.println("Reading with specific:"); DatumReaderProvider provider = new DatumReaderProvider() { - @Override public DatumReader get() { - return new SpecificDatumReader(); + @Override public DatumReader get() { + return new SpecificDatumReader(); } }; readFiles(provider); } // Can't use same Interop.java as specific for reflect. - // This used to be the case because one used Utf8 and the other Sring, but + // This used to be the case because one used Utf8 and the other Sring, but // we use CharSequence now. // The current incompatibility is now that one uses byte[] and the other ByteBuffer @@ -78,8 +78,8 @@ public void testGeneratedSpecific() throws IOException { // @Test // public void testGeneratedReflect() throws IOException { // DatumReaderProvider provider = new DatumReaderProvider() { -// @Override public DatumReader get() { -// return new ReflectDatumReader(Interop.class); +// @Override public DatumReader get() { +// return new ReflectDatumReader(Interop.class); // } // }; // readFiles(provider); @@ -95,7 +95,7 @@ private void readFiles(DatumReaderProvider provider) thro } } } - + interface DatumReaderProvider { public DatumReader get(); } diff --git a/lang/java/ipc/src/test/java/org/apache/avro/RPCMetaTestPlugin.java b/lang/java/ipc/src/test/java/org/apache/avro/RPCMetaTestPlugin.java index 96e2e621b1d..feefd804bc5 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/RPCMetaTestPlugin.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/RPCMetaTestPlugin.java @@ -30,157 +30,157 @@ * This plugin tests handshake and call state by passing a string as metadata, * slowly building it up at each instrumentation point, testing it as it goes. * Finally, after the call or handshake is complete, the constructed string is - * tested. It also tests that RPC context data is appropriately filled in + * tested. It also tests that RPC context data is appropriately filled in * along the way by Requestor and Responder classes. */ public final class RPCMetaTestPlugin extends RPCPlugin { - + protected final String key; - + public RPCMetaTestPlugin(String keyname) { key = keyname; } - + @Override public void clientStartConnect(RPCContext context) { ByteBuffer buf = ByteBuffer.wrap("ap".getBytes()); context.requestHandshakeMeta().put(key, buf); } - + @Override public void serverConnecting(RPCContext context) { - + Assert.assertNotNull(context.requestHandshakeMeta()); Assert.assertNotNull(context.responseHandshakeMeta()); Assert.assertNull(context.getRequestPayload()); Assert.assertNull(context.getResponsePayload()); - + if (!context.requestHandshakeMeta().containsKey(key)) return; - + ByteBuffer buf = context.requestHandshakeMeta().get(key); Assert.assertNotNull(buf); Assert.assertNotNull(buf.array()); - + String partialstr = new String(buf.array()); Assert.assertNotNull(partialstr); Assert.assertEquals("partial string mismatch", "ap", partialstr); - + buf = ByteBuffer.wrap((partialstr + "ac").getBytes()); Assert.assertTrue(buf.remaining() > 0); context.responseHandshakeMeta().put(key, buf); } - + @Override public void clientFinishConnect(RPCContext context) { Map handshakeMeta = context.responseHandshakeMeta(); - + Assert.assertNull(context.getRequestPayload()); Assert.assertNull(context.getResponsePayload()); Assert.assertNotNull(handshakeMeta); - + if (!handshakeMeta.containsKey(key)) return; - + ByteBuffer buf = handshakeMeta.get(key); Assert.assertNotNull(buf); Assert.assertNotNull(buf.array()); - + String partialstr = new String(buf.array()); Assert.assertNotNull(partialstr); Assert.assertEquals("partial string mismatch", "apac", partialstr); - + buf = ByteBuffer.wrap((partialstr + "he").getBytes()); Assert.assertTrue(buf.remaining() > 0); handshakeMeta.put(key, buf); - + checkRPCMetaMap(handshakeMeta); } - + @Override - public void clientSendRequest(RPCContext context) { + public void clientSendRequest(RPCContext context) { ByteBuffer buf = ByteBuffer.wrap("ap".getBytes()); context.requestCallMeta().put(key, buf); Assert.assertNotNull(context.getMessage()); Assert.assertNotNull(context.getRequestPayload()); Assert.assertNull(context.getResponsePayload()); } - + @Override public void serverReceiveRequest(RPCContext context) { Map meta = context.requestCallMeta(); - - Assert.assertNotNull(meta); + + Assert.assertNotNull(meta); Assert.assertNotNull(context.getMessage()); Assert.assertNull(context.getResponsePayload()); - + if (!meta.containsKey(key)) return; - + ByteBuffer buf = meta.get(key); Assert.assertNotNull(buf); Assert.assertNotNull(buf.array()); - + String partialstr = new String(buf.array()); Assert.assertNotNull(partialstr); Assert.assertEquals("partial string mismatch", "ap", partialstr); - + buf = ByteBuffer.wrap((partialstr + "a").getBytes()); Assert.assertTrue(buf.remaining() > 0); meta.put(key, buf); } - + @Override public void serverSendResponse(RPCContext context) { Assert.assertNotNull(context.requestCallMeta()); Assert.assertNotNull(context.responseCallMeta()); Assert.assertNotNull(context.getResponsePayload()); - + if (!context.requestCallMeta().containsKey(key)) return; - + ByteBuffer buf = context.requestCallMeta().get(key); Assert.assertNotNull(buf); Assert.assertNotNull(buf.array()); - + String partialstr = new String(buf.array()); Assert.assertNotNull(partialstr); Assert.assertEquals("partial string mismatch", "apa", partialstr); - + buf = ByteBuffer.wrap((partialstr + "c").getBytes()); Assert.assertTrue(buf.remaining() > 0); context.responseCallMeta().put(key, buf); } - + @Override public void clientReceiveResponse(RPCContext context) { Assert.assertNotNull(context.responseCallMeta()); Assert.assertNotNull(context.getRequestPayload()); - + if (!context.responseCallMeta().containsKey(key)) return; - + ByteBuffer buf = context.responseCallMeta().get(key); Assert.assertNotNull(buf); Assert.assertNotNull(buf.array()); - + String partialstr = new String(buf.array()); Assert.assertNotNull(partialstr); Assert.assertEquals("partial string mismatch", "apac", partialstr); - + buf = ByteBuffer.wrap((partialstr + "he").getBytes()); Assert.assertTrue(buf.remaining() > 0); context.responseCallMeta().put(key, buf); - + checkRPCMetaMap(context.responseCallMeta()); } - + protected void checkRPCMetaMap(Map rpcMeta) { Assert.assertNotNull(rpcMeta); Assert.assertTrue("key not present in map", rpcMeta.containsKey(key)); - + ByteBuffer keybuf = rpcMeta.get(key); Assert.assertNotNull(keybuf); Assert.assertTrue("key BB had nothing remaining", keybuf.remaining() > 0); - + String str = new String(keybuf.array()); Assert.assertEquals("apache", str); } - + } diff --git a/lang/java/ipc/src/test/java/org/apache/avro/RandomData.java b/lang/java/ipc/src/test/java/org/apache/avro/RandomData.java index 49f88573a89..85da0348c84 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/RandomData.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/RandomData.java @@ -47,7 +47,7 @@ public RandomData(Schema schema, int count, long seed) { this.seed = seed; this.count = count; } - + public Iterator iterator() { return new Iterator() { private int n; @@ -60,7 +60,7 @@ public Object next() { public void remove() { throw new UnsupportedOperationException(); } }; } - + @SuppressWarnings(value="unchecked") private static Object generate(Schema schema, Random random, int d) { switch (schema.getType()) { diff --git a/lang/java/ipc/src/test/java/org/apache/avro/TestCompare.java b/lang/java/ipc/src/test/java/org/apache/avro/TestCompare.java index 8f020222f4c..20efe1769fe 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/TestCompare.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/TestCompare.java @@ -184,7 +184,7 @@ public void testSpecificRecord() throws Exception { s2.setKind(Kind.BAZ); check(schema, s1, s2, true, new SpecificDatumWriter(schema), SpecificData.get()); - } + } private static void check(String schemaJson, T o1, T o2) throws Exception { diff --git a/lang/java/ipc/src/test/java/org/apache/avro/TestDataFileSpecific.java b/lang/java/ipc/src/test/java/org/apache/avro/TestDataFileSpecific.java index 9d85a20ba1a..9f73b86a3db 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/TestDataFileSpecific.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/TestDataFileSpecific.java @@ -68,7 +68,7 @@ public void testSpecificDatumReaderDefaultCtor() throws IOException { DataFileReader reader = new DataFileReader(FILE, new SpecificDatumReader()); int i = 0; - for (Foo f : reader) + for (Foo f : reader) Assert.assertEquals(""+(i++), f.getLabel().toString()); Assert.assertEquals(10, i); reader.close(); diff --git a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolDatagram.java b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolDatagram.java index 1f16acc24e4..300ca374ecc 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolDatagram.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolDatagram.java @@ -35,7 +35,7 @@ public Server createServer(Responder testResponder) throws Exception { new InetSocketAddress("localhost", new Random().nextInt(10000)+10000)); } - + @Override public Transceiver createTransceiver() throws Exception{ return new DatagramTransceiver(new InetSocketAddress("localhost", server.getPort())); diff --git a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolGeneric.java b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolGeneric.java index 1309ea113f3..2e3dad2d308 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolGeneric.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolGeneric.java @@ -90,7 +90,7 @@ public Object respond(Message message, Object request) error.put("message", new Utf8("an error")); throw new AvroRemoteException(error); } - + throw new AvroRuntimeException("unexpected message: "+message.getName()); } @@ -111,7 +111,7 @@ public void testStartServer() throws Exception { @Test public void testHello() throws IOException { - GenericRecord params = + GenericRecord params = new GenericData.Record(PROTOCOL.getMessages().get("hello").getRequest()); params.put("greeting", new Utf8("bob")); Utf8 response = (Utf8)requestor.request("hello", params); diff --git a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolGenericMeta.java b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolGenericMeta.java index 5bc46f6080a..ed2444463e5 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolGenericMeta.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolGenericMeta.java @@ -26,7 +26,7 @@ import org.junit.Before; public class TestProtocolGenericMeta extends TestProtocolGeneric { - + @Before @Override public void testStartServer() throws Exception { if (server != null) return; @@ -35,7 +35,7 @@ public void testStartServer() throws Exception { responder.addRPCPlugin(new RPCMetaTestPlugin("key2")); server = new SocketServer(responder, new InetSocketAddress(0)); server.start(); - + client = new SocketTransceiver(new InetSocketAddress(server.getPort())); requestor = new GenericRequestor(PROTOCOL, client); requestor.addRPCPlugin(new RPCMetaTestPlugin("key1")); diff --git a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolHttp.java b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolHttp.java index dc460c57dac..c162c09fd09 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolHttp.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolHttp.java @@ -42,12 +42,12 @@ public class TestProtocolHttp extends TestProtocolSpecific { public Server createServer(Responder testResponder) throws Exception { return new HttpServer(testResponder, 0); } - + @Override public Transceiver createTransceiver() throws Exception{ return new HttpTransceiver(new URL("http://127.0.0.1:"+server.getPort()+"/")); } - + protected int getExpectedHandshakeCount() { return REPEATING; } diff --git a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolHttps.java b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolHttps.java index 1c879550e55..f770daece9a 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolHttps.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolHttps.java @@ -57,12 +57,12 @@ public Server createServer(Responder testResponder) throws Exception { connector.setNeedClientAuth(false); return new HttpServer(testResponder, connector); } - + @Override public Transceiver createTransceiver() throws Exception{ return new HttpTransceiver(new URL("https://localhost:"+server.getPort()+"/")); } - + protected int getExpectedHandshakeCount() { return REPEATING; } diff --git a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolNetty.java b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolNetty.java index ed73e784a1e..07ba14302d3 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolNetty.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolNetty.java @@ -34,12 +34,12 @@ public class TestProtocolNetty extends TestProtocolSpecific { public Server createServer(Responder testResponder) throws Exception { return new NettyServer(responder, new InetSocketAddress(0)); } - + @Override public Transceiver createTransceiver() throws Exception{ return new NettyTransceiver(new InetSocketAddress(server.getPort()), 2000L); } - + @Override protected int getExpectedHandshakeCount() { return REPEATING; diff --git a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolReflect.java b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolReflect.java index 7567c6e8fa6..4c8b478afb2 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolReflect.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolReflect.java @@ -54,7 +54,7 @@ public interface Simple { byte[] echoBytes(byte[] data); void error() throws SimpleException; } - + private static boolean throwUndeclaredError; public static class TestImpl implements Simple { diff --git a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolReflectMeta.java b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolReflectMeta.java index c6394cda95c..91a54b73633 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolReflectMeta.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolReflectMeta.java @@ -36,7 +36,7 @@ public void testStartServer() throws Exception { rresp.addRPCPlugin(new RPCMetaTestPlugin("key2")); server = new SocketServer(rresp, new InetSocketAddress(0)); server.start(); - + client = new SocketTransceiver(new InetSocketAddress(server.getPort())); ReflectRequestor requestor = new ReflectRequestor(Simple.class, client); requestor.addRPCPlugin(new RPCMetaTestPlugin("key1")); diff --git a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolSpecific.java b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolSpecific.java index f660f286a7a..08b569a5b6d 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolSpecific.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolSpecific.java @@ -95,23 +95,23 @@ public void testStartServer() throws Exception { responder = new SpecificResponder(Simple.class, new TestImpl()); server = createServer(responder); server.start(); - + client = createTransceiver(); SpecificRequestor req = new SpecificRequestor(Simple.class, client); addRpcPlugins(req); proxy = SpecificRequestor.getClient(Simple.class, (SpecificRequestor)req); - + monitor = new HandshakeMonitor(); responder.addRPCPlugin(monitor); } - + public void addRpcPlugins(Requestor requestor){} - + public Server createServer(Responder testResponder) throws Exception{ return server = new SocketServer(testResponder, - new InetSocketAddress(0)); + new InetSocketAddress(0)); } - + public Transceiver createTransceiver() throws Exception{ return new SocketTransceiver(new InetSocketAddress(server.getPort())); } @@ -218,14 +218,14 @@ public void testOneWay() throws IOException { try { Thread.sleep(100); } catch (InterruptedException e) {} assertEquals(2, ackCount); } - + @Test public void testRepeatedAccess() throws Exception { for (int x = 0; x < 1000; x++) { proxy.hello("hi!"); } } - + @Test(expected = Exception.class) public void testConnectionRefusedOneWay() throws IOException { Transceiver client = new HttpTransceiver(new URL("http://localhost:4444")); @@ -277,12 +277,12 @@ public static void testStopServer() throws IOException { server.close(); server = null; } - + public class HandshakeMonitor extends RPCPlugin{ - + private int handshakes; private HashSet seenProtocols = new HashSet(); - + @Override public void serverConnecting(RPCContext context) { handshakes++; @@ -299,7 +299,7 @@ public void serverConnecting(RPCContext context) { seenProtocols.add(clientProtocol); } } - + public void assertHandshake(){ int expected = getExpectedHandshakeCount(); if(expected != REPEATING){ @@ -307,7 +307,7 @@ public void assertHandshake(){ } } } - + protected int getExpectedHandshakeCount() { return 3; } diff --git a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolSpecificMeta.java b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolSpecificMeta.java index a2dd5755e4c..d38362e1c8a 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolSpecificMeta.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/TestProtocolSpecificMeta.java @@ -28,19 +28,19 @@ public class TestProtocolSpecificMeta extends TestProtocolSpecific { - + @Override public Server createServer(Responder testResponder) throws Exception { responder.addRPCPlugin(new RPCMetaTestPlugin("key1")); responder.addRPCPlugin(new RPCMetaTestPlugin("key2")); return new SocketServer(responder, new InetSocketAddress(0)); } - + @Override public Transceiver createTransceiver() throws Exception { return new SocketTransceiver(new InetSocketAddress(server.getPort())); } - + public void addRpcPlugins(Requestor req){ req.addRPCPlugin(new RPCMetaTestPlugin("key1")); req.addRPCPlugin(new RPCMetaTestPlugin("key2")); diff --git a/lang/java/ipc/src/test/java/org/apache/avro/TestSchema.java b/lang/java/ipc/src/test/java/org/apache/avro/TestSchema.java index b19b1386791..468a21b90b7 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/TestSchema.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/TestSchema.java @@ -172,16 +172,16 @@ public void testMap() throws Exception { check("{\"type\":\"map\", \"values\":\"long\"}", "{\"a\":1}", map); checkParseError("{\"type\":\"map\"}"); // values required } - + @Test public void testUnionMap() throws Exception { String unionMapSchema = "{\"name\":\"foo\", \"type\":\"record\"," + - " \"fields\":[ {\"name\":\"mymap\", \"type\":" + - " [{\"type\":\"map\", \"values\":" + - " [\"int\",\"long\",\"float\",\"string\"]}," + - " \"null\"]" + - " }]" + - " }"; + " \"fields\":[ {\"name\":\"mymap\", \"type\":" + + " [{\"type\":\"map\", \"values\":" + + " [\"int\",\"long\",\"float\",\"string\"]}," + + " \"null\"]" + + " }]" + + " }"; check(unionMapSchema, true); } @@ -305,10 +305,10 @@ public void testSchemaExplosion() throws Exception { // reasonable amount of time for (Schema s1 : recs) { Schema s2 = Schema.parse(s1.toString()); - assertEquals(s1.hashCode(), s2.hashCode()); + assertEquals(s1.hashCode(), s2.hashCode()); assertEquals(s1, s2); } - } + } } @Test @@ -370,15 +370,15 @@ public void testComplexUnions() throws Exception { String namedTypes = ", {\"type\":\"record\",\"name\":\"Foo\",\"fields\":[]}," + " {\"type\":\"fixed\",\"name\":\"Bar\",\"size\": 1}," + " {\"type\":\"enum\",\"name\":\"Baz\",\"symbols\": [\"X\"]}"; - + String namedTypes2 = ", {\"type\":\"record\",\"name\":\"Foo2\",\"fields\":[]}," + " {\"type\":\"fixed\",\"name\":\"Bar2\",\"size\": 1}," + " {\"type\":\"enum\",\"name\":\"Baz2\",\"symbols\": [\"X\"]}"; - + check(partial + namedTypes + "]", false); - check(partial + namedTypes + namedTypes2 + "]", false); + check(partial + namedTypes + namedTypes2 + "]", false); checkParseError(partial + namedTypes + namedTypes + "]"); - + // fail with two branches of the same unnamed type checkUnionError(new Schema[] {Schema.create(Type.INT), Schema.create(Type.INT)}); checkUnionError(new Schema[] {Schema.create(Type.LONG), Schema.create(Type.LONG)}); @@ -387,14 +387,14 @@ public void testComplexUnions() throws Exception { checkUnionError(new Schema[] {Schema.create(Type.BOOLEAN), Schema.create(Type.BOOLEAN)}); checkUnionError(new Schema[] {Schema.create(Type.BYTES), Schema.create(Type.BYTES)}); checkUnionError(new Schema[] {Schema.create(Type.STRING), Schema.create(Type.STRING)}); - checkUnionError(new Schema[] {Schema.createArray(Schema.create(Type.INT)), + checkUnionError(new Schema[] {Schema.createArray(Schema.create(Type.INT)), Schema.createArray(Schema.create(Type.INT))}); - checkUnionError(new Schema[] {Schema.createMap(Schema.create(Type.INT)), + checkUnionError(new Schema[] {Schema.createMap(Schema.create(Type.INT)), Schema.createMap(Schema.create(Type.INT))}); - + List symbols = new ArrayList(); symbols.add("NOTHING"); - + // succeed with two branches of the same named type, if different names Schema u; u = buildUnion(new Schema[] { @@ -408,12 +408,12 @@ public void testComplexUnions() throws Exception { Schema.parse ("{\"type\":\"enum\",\"name\":\"y.A\",\"symbols\":[\"Y\"]}")}); check(u.toString(), false); - + u = buildUnion(new Schema[] { Schema.parse("{\"type\":\"fixed\",\"name\":\"x.A\",\"size\":4}"), Schema.parse("{\"type\":\"fixed\",\"name\":\"y.A\",\"size\":8}")}); check(u.toString(), false); - + // fail with two branches of the same named type, but same names checkUnionError(new Schema[] {Schema.createRecord("Foo", null, "org.test", false), Schema.createRecord("Foo", null, "org.test", false)}); @@ -421,19 +421,19 @@ public void testComplexUnions() throws Exception { Schema.createEnum("Bar", null, "org.test", symbols)}); checkUnionError(new Schema[] {Schema.createFixed("Baz", null, "org.test", 2), Schema.createFixed("Baz", null, "org.test", 1)}); - + Schema union = buildUnion(new Schema[] {Schema.create(Type.INT)}); // fail if creating a union of a union checkUnionError(new Schema[] {union}); } - + @Test public void testComplexProp() throws Exception { String json = "{\"type\":\"null\", \"foo\": [0]}"; Schema s = Schema.parse(json); assertEquals(null, s.getProp("foo")); } - + @Test public void testPropOrdering() throws Exception { String json = "{\"type\":\"int\",\"z\":\"c\",\"yy\":\"b\",\"x\":\"a\"}"; Schema s = Schema.parse(json); @@ -600,7 +600,7 @@ public void testFieldDocs() { // check field doc is parsed correctly Schema schema = Schema.parse(schemaStr); assertEquals("test", schema.getField("f").doc()); - + // check print/read cycle preserves field doc schema = Schema.parse(schema.toString()); assertEquals("test", schema.getField("f").doc()); @@ -669,7 +669,7 @@ private static void check(String jsonSchema, boolean induce) Schema induced = GenericData.get().induce(datum); assertEquals("Induced schema does not match.", schema, induced); } - + assertTrue("Datum does not validate against schema "+datum, GenericData.get().validate(schema, datum)); @@ -709,14 +709,14 @@ private static void checkProp(Schema s0) throws Exception { assertEquals(s1, s2); assertFalse(s0.equals(s2)); } - + public static void checkBinary(Schema schema, Object datum, DatumWriter writer, DatumReader reader) throws IOException { checkBinary(schema, datum, writer, reader, null); } - + public static Object checkBinary(Schema schema, Object datum, DatumWriter writer, DatumReader reader, @@ -730,11 +730,11 @@ public static Object checkBinary(Schema schema, Object datum, byte[] data = out.toByteArray(); reader.setSchema(schema); - + Object decoded = reader.read(reuse, DecoderFactory.get().binaryDecoder( data, null)); - + assertEquals("Decoded data does not match.", datum, decoded); return decoded; } @@ -814,7 +814,7 @@ private static void checkJson(Schema schema, Object datum, reader.setSchema(schema); Object decoded = reader.read(null, DecoderFactory.get() .jsonDecoder(schema, new ByteArrayInputStream(data))); - + assertEquals("Decoded data does not match.", datum, decoded); } @@ -909,12 +909,12 @@ public void testEnumMismatch() throws Exception { public void testRecordWithPrimitiveName() { Schema.parse("{\"type\":\"record\", \"name\":\"string\", \"fields\": []}"); } - + @Test(expected=AvroTypeException.class) public void testEnumWithPrimitiveName() { Schema.parse("{\"type\":\"enum\", \"name\":\"null\", \"symbols\": [\"A\"]}"); } - + private static Schema enumSchema() { return Schema.parse("{ \"type\": \"enum\", \"name\": \"e\", " + "\"symbols\": [\"a\", \"b\"]}"); @@ -926,7 +926,7 @@ public void testImmutability1() { s.addProp("p1", "1"); s.addProp("p1", "2"); } - + @Test(expected=AvroRuntimeException.class) public void testImmutability2() { Schema s = enumSchema(); diff --git a/lang/java/ipc/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java b/lang/java/ipc/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java index 34a3601150d..7710be8ac21 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java @@ -119,7 +119,7 @@ public void testManglingForProtocols() throws IOException { assertTrue(protocol.contains("java.lang.CharSequence goto$(java.lang.CharSequence break$)")); assertTrue(protocol.contains("public interface default$")); assertTrue(protocol.contains("throws org.apache.avro.AvroRemoteException, finally$")); - + assertCompilesWithJavaCompiler(c); } @@ -144,7 +144,7 @@ public void testManglingForRecords() throws IOException { assertTrue(contents.contains("public java.lang.CharSequence package$;")); assertTrue(contents.contains("class volatile$ extends")); assertTrue(contents.contains("volatile$ short$;")); - + assertCompilesWithJavaCompiler(c); } @@ -159,7 +159,7 @@ public void testManglingForEnums() throws IOException { String contents = c.iterator().next().contents; assertTrue(contents.contains("new$")); - + assertCompilesWithJavaCompiler(c); } @@ -203,10 +203,10 @@ public void testSchemaWithDocs() { assertTrue(o.contents.contains("/** Very Inner Enum */")); } } - + assertEquals(3, count); } - + @Test public void testProtocolWithDocs() throws IOException { Protocol protocol = TestProtocolParsing.getSimpleProtocol(); @@ -222,7 +222,7 @@ public void testProtocolWithDocs() throws IOException { } assertEquals("Missed generated protocol!", 1, count); } - + @Test public void testNeedCompile() throws IOException, InterruptedException { String schema = "" + @@ -233,8 +233,8 @@ public void testNeedCompile() throws IOException, InterruptedException { FileWriter fw = new FileWriter(inputFile); fw.write(schema); fw.close(); - - File outputDir = new File(System.getProperty("test.dir", "target/test") + + + File outputDir = new File(System.getProperty("test.dir", "target/test") + System.getProperty("file.separator") + "test_need_compile"); File outputFile = new File(outputDir, "Foo.java"); outputFile.delete(); @@ -249,14 +249,14 @@ public void testNeedCompile() throws IOException, InterruptedException { Thread.sleep(1000); //granularity of JVM doesn't seem to go below 1 sec SpecificCompiler.compileSchema(inputFile, outputDir); assertEquals(lastModified, outputFile.lastModified()); - + fw = new FileWriter(inputFile); fw.write(schema); fw.close(); SpecificCompiler.compileSchema(inputFile, outputDir); assertTrue(lastModified != outputFile.lastModified()); } - + /** * Creates a record with the given name, error status, and fields. * @param name the name of the schema. @@ -264,51 +264,51 @@ public void testNeedCompile() throws IOException, InterruptedException { * @param fields the field(s) to add to the schema. * @return the schema. */ - private Schema createRecord(String name, + private Schema createRecord(String name, boolean isError, Field... fields) { Schema record = Schema.createRecord(name, null, null, isError); record.setFields(Arrays.asList(fields)); return record; } - + @Test public void generateGetMethod() { Field height = new Field("height", Schema.create(Type.INT), null, null); Field Height = new Field("Height", Schema.create(Type.INT), null, null); - Field height_and_width = + Field height_and_width = new Field("height_and_width", Schema.create(Type.STRING), null, null); - Field message = + Field message = new Field("message", Schema.create(Type.STRING), null, null); - Field Message = + Field Message = new Field("Message", Schema.create(Type.STRING), null, null); - Field cause = + Field cause = new Field("cause", Schema.create(Type.STRING), null, null); - Field clasz = + Field clasz = new Field("class", Schema.create(Type.STRING), null, null); - Field schema = + Field schema = new Field("schema", Schema.create(Type.STRING), null, null); - Field Schema$ = + Field Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); - + assertEquals("getHeight", SpecificCompiler.generateGetMethod( createRecord("test", false, height), height)); - + assertEquals("getHeightAndWidth", SpecificCompiler.generateGetMethod( createRecord("test", false, height_and_width), height_and_width)); - + assertEquals("getMessage", SpecificCompiler.generateGetMethod( createRecord("test", false, message), message)); message = new Field("message", Schema.create(Type.STRING), null, null); assertEquals("getMessage$", SpecificCompiler.generateGetMethod( createRecord("test", true, message), message)); - + assertEquals("getCause", SpecificCompiler.generateGetMethod( createRecord("test", false, cause), cause)); cause = new Field("cause", Schema.create(Type.STRING), null, null); assertEquals("getCause$", SpecificCompiler.generateGetMethod( createRecord("test", true, cause), cause)); - + assertEquals("getClass$", SpecificCompiler.generateGetMethod( createRecord("test", false, clasz), clasz)); clasz = new Field("class", Schema.create(Type.STRING), null, null); @@ -325,42 +325,42 @@ public void generateGetMethod() { Height = new Field("Height", Schema.create(Type.INT), null, null); assertEquals("getHeight", SpecificCompiler.generateGetMethod( createRecord("test", false, Height), Height)); - + height = new Field("height", Schema.create(Type.INT), null, null); Height = new Field("Height", Schema.create(Type.INT), null, null); assertEquals("getHeight$0", SpecificCompiler.generateGetMethod( createRecord("test", false, height, Height), height)); - + height = new Field("height", Schema.create(Type.INT), null, null); Height = new Field("Height", Schema.create(Type.INT), null, null); assertEquals("getHeight$1", SpecificCompiler.generateGetMethod( createRecord("test", false, height, Height), Height)); - + message = new Field("message", Schema.create(Type.STRING), null, null); Message = new Field("Message", Schema.create(Type.STRING), null, null); assertEquals("getMessage$", SpecificCompiler.generateGetMethod( createRecord("test", true, Message), Message)); - + message = new Field("message", Schema.create(Type.STRING), null, null); Message = new Field("Message", Schema.create(Type.STRING), null, null); assertEquals("getMessage$0", SpecificCompiler.generateGetMethod( createRecord("test", true, message, Message), message)); - + message = new Field("message", Schema.create(Type.STRING), null, null); Message = new Field("Message", Schema.create(Type.STRING), null, null); assertEquals("getMessage$1", SpecificCompiler.generateGetMethod( createRecord("test", true, message, Message), Message)); - + schema = new Field("schema", Schema.create(Type.STRING), null, null); Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); assertEquals("getSchema$", SpecificCompiler.generateGetMethod( createRecord("test", false, Schema$), Schema$)); - + schema = new Field("schema", Schema.create(Type.STRING), null, null); Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); assertEquals("getSchema$0", SpecificCompiler.generateGetMethod( createRecord("test", false, schema, Schema$), schema)); - + schema = new Field("schema", Schema.create(Type.STRING), null, null); Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); assertEquals("getSchema$1", SpecificCompiler.generateGetMethod( @@ -371,40 +371,40 @@ public void generateGetMethod() { public void generateSetMethod() { Field height = new Field("height", Schema.create(Type.INT), null, null); Field Height = new Field("Height", Schema.create(Type.INT), null, null); - Field height_and_width = + Field height_and_width = new Field("height_and_width", Schema.create(Type.STRING), null, null); - Field message = + Field message = new Field("message", Schema.create(Type.STRING), null, null); - Field Message = + Field Message = new Field("Message", Schema.create(Type.STRING), null, null); - Field cause = + Field cause = new Field("cause", Schema.create(Type.STRING), null, null); - Field clasz = + Field clasz = new Field("class", Schema.create(Type.STRING), null, null); - Field schema = + Field schema = new Field("schema", Schema.create(Type.STRING), null, null); - Field Schema$ = + Field Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); - + assertEquals("setHeight", SpecificCompiler.generateSetMethod( createRecord("test", false, height), height)); - + assertEquals("setHeightAndWidth", SpecificCompiler.generateSetMethod( createRecord("test", false, height_and_width), height_and_width)); - + assertEquals("setMessage", SpecificCompiler.generateSetMethod( createRecord("test", false, message), message)); message = new Field("message", Schema.create(Type.STRING), null, null); assertEquals("setMessage$", SpecificCompiler.generateSetMethod( createRecord("test", true, message), message)); - + assertEquals("setCause", SpecificCompiler.generateSetMethod( createRecord("test", false, cause), cause)); cause = new Field("cause", Schema.create(Type.STRING), null, null); assertEquals("setCause$", SpecificCompiler.generateSetMethod( createRecord("test", true, cause), cause)); - + assertEquals("setClass$", SpecificCompiler.generateSetMethod( createRecord("test", false, clasz), clasz)); clasz = new Field("class", Schema.create(Type.STRING), null, null); @@ -421,86 +421,86 @@ public void generateSetMethod() { Height = new Field("Height", Schema.create(Type.INT), null, null); assertEquals("setHeight", SpecificCompiler.generateSetMethod( createRecord("test", false, Height), Height)); - + height = new Field("height", Schema.create(Type.INT), null, null); Height = new Field("Height", Schema.create(Type.INT), null, null); assertEquals("setHeight$0", SpecificCompiler.generateSetMethod( createRecord("test", false, height, Height), height)); - + height = new Field("height", Schema.create(Type.INT), null, null); Height = new Field("Height", Schema.create(Type.INT), null, null); assertEquals("setHeight$1", SpecificCompiler.generateSetMethod( createRecord("test", false, height, Height), Height)); - + message = new Field("message", Schema.create(Type.STRING), null, null); Message = new Field("Message", Schema.create(Type.STRING), null, null); assertEquals("setMessage$", SpecificCompiler.generateSetMethod( createRecord("test", true, Message), Message)); - + message = new Field("message", Schema.create(Type.STRING), null, null); Message = new Field("Message", Schema.create(Type.STRING), null, null); assertEquals("setMessage$0", SpecificCompiler.generateSetMethod( createRecord("test", true, message, Message), message)); - + message = new Field("message", Schema.create(Type.STRING), null, null); Message = new Field("Message", Schema.create(Type.STRING), null, null); assertEquals("setMessage$1", SpecificCompiler.generateSetMethod( createRecord("test", true, message, Message), Message)); - + schema = new Field("schema", Schema.create(Type.STRING), null, null); Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); assertEquals("setSchema$", SpecificCompiler.generateSetMethod( createRecord("test", false, Schema$), Schema$)); - + schema = new Field("schema", Schema.create(Type.STRING), null, null); Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); assertEquals("setSchema$0", SpecificCompiler.generateSetMethod( createRecord("test", false, schema, Schema$), schema)); - + schema = new Field("schema", Schema.create(Type.STRING), null, null); Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); assertEquals("setSchema$1", SpecificCompiler.generateSetMethod( createRecord("test", false, schema, Schema$), Schema$)); } - + @Test public void generateHasMethod() { Field height = new Field("height", Schema.create(Type.INT), null, null); Field Height = new Field("Height", Schema.create(Type.INT), null, null); - Field height_and_width = + Field height_and_width = new Field("height_and_width", Schema.create(Type.STRING), null, null); - Field message = + Field message = new Field("message", Schema.create(Type.STRING), null, null); - Field Message = + Field Message = new Field("Message", Schema.create(Type.STRING), null, null); - Field cause = + Field cause = new Field("cause", Schema.create(Type.STRING), null, null); - Field clasz = + Field clasz = new Field("class", Schema.create(Type.STRING), null, null); - Field schema = + Field schema = new Field("schema", Schema.create(Type.STRING), null, null); - Field Schema$ = + Field Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); - + assertEquals("hasHeight", SpecificCompiler.generateHasMethod( createRecord("test", false, height), height)); - + assertEquals("hasHeightAndWidth", SpecificCompiler.generateHasMethod( createRecord("test", false, height_and_width), height_and_width)); - + assertEquals("hasMessage", SpecificCompiler.generateHasMethod( createRecord("test", false, message), message)); message = new Field("message", Schema.create(Type.STRING), null, null); assertEquals("hasMessage$", SpecificCompiler.generateHasMethod( createRecord("test", true, message), message)); - + assertEquals("hasCause", SpecificCompiler.generateHasMethod( createRecord("test", false, cause), cause)); cause = new Field("cause", Schema.create(Type.STRING), null, null); assertEquals("hasCause$", SpecificCompiler.generateHasMethod( createRecord("test", true, cause), cause)); - + assertEquals("hasClass$", SpecificCompiler.generateHasMethod( createRecord("test", false, clasz), clasz)); clasz = new Field("class", Schema.create(Type.STRING), null, null); @@ -517,86 +517,86 @@ public void generateHasMethod() { Height = new Field("Height", Schema.create(Type.INT), null, null); assertEquals("hasHeight", SpecificCompiler.generateHasMethod( createRecord("test", false, Height), Height)); - + height = new Field("height", Schema.create(Type.INT), null, null); Height = new Field("Height", Schema.create(Type.INT), null, null); assertEquals("hasHeight$0", SpecificCompiler.generateHasMethod( createRecord("test", false, height, Height), height)); - + height = new Field("height", Schema.create(Type.INT), null, null); Height = new Field("Height", Schema.create(Type.INT), null, null); assertEquals("hasHeight$1", SpecificCompiler.generateHasMethod( createRecord("test", false, height, Height), Height)); - + message = new Field("message", Schema.create(Type.STRING), null, null); Message = new Field("Message", Schema.create(Type.STRING), null, null); assertEquals("hasMessage$", SpecificCompiler.generateHasMethod( createRecord("test", true, Message), Message)); - + message = new Field("message", Schema.create(Type.STRING), null, null); Message = new Field("Message", Schema.create(Type.STRING), null, null); assertEquals("hasMessage$0", SpecificCompiler.generateHasMethod( createRecord("test", true, message, Message), message)); - + message = new Field("message", Schema.create(Type.STRING), null, null); Message = new Field("Message", Schema.create(Type.STRING), null, null); assertEquals("hasMessage$1", SpecificCompiler.generateHasMethod( createRecord("test", true, message, Message), Message)); - + schema = new Field("schema", Schema.create(Type.STRING), null, null); Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); assertEquals("hasSchema$", SpecificCompiler.generateHasMethod( createRecord("test", false, Schema$), Schema$)); - + schema = new Field("schema", Schema.create(Type.STRING), null, null); Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); assertEquals("hasSchema$0", SpecificCompiler.generateHasMethod( createRecord("test", false, schema, Schema$), schema)); - + schema = new Field("schema", Schema.create(Type.STRING), null, null); Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); assertEquals("hasSchema$1", SpecificCompiler.generateHasMethod( createRecord("test", false, schema, Schema$), Schema$)); } - + @Test public void generateClearMethod() { Field height = new Field("height", Schema.create(Type.INT), null, null); Field Height = new Field("Height", Schema.create(Type.INT), null, null); - Field height_and_width = + Field height_and_width = new Field("height_and_width", Schema.create(Type.STRING), null, null); - Field message = + Field message = new Field("message", Schema.create(Type.STRING), null, null); - Field Message = + Field Message = new Field("Message", Schema.create(Type.STRING), null, null); - Field cause = + Field cause = new Field("cause", Schema.create(Type.STRING), null, null); - Field clasz = + Field clasz = new Field("class", Schema.create(Type.STRING), null, null); - Field schema = + Field schema = new Field("schema", Schema.create(Type.STRING), null, null); - Field Schema$ = + Field Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); - + assertEquals("clearHeight", SpecificCompiler.generateClearMethod( createRecord("test", false, height), height)); - + assertEquals("clearHeightAndWidth", SpecificCompiler.generateClearMethod( createRecord("test", false, height_and_width), height_and_width)); - + assertEquals("clearMessage", SpecificCompiler.generateClearMethod( createRecord("test", false, message), message)); message = new Field("message", Schema.create(Type.STRING), null, null); assertEquals("clearMessage$", SpecificCompiler.generateClearMethod( createRecord("test", true, message), message)); - + assertEquals("clearCause", SpecificCompiler.generateClearMethod( createRecord("test", false, cause), cause)); cause = new Field("cause", Schema.create(Type.STRING), null, null); assertEquals("clearCause$", SpecificCompiler.generateClearMethod( createRecord("test", true, cause), cause)); - + assertEquals("clearClass$", SpecificCompiler.generateClearMethod( createRecord("test", false, clasz), clasz)); clasz = new Field("class", Schema.create(Type.STRING), null, null); @@ -613,42 +613,42 @@ public void generateClearMethod() { Height = new Field("Height", Schema.create(Type.INT), null, null); assertEquals("clearHeight", SpecificCompiler.generateClearMethod( createRecord("test", false, Height), Height)); - + height = new Field("height", Schema.create(Type.INT), null, null); Height = new Field("Height", Schema.create(Type.INT), null, null); assertEquals("clearHeight$0", SpecificCompiler.generateClearMethod( createRecord("test", false, height, Height), height)); - + height = new Field("height", Schema.create(Type.INT), null, null); Height = new Field("Height", Schema.create(Type.INT), null, null); assertEquals("clearHeight$1", SpecificCompiler.generateClearMethod( createRecord("test", false, height, Height), Height)); - + message = new Field("message", Schema.create(Type.STRING), null, null); Message = new Field("Message", Schema.create(Type.STRING), null, null); assertEquals("clearMessage$", SpecificCompiler.generateClearMethod( createRecord("test", true, Message), Message)); - + message = new Field("message", Schema.create(Type.STRING), null, null); Message = new Field("Message", Schema.create(Type.STRING), null, null); assertEquals("clearMessage$0", SpecificCompiler.generateClearMethod( createRecord("test", true, message, Message), message)); - + message = new Field("message", Schema.create(Type.STRING), null, null); Message = new Field("Message", Schema.create(Type.STRING), null, null); assertEquals("clearMessage$1", SpecificCompiler.generateClearMethod( createRecord("test", true, message, Message), Message)); - + schema = new Field("schema", Schema.create(Type.STRING), null, null); Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); assertEquals("clearSchema$", SpecificCompiler.generateClearMethod( createRecord("test", false, Schema$), Schema$)); - + schema = new Field("schema", Schema.create(Type.STRING), null, null); Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); assertEquals("clearSchema$0", SpecificCompiler.generateClearMethod( createRecord("test", false, schema, Schema$), schema)); - + schema = new Field("schema", Schema.create(Type.STRING), null, null); Schema$ = new Field("Schema", Schema.create(Type.STRING), null, null); assertEquals("clearSchema$1", SpecificCompiler.generateClearMethod( @@ -694,7 +694,7 @@ public void testAliases() throws IOException { * that the generated code is valid. */ public static void - assertCompiles(Schema schema, boolean useJavaCompiler) + assertCompiles(Schema schema, boolean useJavaCompiler) throws IOException { Collection outputs = new SpecificCompiler(schema).compile(); assertTrue(null != outputs); @@ -702,7 +702,7 @@ public void testAliases() throws IOException { assertCompilesWithJavaCompiler(outputs); } } - + /** * Checks that a protocol passes through the SpecificCompiler, * and, optionally, uses the system's Java compiler to check @@ -716,9 +716,9 @@ public static void assertCompiles(Protocol protocol, boolean useJavaCompiler) assertCompilesWithJavaCompiler(outputs); } } - + /** Uses the system's java compiler to actually compile the generated code. */ - static void assertCompilesWithJavaCompiler(Collection outputs) + static void assertCompilesWithJavaCompiler(Collection outputs) throws IOException { if (outputs.isEmpty()) { return; // Nothing to compile! @@ -730,10 +730,10 @@ static void assertCompilesWithJavaCompiler(Collection outputs) } JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); - StandardJavaFileManager fileManager = + StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null); - - CompilationTask cTask = compiler.getTask(null, fileManager, null, null, + + CompilationTask cTask = compiler.getTask(null, fileManager, null, null, null, fileManager.getJavaFileObjects( javaFiles.toArray(new File[javaFiles.size()]))); diff --git a/lang/java/ipc/src/test/java/org/apache/avro/generic/TestDeepCopy.java b/lang/java/ipc/src/test/java/org/apache/avro/generic/TestDeepCopy.java index 0cf36f5fb0b..382939122db 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/generic/TestDeepCopy.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/generic/TestDeepCopy.java @@ -49,37 +49,37 @@ public void testDeepCopy() { interopBuilder.setBytesField(ByteBuffer.wrap(new byte[] { 1, 2, 3, 4 })); interopBuilder.setDoubleField(3.14d); interopBuilder.setEnumField(Kind.B); - interopBuilder.setFixedField(new MD5(new byte[] { + interopBuilder.setFixedField(new MD5(new byte[] { 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1, 4, 3, 2, 1 })); interopBuilder.setFloatField(6.022f); interopBuilder.setIntField(32); interopBuilder.setLongField(64L); - - Map map = + + Map map = new HashMap(1); map.put("foo", Foo.newBuilder().setLabel("bar").build()); interopBuilder.setMapField(map); - + interopBuilder.setNullField(null); - + Node.Builder rootBuilder = Node.newBuilder().setLabel("/"); Node.Builder homeBuilder = Node.newBuilder().setLabel("home"); homeBuilder.setChildren(new ArrayList(0)); rootBuilder.setChildren(Arrays.asList(new Node[] { homeBuilder.build() })); interopBuilder.setRecordField(rootBuilder.build()); - + interopBuilder.setStringField("Hello"); interopBuilder.setUnionField(Arrays.asList(new ByteBuffer[] { ByteBuffer.wrap(new byte[] { 1, 2 }) })); - + Interop interop = interopBuilder.build(); - + // Verify that deepCopy works for all fields: for (Field field : Interop.SCHEMA$.getFields()) { // Original field and deep copy should be equivalent: if (interop.get(field.pos()) instanceof ByteBuffer) { assertTrue(Arrays.equals(((ByteBuffer)interop.get(field.pos())).array(), - ((ByteBuffer)GenericData.get().deepCopy(field.schema(), + ((ByteBuffer)GenericData.get().deepCopy(field.schema(), interop.get(field.pos()))).array())); } else { @@ -87,7 +87,7 @@ public void testDeepCopy() { SpecificData.get().deepCopy( field.schema(), interop.get(field.pos()))); } - + // Original field and deep copy should be different instances: if ((field.schema().getType() != Type.ENUM) && (field.schema().getType() != Type.NULL) @@ -98,7 +98,7 @@ public void testDeepCopy() { && (field.schema().getType() != Type.DOUBLE) && (field.schema().getType() != Type.STRING)) { assertFalse("Field " + field.name() + " is same instance in deep copy", - interop.get(field.pos()) == + interop.get(field.pos()) == GenericData.get().deepCopy( field.schema(), interop.get(field.pos()))); } diff --git a/lang/java/ipc/src/test/java/org/apache/avro/io/Perf.java b/lang/java/ipc/src/test/java/org/apache/avro/io/Perf.java index 762a21570cc..1f8a892103f 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/io/Perf.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/io/Perf.java @@ -52,7 +52,7 @@ public class Perf { private static final int COUNT = 250000; // needs to be a multiple of 4 private static final int CYCLES = 800; - + /** * Use a fixed value seed for random number generation * to allow for better cross-run comparisons. @@ -62,7 +62,7 @@ public class Perf { protected static Random newRandom() { return new Random(SEED); } - + private static class TestDescriptor { Class test; String param; @@ -75,7 +75,7 @@ void add(List typeList) { typeList.add(this); } } - + private static final List BASIC = new ArrayList(); private static final List RECORD = new ArrayList(); private static final List GENERIC = new ArrayList(); @@ -132,7 +132,7 @@ void add(List typeList) { new TestDescriptor(ReflectNestedLargeFloatArrayTest.class, "-REFnlf").add(REFLECT); new TestDescriptor(ReflectNestedLargeFloatArrayBlockedTest.class, "-REFnlfb").add(REFLECT); } - + private static void usage() { StringBuilder usage = new StringBuilder("Usage: Perf { -nowrite | -noread | "); StringBuilder details = new StringBuilder(); @@ -154,7 +154,7 @@ private static void usage() { System.out.println(usage.toString()); System.out.print(details.toString()); } - + public static void main(String[] args) throws Exception { List tests = new ArrayList(); boolean writeTests = true; @@ -192,7 +192,7 @@ public static void main(String[] args) throws Exception { } System.out.println("Executing tests: \n" + tests + "\n readTests:" + readTests + "\n writeTests:" + writeTests + "\n cycles=" + CYCLES); - + for (int k = 0; k < tests.size(); k++) { Test t = tests.get(k); try { @@ -210,7 +210,7 @@ public static void main(String[] args) throws Exception { throw e; } } - + printHeader(); for (int k = 0; k < tests.size(); k++) { @@ -248,25 +248,25 @@ public static void main(String[] args) throws Exception { t.reset(); } } - + private static final void printHeader() { String header = String.format( "%60s time M entries/sec M bytes/sec bytes/cycle", "test name"); System.out.println(header.toString()); } - + private static final void printResult(long s, Test t, String name) { s /= 1000; double entries = (t.cycles * (double) t.count); double bytes = t.cycles * (double) t.encodedSize; StringBuilder result = new StringBuilder(); result.append(String.format("%42s: %6d ms ", name, (s/1000))); - result.append(String.format("%10.3f %11.3f %11d", + result.append(String.format("%10.3f %11.3f %11d", (entries / s), (bytes/ s), t.encodedSize)); System.out.println(result.toString()); } - + private abstract static class Test { /** @@ -280,7 +280,7 @@ private abstract static class Test { protected boolean isWriteTest = true; static DecoderFactory decoder_factory = new DecoderFactory(); static EncoderFactory encoder_factory = new EncoderFactory(); - + public Test(String name, int cycles, int count) { this.name = name; this.cycles = cycles; @@ -291,33 +291,33 @@ public Test(String name, int cycles, int count) { * Reads data from a Decoder and returns the time taken in nanoseconds. */ abstract long readTest() throws IOException; - + /** * Writes data to an Encoder and returns the time taken in nanoseconds. */ abstract long writeTest() throws IOException; - + final boolean isWriteTest() { return isWriteTest; } - + final boolean isReadTest() { return isReadTest; } - + /** initializes data for read and write tests **/ abstract void init() throws IOException; /** clears generated data arrays and other large objects created during initialization **/ abstract void reset(); - + @Override public String toString() { return this.getClass().getSimpleName(); } - + } - + /** the basic test writes a simple schema directly to an encoder or * reads from an array. It does not use GenericDatumReader or any * higher level constructs, just manual serialization. @@ -340,7 +340,7 @@ public final long readTest() throws IOException { readInternal(d); return (System.nanoTime() - t); } - + @Override public final long writeTest() throws IOException { long t = System.nanoTime(); @@ -349,11 +349,11 @@ public final long writeTest() throws IOException { e.flush(); return (System.nanoTime() - t); } - + protected Decoder getDecoder() throws IOException { return newDecoder(); } - + private Encoder getEncoder() throws IOException { return newEncoder(getOutputStream()); } @@ -361,7 +361,7 @@ private Encoder getEncoder() throws IOException { protected Decoder newDecoder() { return decoder_factory.binaryDecoder(data, null); } - + protected Encoder newEncoder(ByteArrayOutputStream out) throws IOException { Encoder e = encoder_factory.binaryEncoder(out, null); // Encoder e = encoder_factory.directBinaryEncoder(out, null); @@ -373,7 +373,7 @@ protected Encoder newEncoder(ByteArrayOutputStream out) throws IOException { private ByteArrayOutputStream getOutputStream() { return new ByteArrayOutputStream((int)(encodedSize > 0 ? encodedSize : count)); } - + @Override void init() throws IOException { genSourceData(); @@ -390,7 +390,7 @@ void init() throws IOException { abstract void readInternal(Decoder d) throws IOException; abstract void writeInternal(Encoder e) throws IOException; } - + static class IntTest extends BasicTest { protected int[] sourceData = null; public IntTest() throws IOException { @@ -412,7 +412,7 @@ void genSourceData() { sourceData[i+3] = r.nextInt(150000000); // most in 4, some in 5 } } - + @Override void readInternal(Decoder d) throws IOException { for (int i = 0; i < count/4; i++) { @@ -432,7 +432,7 @@ void writeInternal(Encoder e) throws IOException { e.writeInt(sourceData[i+3]); } } - + @Override void reset() { sourceData = null; @@ -466,30 +466,30 @@ void writeInternal(Encoder e) throws IOException { } } } - + // this tests reading Longs that are sometimes very large static class LongTest extends BasicTest { private long[] sourceData = null; public LongTest() throws IOException { super("Long", "{ \"type\": \"long\"} "); } - + @Override void genSourceData() { Random r = newRandom(); sourceData = new long[count]; for (int i = 0; i < sourceData.length; i+=4) { - sourceData[i] = r.nextLong() % 0x7FL; // half fit in 1, half in 2 + sourceData[i] = r.nextLong() % 0x7FL; // half fit in 1, half in 2 sourceData[i+1] = r.nextLong() % 0x1FFFFFL; // half fit in <=3, half in 4 sourceData[i+2] = r.nextLong() % 0x3FFFFFFFFL; // half in <=5, half in 6 - sourceData[i+3] = r.nextLong() % 0x1FFFFFFFFFFFFL; // half in <=8, half in 9 + sourceData[i+3] = r.nextLong() % 0x1FFFFFFFFFFFFL; // half in <=8, half in 9 } // last 16, make full size for (int i = sourceData.length - 16; i < sourceData.length; i ++) { sourceData[i] = r.nextLong(); } } - + @Override void readInternal(Decoder d) throws IOException { for (int i = 0; i < count/4; i++) { @@ -509,14 +509,14 @@ void writeInternal(Encoder e) throws IOException { e.writeLong(sourceData[i+3]); } } - + @Override void reset() { sourceData = null; data = null; } } - + static class FloatTest extends BasicTest { float[] sourceData = null; public FloatTest() throws IOException { @@ -531,10 +531,10 @@ void genSourceData() { Random r = newRandom(); sourceData = new float[count]; for (int i = 0; i < sourceData.length;) { - sourceData[i++] = r.nextFloat(); + sourceData[i++] = r.nextFloat(); } } - + @Override void readInternal(Decoder d) throws IOException { for (int i = 0; i < count; i+=4) { @@ -554,7 +554,7 @@ void writeInternal(Encoder e) throws IOException { e.writeFloat(sourceData[i+3]); } } - + @Override void reset() { sourceData = null; @@ -567,16 +567,16 @@ static class DoubleTest extends BasicTest { public DoubleTest() throws IOException { super("Double", "{ \"type\": \"double\"} "); } - + @Override void genSourceData() { Random r = newRandom(); sourceData = new double[count]; for (int i = 0; i < sourceData.length;) { - sourceData[i++] = r.nextDouble(); + sourceData[i++] = r.nextDouble(); } } - + @Override void readInternal(Decoder d) throws IOException { for (int i = 0; i < count; i+=4) { @@ -596,29 +596,29 @@ void writeInternal(Encoder e) throws IOException { e.writeDouble(sourceData[i+3]); } } - + @Override void reset() { sourceData = null; data = null; } } - + static class BoolTest extends BasicTest { boolean[] sourceData = null; public BoolTest() throws IOException { super("Boolean", "{ \"type\": \"boolean\"} "); } - + @Override void genSourceData() { Random r = newRandom(); sourceData = new boolean[count]; for (int i = 0; i < sourceData.length;) { - sourceData[i++] = r.nextBoolean(); + sourceData[i++] = r.nextBoolean(); } } - + @Override void readInternal(Decoder d) throws IOException { for (int i = 0; i < count/4; i++) { @@ -638,20 +638,20 @@ void writeInternal(Encoder e) throws IOException { e.writeBoolean(sourceData[i+3]); } } - + @Override void reset() { sourceData = null; data = null; } } - + static class BytesTest extends BasicTest { byte[][] sourceData = null; public BytesTest() throws IOException { super("Bytes", "{ \"type\": \"bytes\"} ", 5); } - + @Override void genSourceData() { Random r = newRandom(); @@ -659,10 +659,10 @@ void genSourceData() { for (int i = 0; i < sourceData.length;) { byte[] data = new byte[r.nextInt(70)]; r.nextBytes(data); - sourceData[i++] = data; + sourceData[i++] = data; } } - + @Override void readInternal(Decoder d) throws IOException { ByteBuffer bb = ByteBuffer.allocate(70); @@ -683,14 +683,14 @@ void writeInternal(Encoder e) throws IOException { e.writeBytes(sourceData[i+3]); } } - + @Override void reset() { sourceData = null; data = null; } } - + private static String randomString(Random r) { char[] data = new char[r.nextInt(70)]; for (int j = 0; j < data.length; j++) { @@ -704,7 +704,7 @@ static class StringTest extends BasicTest { public StringTest() throws IOException { super("String", "{ \"type\": \"string\"} ", 5); } - + @Override void genSourceData() { Random r = newRandom(); @@ -712,7 +712,7 @@ void genSourceData() { for (int i = 0; i < sourceData.length;) sourceData[i++] = randomString(r); } - + @Override void readInternal(Decoder d) throws IOException { Utf8 utf = new Utf8(); @@ -733,14 +733,14 @@ void writeInternal(Encoder e) throws IOException { e.writeString(sourceData[i+3]); } } - + @Override void reset() { sourceData = null; data = null; } } - + static class ArrayTest extends FloatTest { public ArrayTest() throws IOException { super("Array", @@ -757,7 +757,7 @@ public ArrayTest() throws IOException { " }" + " }]}}"); } - + @Override void readInternal(Decoder d) throws IOException { d.readArrayStart(); @@ -791,7 +791,7 @@ void writeInternal(Encoder e) throws IOException { e.writeArrayEnd(); } } - + static class MapTest extends FloatTest { public MapTest() throws IOException { super("Map", "{ \"type\": \"map\", \"values\": " + @@ -802,7 +802,7 @@ public MapTest() throws IOException { " {\"name\":\"f4\", \"type\":\"float\"}]" + " }} "); } - + @Override void readInternal(Decoder d) throws IOException { Utf8 key = new Utf8(); @@ -834,8 +834,8 @@ void writeInternal(Encoder e) throws IOException { e.writeMapEnd(); } } - - private static final String RECORD_SCHEMA = + + private static final String RECORD_SCHEMA = "{ \"type\": \"record\", \"name\": \"R\", \"fields\": [\n" + "{ \"name\": \"f1\", \"type\": \"double\" },\n" + "{ \"name\": \"f2\", \"type\": \"double\" },\n" @@ -844,7 +844,7 @@ void writeInternal(Encoder e) throws IOException { + "{ \"name\": \"f5\", \"type\": \"int\" },\n" + "{ \"name\": \"f6\", \"type\": \"int\" }\n" + "] }"; - + private static final String NESTED_RECORD_SCHEMA = "{ \"type\": \"record\", \"name\": \"R\", \"fields\": [\n" + "{ \"name\": \"f1\", \"type\": \n" + @@ -857,7 +857,7 @@ void writeInternal(Encoder e) throws IOException { + "{ \"name\": \"f5\", \"type\": \"int\" },\n" + "{ \"name\": \"f6\", \"type\": \"int\" }\n" + "] }"; - + private static class Rec { double f1; double f2; @@ -866,7 +866,7 @@ private static class Rec { int f5; int f6; Rec() { - + } Rec(Random r) { f1 = r.nextDouble(); @@ -891,7 +891,7 @@ void genSourceData() { Random r = newRandom(); sourceData = new Rec[count]; for (int i = 0; i < sourceData.length; i++) { - sourceData[i] = new Rec(r); + sourceData[i] = new Rec(r); } } @Override @@ -923,7 +923,7 @@ void reset() { data = null; } } - + static class ValidatingRecord extends RecordTest { ValidatingRecord() throws IOException { super("ValidatingRecord"); @@ -934,10 +934,10 @@ protected Decoder getDecoder() throws IOException { } @Override protected Encoder newEncoder(ByteArrayOutputStream out) throws IOException { - return encoder_factory.validatingEncoder(schema, super.newEncoder(out)); + return encoder_factory.validatingEncoder(schema, super.newEncoder(out)); } } - + static class ResolvingRecord extends RecordTest { public ResolvingRecord() throws IOException { super("ResolvingRecord"); @@ -962,7 +962,7 @@ protected Decoder getDecoder() throws IOException { + "{ \"name\": \"f8\", \"type\": \"string\"," + "\"default\": \"undefined\" }\n" + "] }"; - + private static final String RECORD_SCHEMA_WITH_OUT_OF_ORDER = "{ \"type\": \"record\", \"name\": \"R\", \"fields\": [\n" + "{ \"name\": \"f1\", \"type\": \"double\" },\n" @@ -1025,7 +1025,7 @@ protected void readInternal(Decoder d) throws IOException { } } } - + /** * Tests the performance of resolving a change in field order. */ @@ -1063,7 +1063,7 @@ protected void readInternal(Decoder d) throws IOException { } } } - + /** * Tests the performance of resolving a type promotion. */ @@ -1101,7 +1101,7 @@ protected void readInternal(Decoder d) throws IOException { } } } - + static class GenericTest extends BasicTest { GenericRecord[] sourceData = null; protected final GenericDatumReader reader; @@ -1133,7 +1133,7 @@ void genSourceData() { rec.put(3, r.nextInt()); rec.put(4, r.nextInt()); rec.put(5, r.nextInt()); - sourceData[i] = rec; + sourceData[i] = rec; } } @Override @@ -1156,14 +1156,14 @@ void reset() { data = null; } } - - private static final String GENERIC_STRINGS = + + private static final String GENERIC_STRINGS = "{ \"type\": \"record\", \"name\": \"R\", \"fields\": [\n" + "{ \"name\": \"f1\", \"type\": \"string\" },\n" + "{ \"name\": \"f2\", \"type\": \"string\" },\n" + "{ \"name\": \"f3\", \"type\": \"string\" }\n" + "] }"; - + static class GenericStrings extends GenericTest { public GenericStrings() throws IOException { super("GenericStrings", GENERIC_STRINGS); @@ -1177,7 +1177,7 @@ void genSourceData() { rec.put(0, randomString(r)); rec.put(1, randomString(r)); rec.put(2, randomString(r)); - sourceData[i] = rec; + sourceData[i] = rec; } } } @@ -1210,11 +1210,11 @@ static GenericRecord[] generateGenericNested(Schema schema, int count) { rec.put(3, r.nextInt()); rec.put(4, r.nextInt()); rec.put(5, r.nextInt()); - sourceData[i] = rec; + sourceData[i] = rec; } return sourceData; } - + static class GenericNestedFake extends BasicTest { //reads and writes generic data, but not using //GenericDatumReader or GenericDatumWriter @@ -1267,7 +1267,7 @@ void reset() { data = null; sourceData = null; } - + } private static abstract class GenericResolving extends GenericTest { @@ -1312,7 +1312,7 @@ protected Schema getReaderSchema() { return new Schema.Parser().parse(RECORD_SCHEMA_WITH_PROMOTION); } } - + static class GenericOneTimeDecoderUse extends GenericTest { public GenericOneTimeDecoderUse() throws IOException { super("GenericOneTimeDecoderUse_"); @@ -1487,7 +1487,7 @@ protected Rec createDatum(Random r) { return new Rec(r); } } - + static class ReflectFloatTest extends ReflectTest { ReflectFloatTest() throws IOException { super("ReflectFloat", new float[0], COUNT); @@ -1531,7 +1531,7 @@ protected double[] createDatum(Random r) { return populateDoubleArray(r); } } - + static class ReflectIntArrayTest extends ReflectTest { ReflectIntArrayTest() throws IOException { super("ReflectIntArray", new int[0], 12); @@ -1542,7 +1542,7 @@ protected int[] createDatum(Random r) { return populateIntArray(r); } } - + static class ReflectLongArrayTest extends ReflectTest { ReflectLongArrayTest() throws IOException { super("ReflectLongArray", new long[0], 24); @@ -1571,7 +1571,7 @@ static public class Foo { Foo() { } - + Foo(Random r) { bar = new Vals[smallArraySize(r)]; for (int i = 0; i < bar.length; i++) { @@ -1588,7 +1588,7 @@ static class Vals { Vals(){ } - + Vals(Random r) { this.f1 = r.nextFloat(); this.f2 = r.nextFloat(); @@ -1601,7 +1601,7 @@ static class Vals { static public class FloatFoo { float[] floatBar; - + FloatFoo() { } @@ -1624,7 +1624,7 @@ static float[] populateFloatArray(Random r, boolean large) { int size = large ? largeArraySize(r) : smallArraySize(r); return populateFloatArray(r, size); } - + static float[] populateFloatArray(Random r, int size) { float[] result = new float[size]; for (int i = 0; i < result.length; i++) { @@ -1632,11 +1632,11 @@ static float[] populateFloatArray(Random r, int size) { } return result; } - + static double[] populateDoubleArray(Random r) { return populateDoubleArray(r, smallArraySize(r)); } - + static double[] populateDoubleArray(Random r, int size) { double[] result = new double[size]; for (int i = 0; i < result.length; i++) { @@ -1653,7 +1653,7 @@ static int[] populateIntArray(Random r) { } return result; } - + static long[] populateLongArray(Random r) { int size = smallArraySize(r); long[] result = new long[size]; @@ -1662,7 +1662,7 @@ static long[] populateLongArray(Random r) { } return result; } - + static class ReflectNestedFloatArrayTest extends ReflectTest { public ReflectNestedFloatArrayTest() throws IOException { super("ReflectNestedFloatArray", new FloatFoo(new Random(), false), 10); @@ -1686,7 +1686,7 @@ protected FloatFoo createDatum(Random r) { } } - + static class ReflectNestedLargeFloatArrayBlockedTest extends ReflectTest { public ReflectNestedLargeFloatArrayBlockedTest() throws IOException { super("ReflectNestedLargeFloatArrayBlocked", new FloatFoo(new Random(), true), @@ -1697,7 +1697,7 @@ public ReflectNestedLargeFloatArrayBlockedTest() throws IOException { protected FloatFoo createDatum(Random r) { return new FloatFoo(r, true); } - + @Override protected Encoder newEncoder(ByteArrayOutputStream out) throws IOException { return new EncoderFactory().configureBlockSize(254).blockingBinaryEncoder(out, null); @@ -1722,7 +1722,7 @@ private static class Rec1 { Rec1() { } - + Rec1(Random r) { d1 = r.nextDouble(); d11 = r.nextDouble(); diff --git a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestLocalTransceiver.java b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestLocalTransceiver.java index 09f707869d1..47ee403300d 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestLocalTransceiver.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestLocalTransceiver.java @@ -59,7 +59,7 @@ public void testSingleRpc() throws IOException { "m").getRequest()); params.put("x", new Utf8("hello")); GenericRequestor r = new GenericRequestor(protocol, t); - + for(int x = 0; x < 5; x++) assertEquals(new Utf8("there"), r.request("m", params)); } diff --git a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServer.java b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServer.java index a39de4cfc2b..14981c3f11e 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServer.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServer.java @@ -49,31 +49,31 @@ public class TestNettyServer { public static class MailImpl implements Mail { private CountDownLatch allMessages = new CountDownLatch(5); - + // in this simple example just return details of the message public String send(Message message) { - return "Sent message to ["+ message.getTo().toString() + - "] from [" + message.getFrom().toString() + "] with body [" + + return "Sent message to ["+ message.getTo().toString() + + "] from [" + message.getFrom().toString() + "] with body [" + message.getBody().toString() + "]"; } - + public void fireandforget(Message message) { allMessages.countDown(); } - + private void awaitMessages() throws InterruptedException { allMessages.await(2, TimeUnit.SECONDS); } - + private void assertAllMessagesReceived() { assertEquals(0, allMessages.getCount()); } public void reset() { - allMessages = new CountDownLatch(5); + allMessages = new CountDownLatch(5); } } - + @BeforeClass public static void initializeConnections()throws Exception { // start server @@ -82,23 +82,23 @@ public static void initializeConnections()throws Exception { Responder responder = new SpecificResponder(Mail.class, mailService); server = initializeServer(responder); server.start(); - + int serverPort = server.getPort(); System.out.println("server port : " + serverPort); transceiver = initializeTransceiver(serverPort); proxy = SpecificRequestor.getClient(Mail.class, transceiver); } - + protected static Server initializeServer(Responder responder) { return new NettyServer(responder, new InetSocketAddress(0)); } - + protected static Transceiver initializeTransceiver(int serverPort) throws IOException { return new NettyTransceiver(new InetSocketAddress( serverPort), CONNECT_TIMEOUT_MILLIS); } - + @AfterClass public static void tearDownConnections() throws Exception{ transceiver.close(); @@ -117,7 +117,7 @@ private void verifyResponse(String result) { "Sent message to [wife] from [husband] with body [I love you!]", result.toString()); } - + @Test public void testOneway() throws Exception { for (int x = 0; x < 5; x++) { @@ -126,7 +126,7 @@ public void testOneway() throws Exception { mailService.awaitMessages(); mailService.assertAllMessagesReceived(); } - + @Test public void testMixtureOfRequests() throws Exception { mailService.reset(); diff --git a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerConcurrentExecution.java b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerConcurrentExecution.java index 6d3fd1ec6bb..8859998f0ce 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerConcurrentExecution.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerConcurrentExecution.java @@ -37,31 +37,31 @@ import org.junit.Test; /** - * Verifies that RPCs executed by different client threads using the same + * Verifies that RPCs executed by different client threads using the same * NettyTransceiver will execute concurrently. The test follows these steps: - * 1. Execute the {@link #org.apache.avro.test.Simple.add(int, int)} RPC to + * 1. Execute the {@link #org.apache.avro.test.Simple.add(int, int)} RPC to * complete the Avro IPC handshake. * 2a. In a background thread, wait for the waitLatch. - * 3a. In the main thread, invoke - * {@link #org.apache.avro.test.Simple.hello(String)} with the argument - * "wait". This causes the ClientImpl running on the server to count down - * the wait latch, which will unblock the background thread and allow it to - * proceed. After counting down the latch, this call blocks, waiting for + * 3a. In the main thread, invoke + * {@link #org.apache.avro.test.Simple.hello(String)} with the argument + * "wait". This causes the ClientImpl running on the server to count down + * the wait latch, which will unblock the background thread and allow it to + * proceed. After counting down the latch, this call blocks, waiting for * {@link #org.apache.avro.test.Simple.ack()} to be invoked. - * 2b. The background thread wakes up because the waitLatch has been counted + * 2b. The background thread wakes up because the waitLatch has been counted * down. Now we know that some thread is executing inside hello(String). - * Next, execute {@link #org.apache.avro.test.Simple.ack()} in the - * background thread, which will allow the thread executing hello(String) + * Next, execute {@link #org.apache.avro.test.Simple.ack()} in the + * background thread, which will allow the thread executing hello(String) * to return. - * 3b. The thread executing hello(String) on the server unblocks (since ack() + * 3b. The thread executing hello(String) on the server unblocks (since ack() * has been called), allowing hello(String) to return. - * 4. If control returns to the main thread, we know that two RPCs + * 4. If control returns to the main thread, we know that two RPCs * (hello(String) and ack()) were executing concurrently. */ public class TestNettyServerConcurrentExecution { private Server server; private Transceiver transceiver; - + @After public void cleanUpAfter() throws Exception { try { @@ -79,41 +79,41 @@ public void cleanUpAfter() throws Exception { e.printStackTrace(); } } - + @Test(timeout=30000) public void test() throws Exception { final CountDownLatch waitLatch = new CountDownLatch(1); server = new NettyServer( - new SpecificResponder(Simple.class, new SimpleImpl(waitLatch)), - new InetSocketAddress(0), + new SpecificResponder(Simple.class, new SimpleImpl(waitLatch)), + new InetSocketAddress(0), new NioServerSocketChannelFactory - (Executors.newCachedThreadPool(), Executors.newCachedThreadPool()), + (Executors.newCachedThreadPool(), Executors.newCachedThreadPool()), new ExecutionHandler(Executors.newCachedThreadPool())); server.start(); - + transceiver = new NettyTransceiver(new InetSocketAddress( server.getPort()), TestNettyServer.CONNECT_TIMEOUT_MILLIS); - + // 1. Create the RPC proxy, and establish the handshake: - final Simple.Callback simpleClient = + final Simple.Callback simpleClient = SpecificRequestor.getClient(Simple.Callback.class, transceiver); SpecificRequestor.getRemote(simpleClient); // force handshake - + /* * 2a. In a background thread, wait for the Client.hello("wait") call to be * received by the server, then: - * 2b. Execute the Client.ack() RPC, which will unblock the + * 2b. Execute the Client.ack() RPC, which will unblock the * Client.hello("wait") call, allowing it to return to the main thread. */ new Thread() { @Override public void run() { - setName(TestNettyServerConcurrentExecution.class.getSimpleName() + + setName(TestNettyServerConcurrentExecution.class.getSimpleName() + "Ack Thread"); try { // Step 2a: waitLatch.await(); - + // Step 2b: simpleClient.ack(); } catch (InterruptedException e) { @@ -121,27 +121,27 @@ public void run() { } } }.start(); - + /* * 3. Execute the Client.hello("wait") RPC, which will block until the * Client.ack() call has completed in the background thread. */ String response = simpleClient.hello("wait"); - + // 4. If control reaches here, both RPCs have executed concurrently - Assert.assertEquals("wait", response); + Assert.assertEquals("wait", response); } /** * Implementation of the Simple interface for use with this unit test. - * If {@link #hello(String)} is called with "wait" as its argument, - * {@link #waitLatch} will be counted down, and {@link #hello(String)} will + * If {@link #hello(String)} is called with "wait" as its argument, + * {@link #waitLatch} will be counted down, and {@link #hello(String)} will * block until {@link #ack()} has been invoked. */ private static class SimpleImpl implements Simple { private final CountDownLatch waitLatch; private final CountDownLatch ackLatch = new CountDownLatch(1); - + /** * Creates a SimpleImpl that uses the given CountDownLatch. * @param waitLatch the CountDownLatch to use in {@link #hello(String)}. @@ -149,20 +149,20 @@ private static class SimpleImpl implements Simple { public SimpleImpl(final CountDownLatch waitLatch) { this.waitLatch = waitLatch; } - + @Override public int add(int arg1, int arg2) throws AvroRemoteException { // Step 1: return arg1 + arg2; } - + @Override public String hello(String greeting) throws AvroRemoteException { if (greeting.equals("wait")) { try { // Step 3a: waitLatch.countDown(); - + // Step 3b: ackLatch.await(); } catch (InterruptedException e) { @@ -172,15 +172,15 @@ public String hello(String greeting) throws AvroRemoteException { } return greeting; } - + @Override public void ack() { // Step 2b: ackLatch.countDown(); } - + // All RPCs below this line are irrelevant to this test: - + @Override public TestRecord echo(TestRecord record) throws AvroRemoteException { return record; diff --git a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerWithCallbacks.java b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerWithCallbacks.java index 78816c012ad..3a9e158682b 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerWithCallbacks.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerWithCallbacks.java @@ -52,17 +52,17 @@ public class TestNettyServerWithCallbacks { private static Transceiver transceiver; private static Simple.Callback simpleClient; private static final AtomicBoolean ackFlag = new AtomicBoolean(false); - private static final AtomicReference ackLatch = + private static final AtomicReference ackLatch = new AtomicReference(new CountDownLatch(1)); private static Simple simpleService = new SimpleImpl(ackFlag); - + @BeforeClass public static void initializeConnections() throws Exception { // start server Responder responder = new SpecificResponder(Simple.class, simpleService); server = new NettyServer(responder, new InetSocketAddress(0)); server.start(); - + int serverPort = server.getPort(); System.out.println("server port : " + serverPort); @@ -70,7 +70,7 @@ public static void initializeConnections() throws Exception { serverPort), TestNettyServer.CONNECT_TIMEOUT_MILLIS); simpleClient = SpecificRequestor.getClient(Simple.Callback.class, transceiver); } - + @AfterClass public static void tearDownConnections() throws Exception { if (transceiver != null) { @@ -80,18 +80,18 @@ public static void tearDownConnections() throws Exception { server.close(); } } - + @Test public void greeting() throws Exception { // Test synchronous RPC: Assert.assertEquals("Hello, how are you?", simpleClient.hello("how are you?")); - + // Test asynchronous RPC (future): CallFuture future1 = new CallFuture(); simpleClient.hello("World!", future1); Assert.assertEquals("Hello, World!", future1.get(2, TimeUnit.SECONDS)); Assert.assertNull(future1.getError()); - + // Test asynchronous RPC (callback): final CallFuture future2 = new CallFuture(); simpleClient.hello("what's up?", new Callback() { @@ -107,7 +107,7 @@ public void handleError(Throwable error) { Assert.assertEquals("Hello, what's up?", future2.get(2, TimeUnit.SECONDS)); Assert.assertNull(future2.getError()); } - + @Test public void echo() throws Exception { TestRecord record = TestRecord.newBuilder().setHash( @@ -115,16 +115,16 @@ public void echo() throws Exception { new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8 })). setKind(org.apache.avro.test.Kind.FOO). setName("My Record").build(); - + // Test synchronous RPC: Assert.assertEquals(record, simpleClient.echo(record)); - + // Test asynchronous RPC (future): CallFuture future1 = new CallFuture(); simpleClient.echo(record, future1); Assert.assertEquals(record, future1.get(2, TimeUnit.SECONDS)); Assert.assertNull(future1.getError()); - + // Test asynchronous RPC (callback): final CallFuture future2 = new CallFuture(); simpleClient.echo(record, new Callback() { @@ -140,18 +140,18 @@ public void handleError(Throwable error) { Assert.assertEquals(record, future2.get(2, TimeUnit.SECONDS)); Assert.assertNull(future2.getError()); } - + @Test public void add() throws Exception { // Test synchronous RPC: Assert.assertEquals(8, simpleClient.add(2, 6)); - + // Test asynchronous RPC (future): CallFuture future1 = new CallFuture(); simpleClient.add(8, 8, future1); Assert.assertEquals(new Integer(16), future1.get(2, TimeUnit.SECONDS)); Assert.assertNull(future1.getError()); - + // Test asynchronous RPC (callback): final CallFuture future2 = new CallFuture(); simpleClient.add(512, 256, new Callback() { @@ -167,20 +167,20 @@ public void handleError(Throwable error) { Assert.assertEquals(new Integer(768), future2.get(2, TimeUnit.SECONDS)); Assert.assertNull(future2.getError()); } - + @Test public void echoBytes() throws Exception { ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 }); - + // Test synchronous RPC: Assert.assertEquals(byteBuffer, simpleClient.echoBytes(byteBuffer)); - + // Test asynchronous RPC (future): CallFuture future1 = new CallFuture(); simpleClient.echoBytes(byteBuffer, future1); Assert.assertEquals(byteBuffer, future1.get(2, TimeUnit.SECONDS)); Assert.assertNull(future1.getError()); - + // Test asynchronous RPC (callback): final CallFuture future2 = new CallFuture(); simpleClient.echoBytes(byteBuffer, new Callback() { @@ -196,7 +196,7 @@ public void handleError(Throwable error) { Assert.assertEquals(byteBuffer, future2.get(2, TimeUnit.SECONDS)); Assert.assertNull(future2.getError()); } - + @Test() public void error() throws IOException, InterruptedException, TimeoutException { // Test synchronous RPC: @@ -209,7 +209,7 @@ public void error() throws IOException, InterruptedException, TimeoutException { e.printStackTrace(); Assert.fail("Unexpected error: " + e.toString()); } - + // Test asynchronous RPC (future): CallFuture future = new CallFuture(); simpleClient.error(future); @@ -217,14 +217,14 @@ public void error() throws IOException, InterruptedException, TimeoutException { future.get(2, TimeUnit.SECONDS); Assert.fail("Expected " + TestError.class.getCanonicalName() + " to be thrown"); } catch (ExecutionException e) { - Assert.assertTrue("Expected " + TestError.class.getCanonicalName(), + Assert.assertTrue("Expected " + TestError.class.getCanonicalName(), e.getCause() instanceof TestError); } Assert.assertNotNull(future.getError()); - Assert.assertTrue("Expected " + TestError.class.getCanonicalName(), + Assert.assertTrue("Expected " + TestError.class.getCanonicalName(), future.getError() instanceof TestError); Assert.assertNull(future.getResult()); - + // Test asynchronous RPC (callback): final CountDownLatch latch = new CountDownLatch(1); final AtomicReference errorRef = new AtomicReference(); @@ -243,24 +243,24 @@ public void handleError(Throwable error) { Assert.assertNotNull(errorRef.get()); Assert.assertTrue(errorRef.get() instanceof TestError); } - + @Test public void ack() throws Exception { simpleClient.ack(); ackLatch.get().await(2, TimeUnit.SECONDS); Assert.assertTrue("Expected ack flag to be set", ackFlag.get()); - + ackLatch.set(new CountDownLatch(1)); simpleClient.ack(); ackLatch.get().await(2, TimeUnit.SECONDS); Assert.assertFalse("Expected ack flag to be cleared", ackFlag.get()); } - + @Test public void testSendAfterChannelClose() throws Exception { - // Start up a second server so that closing the server doesn't + // Start up a second server so that closing the server doesn't // interfere with the other unit tests: - Server server2 = new NettyServer(new SpecificResponder(Simple.class, simpleService), + Server server2 = new NettyServer(new SpecificResponder(Simple.class, simpleService), new InetSocketAddress(0)); server2.start(); try { @@ -270,12 +270,12 @@ public void testSendAfterChannelClose() throws Exception { Transceiver transceiver2 = new NettyTransceiver(new InetSocketAddress( serverPort), TestNettyServer.CONNECT_TIMEOUT_MILLIS); try { - Simple.Callback simpleClient2 = + Simple.Callback simpleClient2 = SpecificRequestor.getClient(Simple.Callback.class, transceiver2); // Verify that connection works: Assert.assertEquals(3, simpleClient2.add(1, 2)); - + // Try again with callbacks: CallFuture addFuture = new CallFuture(); simpleClient2.add(1, 2, addFuture); @@ -285,7 +285,7 @@ public void testSendAfterChannelClose() throws Exception { server2.close(); Thread.sleep(1000L); - // Send a new RPC, and verify that it throws an Exception that + // Send a new RPC, and verify that it throws an Exception that // can be detected by the client: boolean ioeCaught = false; try { @@ -299,8 +299,8 @@ public void testSendAfterChannelClose() throws Exception { throw e; } Assert.assertTrue("Expected IOException", ioeCaught); - - // Send a new RPC with callback, and verify that the correct Exception + + // Send a new RPC with callback, and verify that the correct Exception // is thrown: ioeCaught = false; try { @@ -322,13 +322,13 @@ public void testSendAfterChannelClose() throws Exception { server2.close(); } } - + @Test public void cancelPendingRequestsOnTransceiverClose() throws Exception { - // Start up a second server so that closing the server doesn't + // Start up a second server so that closing the server doesn't // interfere with the other unit tests: BlockingSimpleImpl blockingSimpleImpl = new BlockingSimpleImpl(); - Server server2 = new NettyServer(new SpecificResponder(Simple.class, + Server server2 = new NettyServer(new SpecificResponder(Simple.class, blockingSimpleImpl), new InetSocketAddress(0)); server2.start(); try { @@ -338,18 +338,18 @@ public void cancelPendingRequestsOnTransceiverClose() throws Exception { CallFuture addFuture = new CallFuture(); Transceiver transceiver2 = new NettyTransceiver(new InetSocketAddress( serverPort), TestNettyServer.CONNECT_TIMEOUT_MILLIS); - try { - Simple.Callback simpleClient2 = + try { + Simple.Callback simpleClient2 = SpecificRequestor.getClient(Simple.Callback.class, transceiver2); - + // The first call has to block for the handshake: Assert.assertEquals(3, simpleClient2.add(1, 2)); - + // Now acquire the semaphore so that the server will block: blockingSimpleImpl.acquireRunPermit(); simpleClient2.add(1, 2, addFuture); } finally { - // When the transceiver is closed, the CallFuture should get + // When the transceiver is closed, the CallFuture should get // an IOException transceiver2.close(); } @@ -369,7 +369,7 @@ public void cancelPendingRequestsOnTransceiverClose() throws Exception { server2.close(); } } - + @Test public void cancelPendingRequestsAfterChannelCloseByServerShutdown() throws Exception { // The purpose of this test is to verify that a client doesn't stay @@ -415,25 +415,25 @@ public void run() { } } }); - + // Start client call t.start(); - + // Wait until method is entered on the server side blockingSimpleImpl.acquireEnterPermit(); - + // The server side method is now blocked waiting on the run permit // (= is busy handling the request) - + // Stop the server server2.close(); - + // With the server gone, we expect the client to get some exception and exit // Wait for client thread to exit t.join(10000); - + Assert.assertFalse("Client request should not be blocked on server shutdown", t.isAlive()); - + } finally { blockingSimpleImpl.releaseRunPermit(); server2.close(); @@ -441,15 +441,15 @@ public void run() { transceiver2.close(); } } - + @Test public void clientReconnectAfterServerRestart() throws Exception { - // Start up a second server so that closing the server doesn't + // Start up a second server so that closing the server doesn't // interfere with the other unit tests: SimpleImpl simpleImpl = new BlockingSimpleImpl(); - Server server2 = new NettyServer(new SpecificResponder(Simple.class, + Server server2 = new NettyServer(new SpecificResponder(Simple.class, simpleImpl), new InetSocketAddress(0)); - try { + try { server2.start(); int serverPort = server2.getPort(); System.out.println("server2 port : " + serverPort); @@ -457,10 +457,10 @@ public void clientReconnectAfterServerRestart() throws Exception { // Initialize a client, and establish a connection to the server: Transceiver transceiver2 = new NettyTransceiver(new InetSocketAddress( serverPort), TestNettyServer.CONNECT_TIMEOUT_MILLIS); - Simple.Callback simpleClient2 = + Simple.Callback simpleClient2 = SpecificRequestor.getClient(Simple.Callback.class, transceiver2); Assert.assertEquals(3, simpleClient2.add(1, 2)); - + // Restart the server: server2.close(); try { @@ -471,11 +471,11 @@ public void clientReconnectAfterServerRestart() throws Exception { // Expected since server is no longer running } Thread.sleep(2000L); - server2 = new NettyServer(new SpecificResponder(Simple.class, + server2 = new NettyServer(new SpecificResponder(Simple.class, simpleImpl), new InetSocketAddress(serverPort)); server2.start(); - - // Invoke an RPC using the same client, which should reestablish the + + // Invoke an RPC using the same client, which should reestablish the // connection to the server: Assert.assertEquals(3, simpleClient2.add(1, 2)); } finally { @@ -489,7 +489,7 @@ public void performanceTest() throws Exception { final int threadCount = 8; final long runTimeMillis = 10 * 1000L; ExecutorService threadPool = Executors.newFixedThreadPool(threadCount); - + System.out.println("Running performance test for " + runTimeMillis + "ms..."); final AtomicLong rpcCount = new AtomicLong(0L); final AtomicBoolean runFlag = new AtomicBoolean(true); @@ -511,23 +511,23 @@ public void run() { } }); } - + startLatch.await(2, TimeUnit.SECONDS); Thread.sleep(runTimeMillis); runFlag.set(false); threadPool.shutdown(); Assert.assertTrue("Timed out shutting down thread pool", threadPool.awaitTermination(2, TimeUnit.SECONDS)); - System.out.println("Completed " + rpcCount.get() + " RPCs in " + runTimeMillis + - "ms => " + (((double)rpcCount.get() / (double)runTimeMillis) * 1000) + " RPCs/sec, " + + System.out.println("Completed " + rpcCount.get() + " RPCs in " + runTimeMillis + + "ms => " + (((double)rpcCount.get() / (double)runTimeMillis) * 1000) + " RPCs/sec, " + ((double)runTimeMillis / (double)rpcCount.get()) + " ms/RPC."); } - + /** * Implementation of the Simple interface. */ private static class SimpleImpl implements Simple { private final AtomicBoolean ackFlag; - + /** * Creates a SimpleImpl. * @param ackFlag the AtomicBoolean to toggle when ack() is called. @@ -535,7 +535,7 @@ private static class SimpleImpl implements Simple { public SimpleImpl(final AtomicBoolean ackFlag) { this.ackFlag = ackFlag; } - + @Override public String hello(String greeting) throws AvroRemoteException { return "Hello, " + greeting; @@ -567,7 +567,7 @@ synchronized public void ack() { ackLatch.get().countDown(); } } - + /** * A SimpleImpl that requires a semaphore permit before executing any method. */ @@ -576,14 +576,14 @@ private static class BlockingSimpleImpl extends SimpleImpl { private final Semaphore enterSemaphore = new Semaphore(1); /** Semaphore that must be acquired for the method to run and exit. */ private final Semaphore runSemaphore = new Semaphore(1); - + /** * Creates a BlockingSimpleImpl. */ public BlockingSimpleImpl() { super(new AtomicBoolean()); } - + @Override public String hello(String greeting) throws AvroRemoteException { releaseEnterPermit(); @@ -649,7 +649,7 @@ public void ack() { releaseRunPermit(); } } - + /** * Acquires a single permit from the semaphore. */ @@ -661,7 +661,7 @@ public void acquireRunPermit() { throw new RuntimeException(e); } } - + /** * Releases a single permit to the semaphore. */ diff --git a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerWithCompression.java b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerWithCompression.java index 98dc9e6cc11..d805443ea62 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerWithCompression.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerWithCompression.java @@ -60,7 +60,7 @@ protected static Server initializeServer(Responder responder) { channelFactory, new CompressionChannelPipelineFactory(), null); } - + protected static Transceiver initializeTransceiver(int serverPort) throws IOException { return new NettyTransceiver(new InetSocketAddress(serverPort), new CompressionChannelFactory(), diff --git a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerWithSSL.java b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerWithSSL.java index 1611c0123ac..a7f8e6a37ac 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerWithSSL.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerWithSSL.java @@ -42,7 +42,7 @@ public class TestNettyServerWithSSL extends TestNettyServer{ public static final String TEST_CERTIFICATE = "servercert.p12"; public static final String TEST_CERTIFICATE_PASSWORD = "s3cret"; - + protected static Server initializeServer(Responder responder) { ChannelFactory channelFactory = new NioServerSocketChannelFactory( Executors.newCachedThreadPool(), @@ -52,7 +52,7 @@ protected static Server initializeServer(Responder responder) { channelFactory, new SSLChannelPipelineFactory(), null); } - + protected static Transceiver initializeTransceiver(int serverPort) throws IOException { return new NettyTransceiver(new InetSocketAddress(serverPort), new SSLChannelFactory(), diff --git a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestRpcPluginOrdering.java b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestRpcPluginOrdering.java index d816fa5dd9a..02bc63ddf0a 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestRpcPluginOrdering.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestRpcPluginOrdering.java @@ -35,17 +35,17 @@ public class TestRpcPluginOrdering { private static AtomicInteger orderCounter = new AtomicInteger(); - + public class OrderPlugin extends RPCPlugin{ public void clientStartConnect(RPCContext context) { assertEquals(0, orderCounter.getAndIncrement()); } - + public void clientSendRequest(RPCContext context) { assertEquals(1, orderCounter.getAndIncrement()); } - + public void clientReceiveResponse(RPCContext context) { assertEquals(6, orderCounter.getAndIncrement()); } @@ -66,16 +66,16 @@ public void serverSendResponse(RPCContext context) { assertEquals(4, orderCounter.getAndIncrement()); } } - + @Test public void testRpcPluginOrdering() throws Exception { OrderPlugin plugin = new OrderPlugin(); - + SpecificResponder responder = new SpecificResponder(Mail.class, new TestMailImpl()); SpecificRequestor requestor = new SpecificRequestor(Mail.class, new LocalTransceiver(responder)); responder.addRPCPlugin(plugin); requestor.addRPCPlugin(plugin); - + Mail client = SpecificRequestor.getClient(Mail.class, requestor); Message message = createTestMessage(); client.send(message); @@ -89,7 +89,7 @@ private Message createTestMessage() { build(); return message; } - + private static class TestMailImpl implements Mail{ public String send(Message message) throws AvroRemoteException { return "Received"; diff --git a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestSaslAnonymous.java b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestSaslAnonymous.java index 68b40bf253c..2034e058fa3 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestSaslAnonymous.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestSaslAnonymous.java @@ -66,9 +66,9 @@ public void test64kRequest() throws Exception { new SaslSocketTransceiver(new InetSocketAddress(s.getPort())); ProtoInterface proxy = (ProtoInterface)ReflectRequestor.getClient(ProtoInterface.class, client); - + byte[] result = proxy.test(new byte[64*1024]); - + client.close(); s.close(); } diff --git a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestSaslDigestMd5.java b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestSaslDigestMd5.java index cef4f77a2cd..34651eb87a1 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestSaslDigestMd5.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestSaslDigestMd5.java @@ -115,7 +115,7 @@ public void testAnonymousClient() throws Exception { Transceiver c = new SaslSocketTransceiver(new InetSocketAddress(s.getPort())); GenericRequestor requestor = new GenericRequestor(PROTOCOL, c); - GenericRecord params = + GenericRecord params = new GenericData.Record(PROTOCOL.getMessages().get("hello").getRequest()); params.put("greeting", "bob"); Utf8 response = (Utf8)requestor.request("hello", params); @@ -157,7 +157,7 @@ public void testWrongPassword() throws Exception { Transceiver c = new SaslSocketTransceiver (new InetSocketAddress(server.getPort()), saslClient); GenericRequestor requestor = new GenericRequestor(PROTOCOL, c); - GenericRecord params = + GenericRecord params = new GenericData.Record(PROTOCOL.getMessages().get("hello").getRequest()); params.put("greeting", "bob"); Utf8 response = (Utf8)requestor.request("hello", params); diff --git a/lang/java/ipc/src/test/java/org/apache/avro/ipc/stats/TestHistogram.java b/lang/java/ipc/src/test/java/org/apache/avro/ipc/stats/TestHistogram.java index 0bdd7005f0f..9ab6eb78c15 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/ipc/stats/TestHistogram.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/ipc/stats/TestHistogram.java @@ -47,10 +47,10 @@ public void testBasicOperation() { assertArrayEquals(new int[] { 1, 1, 2, 4, 8, 4 }, h.getHistogram()); assertEquals("[0,1)=1;[1,2)=1;[2,4)=2;[4,8)=4;[8,16)=8;[16,infinity)=4", h.toString()); - + String[] correctBucketLabels = { "[0,1)", "[1,2)", "[2,4)", "[4,8)", "[8,16)", "[16,infinity)"}; - + // test bucket iterator int pos = 0; Iterator it = h.getSegmenter().getBuckets(); @@ -59,7 +59,7 @@ public void testBasicOperation() { pos = pos + 1; } assertEquals(correctBucketLabels.length, pos); - + List labels = h.getSegmenter().getBucketLabels(); assertEquals(correctBucketLabels.length, labels.size()); if (labels.size() == correctBucketLabels.length) { @@ -71,14 +71,14 @@ public void testBasicOperation() { String[] correctBoundryLabels = { "0", "1", "2", "4", "8", "16"}; List boundryLabels = h.getSegmenter().getBoundaryLabels(); - + assertEquals(correctBoundryLabels.length, boundryLabels.size()); if (boundryLabels.size() == correctBoundryLabels.length) { for (int i = 0; i < boundryLabels.size(); i++) { assertEquals(correctBoundryLabels[i], boundryLabels.get(i)); } } - + List> entries = new ArrayList>(); for (Entry entry : h.entries()) { entries.add(entry); @@ -86,13 +86,13 @@ public void testBasicOperation() { assertEquals("[0,1)", entries.get(0).bucket); assertEquals(4, entries.get(5).count); assertEquals(6, entries.size()); - + h.add(1010); h.add(9191); List recent = h.getRecentAdditions(); assertTrue(recent.contains(1010)); assertTrue(recent.contains(9191)); - + } @Test(expected=Histogram.SegmenterException.class) @@ -110,11 +110,11 @@ static class SingleBucketSegmenter implements Segmenter{ public Iterator getBuckets() { return Arrays.asList("X").iterator(); } - + public List getBoundaryLabels() { return Arrays.asList("X"); } - + public List getBucketLabels() { return Arrays.asList("X"); } diff --git a/lang/java/ipc/src/test/java/org/apache/avro/ipc/stats/TestStatsPluginAndServlet.java b/lang/java/ipc/src/test/java/org/apache/avro/ipc/stats/TestStatsPluginAndServlet.java index eb234a5aa09..c0f9664161e 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/ipc/stats/TestStatsPluginAndServlet.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/ipc/stats/TestStatsPluginAndServlet.java @@ -138,12 +138,12 @@ public void testPayloadSize() throws IOException { r.addRPCPlugin(statsPlugin); Transceiver t = new LocalTransceiver(r); makeRequest(t); - + String resp = generateServletResponse(statsPlugin); assertTrue(resp.contains("Average: 2.0")); - + } - + private RPCContext makeContext() { RPCContext context = new RPCContext(); context.setMessage(message); @@ -197,10 +197,10 @@ public static void main(String[] args) throws Exception { avroServer.start(); StatsServer ss = new StatsServer(p, 8080); - + HttpTransceiver trans = new HttpTransceiver( new URL("http://localhost:" + Integer.parseInt(args[0]))); - GenericRequestor req = new GenericRequestor(protocol, trans); + GenericRequestor req = new GenericRequestor(protocol, trans); while(true) { Thread.sleep(1000); diff --git a/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificData.java b/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificData.java index 1a05a398335..45185833dc1 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificData.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificData.java @@ -49,7 +49,7 @@ import org.apache.avro.generic.GenericRecord; public class TestSpecificData { - + @Test /** Make sure that even with nulls, hashCode() doesn't throw NPE. */ public void testHashCode() { diff --git a/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificDatumReader.java b/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificDatumReader.java index 4b73de7dc27..5b6cca3511a 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificDatumReader.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificDatumReader.java @@ -40,7 +40,7 @@ public class TestSpecificDatumReader { public static byte[] serializeRecord(FooBarSpecificRecord fooBarSpecificRecord) throws IOException { - SpecificDatumWriter datumWriter = + SpecificDatumWriter datumWriter = new SpecificDatumWriter(FooBarSpecificRecord.SCHEMA$); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); Encoder encoder = EncoderFactory.get().binaryEncoder(byteArrayOutputStream, null); @@ -67,14 +67,14 @@ public void testRead() throws IOException { newBuilder.setNicknames(Arrays.asList("bar")); newBuilder.setRelatedids(Arrays.asList(1,2,3)); FooBarSpecificRecord specificRecord = newBuilder.build(); - + byte[] recordBytes = serializeRecord(specificRecord); - + Decoder decoder = DecoderFactory.get().binaryDecoder(recordBytes, null); SpecificDatumReader specificDatumReader = new SpecificDatumReader(FooBarSpecificRecord.SCHEMA$); FooBarSpecificRecord deserialized = new FooBarSpecificRecord(); specificDatumReader.read(deserialized, decoder); - + assertEquals(specificRecord, deserialized); } diff --git a/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificErrorBuilder.java b/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificErrorBuilder.java index 598a22a54a4..1de88052f53 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificErrorBuilder.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificErrorBuilder.java @@ -30,7 +30,7 @@ public void testSpecificErrorBuilder() { TestError.Builder testErrorBuilder = TestError.newBuilder(). setValue("value").setCause(new NullPointerException()). setMessage$("message$"); - + // Test has methods Assert.assertTrue(testErrorBuilder.hasValue()); Assert.assertNotNull(testErrorBuilder.getValue()); @@ -38,23 +38,23 @@ public void testSpecificErrorBuilder() { Assert.assertNotNull(testErrorBuilder.getCause()); Assert.assertTrue(testErrorBuilder.hasMessage$()); Assert.assertNotNull(testErrorBuilder.getMessage$()); - + TestError testError = testErrorBuilder.build(); Assert.assertEquals("value", testError.getValue()); Assert.assertEquals("value", testError.getMessage()); Assert.assertEquals("message$", testError.getMessage$()); - + // Test copy constructor - Assert.assertEquals(testErrorBuilder, + Assert.assertEquals(testErrorBuilder, TestError.newBuilder(testErrorBuilder)); Assert.assertEquals(testErrorBuilder, TestError.newBuilder(testError)); - + TestError error = new TestError("value", new NullPointerException()); error.setMessage$("message"); Assert.assertEquals(error, TestError.newBuilder().setValue("value"). setCause(new NullPointerException()).setMessage$("message").build()); - + // Test clear testErrorBuilder.clearValue(); Assert.assertFalse(testErrorBuilder.hasValue()); @@ -66,7 +66,7 @@ public void testSpecificErrorBuilder() { Assert.assertFalse(testErrorBuilder.hasMessage$()); Assert.assertNull(testErrorBuilder.getMessage$()); } - + @Test(expected=org.apache.avro.AvroRuntimeException.class) public void attemptToSetNonNullableFieldToNull() { TestError.newBuilder().setMessage$(null); diff --git a/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificRecordBuilder.java b/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificRecordBuilder.java index a94b4980bcb..73057571f31 100644 --- a/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificRecordBuilder.java +++ b/lang/java/ipc/src/test/java/org/apache/avro/specific/TestSpecificRecordBuilder.java @@ -57,7 +57,7 @@ public void testSpecificBuilder() { Assert.assertNull(builder.getFriends()); Assert.assertFalse(builder.hasLanguages()); Assert.assertNull(builder.getLanguages()); - + Person person = builder.build(); Assert.assertEquals("James Gosling", person.getName().toString()); Assert.assertEquals(new Integer(1955), person.getYearOfBirth()); @@ -69,11 +69,11 @@ public void testSpecificBuilder() { Assert.assertEquals(2, person.getLanguages().size()); Assert.assertEquals("English", person.getLanguages().get(0).toString()); Assert.assertEquals("Java", person.getLanguages().get(1).toString()); - + // Test copy constructors: Assert.assertEquals(builder, Person.newBuilder(builder)); Assert.assertEquals(person, Person.newBuilder(person).build()); - + Person.Builder builderCopy = Person.newBuilder(person); Assert.assertEquals("James Gosling", builderCopy.getName().toString()); Assert.assertEquals(new Integer(1955), builderCopy.getYearOfBirth()); @@ -81,7 +81,7 @@ public void testSpecificBuilder() { Assert.assertEquals("CA", builderCopy.getState().toString()); Assert.assertNotNull(builderCopy.getFriends()); // friends should default to an empty list Assert.assertEquals(0, builderCopy.getFriends().size()); - + // Test clearing fields: builderCopy.clearFriends().clearCountry(); Assert.assertFalse(builderCopy.hasFriends()); @@ -92,7 +92,7 @@ public void testSpecificBuilder() { Assert.assertNotNull(person2.getFriends()); Assert.assertTrue(person2.getFriends().isEmpty()); } - + @Test public void testUnions() { long datetime = 1234L; @@ -106,15 +106,15 @@ public void testUnions() { Assert.assertEquals(datetime, p.getDatetime().longValue()); Assert.assertEquals(ProductPage.class, p.getPageContext().getClass()); Assert.assertEquals(product, ((ProductPage)p.getPageContext()).getProduct()); - + PageView p2 = PageView.newBuilder(p).build(); - + Assert.assertEquals(datetime, p2.getDatetime().longValue()); Assert.assertEquals(ProductPage.class, p2.getPageContext().getClass()); Assert.assertEquals(product, ((ProductPage)p2.getPageContext()).getProduct()); - + Assert.assertEquals(p, p2); - + } @Test @@ -136,7 +136,7 @@ public void testInterop() { .setStringField("MyInterop") .setUnionField(2.71828) .build(); - + Interop copy = Interop.newBuilder(interop).build(); Assert.assertEquals(interop.getArrayField().size(), copy.getArrayField().size()); Assert.assertEquals(interop.getArrayField(), copy.getArrayField()); @@ -154,7 +154,7 @@ public void testInterop() { Assert.assertEquals(interop.getUnionField(), copy.getUnionField()); Assert.assertEquals(interop, copy); } - + @Test(expected=org.apache.avro.AvroRuntimeException.class) public void attemptToSetNonNullableFieldToNull() { Person.newBuilder().setName(null); @@ -202,11 +202,11 @@ public void testBuilderPerformance() { } long durationNanos = System.nanoTime() - startTimeNanos; double durationMillis = durationNanos / 1e6d; - System.out.println("Built " + count + " records in " + durationMillis + "ms (" + - (count / (durationMillis / 1000d)) + " records/sec, " + (durationMillis / count) + + System.out.println("Built " + count + " records in " + durationMillis + "ms (" + + (count / (durationMillis / 1000d)) + " records/sec, " + (durationMillis / count) + "ms/record"); } - + @Ignore @Test public void testBuilderPerformanceWithDefaultValues() { @@ -217,8 +217,8 @@ public void testBuilderPerformanceWithDefaultValues() { } long durationNanos = System.nanoTime() - startTimeNanos; double durationMillis = durationNanos / 1e6d; - System.out.println("Built " + count + " records in " + durationMillis + "ms (" + - (count / (durationMillis / 1000d)) + " records/sec, " + (durationMillis / count) + + System.out.println("Built " + count + " records in " + durationMillis + "ms (" + + (count / (durationMillis / 1000d)) + " records/sec, " + (durationMillis / count) + "ms/record"); } @@ -241,8 +241,8 @@ public void testManualBuildPerformance() { } long durationNanos = System.nanoTime() - startTimeNanos; double durationMillis = durationNanos / 1e6d; - System.out.println("Built " + count + " records in " + durationMillis + "ms (" + - (count / (durationMillis / 1000d)) + " records/sec, " + (durationMillis / count) + + System.out.println("Built " + count + " records in " + durationMillis + "ms (" + + (count / (durationMillis / 1000d)) + " records/sec, " + (durationMillis / count) + "ms/record"); } } diff --git a/lang/java/mapred/pom.xml b/lang/java/mapred/pom.xml index e4a2dd5e76e..914560a7884 100644 --- a/lang/java/mapred/pom.xml +++ b/lang/java/mapred/pom.xml @@ -159,7 +159,7 @@ test-jar test - + org.easymock easymock test @@ -184,7 +184,7 @@ ${commons-codec.version} - + hadoop1 diff --git a/lang/java/mapred/src/main/java/org/apache/avro/hadoop/file/HadoopCodecFactory.java b/lang/java/mapred/src/main/java/org/apache/avro/hadoop/file/HadoopCodecFactory.java index 181020873b3..9927ef966c7 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/hadoop/file/HadoopCodecFactory.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/hadoop/file/HadoopCodecFactory.java @@ -23,7 +23,7 @@ import org.apache.avro.AvroRuntimeException; import org.apache.avro.file.CodecFactory; -/** +/** * Encapsulates the ability to specify and configure an avro compression codec * from a given hadoop codec defined with the configuration parameter: * mapred.output.compression.codec @@ -40,14 +40,14 @@ public class HadoopCodecFactory { private static final Map HADOOP_AVRO_NAME_MAP = new HashMap(); - + static { HADOOP_AVRO_NAME_MAP.put("org.apache.hadoop.io.compress.DeflateCodec", "deflate"); HADOOP_AVRO_NAME_MAP.put("org.apache.hadoop.io.compress.SnappyCodec", "snappy"); HADOOP_AVRO_NAME_MAP.put("org.apache.hadoop.io.compress.BZip2Codec", "bzip2"); HADOOP_AVRO_NAME_MAP.put("org.apache.hadoop.io.compress.GZipCodec", "deflate"); } - + /** Maps a hadoop codec name into a CodecFactory. * * Currently there are four hadoop codecs registered: @@ -71,7 +71,7 @@ public static CodecFactory fromHadoopString(String hadoopCodecClass) { } return o; } - + public static String getAvroCodecName(String hadoopCodecClass) { return HADOOP_AVRO_NAME_MAP.get(hadoopCodecClass); } diff --git a/lang/java/mapred/src/main/java/org/apache/avro/hadoop/file/SortedKeyValueFile.java b/lang/java/mapred/src/main/java/org/apache/avro/hadoop/file/SortedKeyValueFile.java index f7a41bf421a..6b07220f2b0 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/hadoop/file/SortedKeyValueFile.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/hadoop/file/SortedKeyValueFile.java @@ -226,7 +226,7 @@ public Reader(Options options) throws IOException { mDataFileReader = new DataFileReader (new FsInput(dataFilePath, options.getConfiguration()), datumReader); - + } /** diff --git a/lang/java/mapred/src/main/java/org/apache/avro/hadoop/io/AvroSequenceFile.java b/lang/java/mapred/src/main/java/org/apache/avro/hadoop/io/AvroSequenceFile.java index 73ab045c68e..fd0fd8f2f50 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/hadoop/io/AvroSequenceFile.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/hadoop/io/AvroSequenceFile.java @@ -96,7 +96,7 @@ public static SequenceFile.Writer createWriter(Writer.Options options) throws IO options.getFileSystem(), options.getConfigurationWithAvroSerialization(), options.getOutputPath(), options.getKeyClass(), options.getValueClass(), options.getBufferSizeBytes(), options.getReplicationFactor(), - options.getBlockSizeBytes(), + options.getBlockSizeBytes(), options.getCompressionType(), options.getCompressionCodec(), options.getProgressable(), options.getMetadataWithAvroSchemas()); } diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroAsTextInputFormat.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroAsTextInputFormat.java index ca7dab8a318..d0da121187b 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroAsTextInputFormat.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroAsTextInputFormat.java @@ -39,7 +39,7 @@ *

      * This {@link org.apache.hadoop.mapred.InputFormat} is useful for applications * that wish to process Avro data using tools like MapReduce Streaming. - * + * * By default, when pointed at a directory, this will silently skip over any * files in it that do not have .avro extension. To instead include all files, * set the avro.mapred.ignore.inputs.without.extension property to false. @@ -59,7 +59,7 @@ protected FileStatus[] listStatus(JobConf job) throws IOException { return super.listStatus(job); } } - + @Override public RecordReader getRecordReader(InputSplit split, JobConf job, Reporter reporter) diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroAsTextRecordReader.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroAsTextRecordReader.java index 517b472aad0..2ed2a612377 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroAsTextRecordReader.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroAsTextRecordReader.java @@ -54,11 +54,11 @@ protected AvroAsTextRecordReader(FileReader reader, FileSplit split) public Text createKey() { return new Text(); } - + public Text createValue() { return new Text(); } - + public boolean next(Text key, Text ignore) throws IOException { if (!reader.hasNext() || reader.pastSync(end)) return false; @@ -80,7 +80,7 @@ public boolean next(Text key, Text ignore) throws IOException { } return true; } - + public float getProgress() throws IOException { if (end == start) { return 0.0f; @@ -88,12 +88,12 @@ public float getProgress() throws IOException { return Math.min(1.0f, (getPos() - start) / (float)(end - start)); } } - + public long getPos() throws IOException { return reader.tell(); } public void close() throws IOException { reader.close(); } - + } diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroInputFormat.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroInputFormat.java index 252339a1553..5d8bad05753 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroInputFormat.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroInputFormat.java @@ -33,7 +33,7 @@ /** * An {@link org.apache.hadoop.mapred.InputFormat} for Avro data files. - * + * * By default, when pointed at a directory, this will silently skip over any * files in it that do not have .avro extension. To instead include all files, * set the avro.mapred.ignore.inputs.without.extension property to false. @@ -44,11 +44,11 @@ public class AvroInputFormat /** Whether to silently ignore input files without the .avro extension */ public static final String IGNORE_FILES_WITHOUT_EXTENSION_KEY = "avro.mapred.ignore.inputs.without.extension"; - + /** Default of whether to silently ignore input files without the .avro * extension. */ public static final boolean IGNORE_INPUTS_WITHOUT_EXTENSION_DEFAULT = true; - + @Override protected FileStatus[] listStatus(JobConf job) throws IOException { if (job.getBoolean(IGNORE_FILES_WITHOUT_EXTENSION_KEY, diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroJob.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroJob.java index 21f130c8d9d..4e2a3c91329 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroJob.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroJob.java @@ -127,12 +127,12 @@ public static void setReflect(JobConf job) { setInputReflect(job); setMapOutputReflect(job); } - + /** Indicate that a job's input data should use reflect representation.*/ public static void setInputReflect(JobConf job) { job.setBoolean(INPUT_IS_REFLECT, true); } - + /** Indicate that a job's map output data should use reflect representation.*/ public static void setMapOutputReflect(JobConf job) { job.setBoolean(MAP_OUTPUT_IS_REFLECT, true); @@ -202,7 +202,7 @@ public static void setReducerClass(JobConf job, public static void setDataModelClass(JobConf job, Class modelClass) { job.setClass(CONF_DATA_MODEL, modelClass, GenericData.class); } - + /** Return the job's data model implementation class. */ public static Class getDataModelClass(Configuration conf) { return (Class) conf.getClass( diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroMultipleOutputs.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroMultipleOutputs.java index a1b4a1c5f79..5ae03e37a9f 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroMultipleOutputs.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroMultipleOutputs.java @@ -42,10 +42,10 @@ /** - * The AvroMultipleOutputs class simplifies writing Avro output data + * The AvroMultipleOutputs class simplifies writing Avro output data * to multiple outputs - * - *

      + * + *

      * Case one: writing to additional outputs other than the job default output. * * Each additional output, or named output, may be configured with its own @@ -57,16 +57,16 @@ *

      * Case two: to write data to different files provided by user *

      - * + * *

      - * AvroMultipleOutputs supports counters, by default they are disabled. The - * counters group is the {@link AvroMultipleOutputs} class name. The names of the - * counters are the same as the output name. These count the number of records + * AvroMultipleOutputs supports counters, by default they are disabled. The + * counters group is the {@link AvroMultipleOutputs} class name. The names of the + * counters are the same as the output name. These count the number of records * written to each output name. For multi * named outputs the name of the counter is the concatenation of the named * output, and underscore '_' and the multiname. *

      - * + * * Usage pattern for job submission: *
        *
      @@ -79,7 +79,7 @@
        * job.setReducerClass(HadoopReducer.class);
        * job.set("avro.reducer",MyAvroReducer.class);
        * ...
      - *  
      + *
        * Schema schema;
        * ...
        * // Defines additional single output 'avro1' for the job
      @@ -98,7 +98,7 @@
        * 

      * Usage in Reducer: *

      - * 
      + *
        * public class MyAvroReducer extends
        *   AvroReducer<K, V, OUT> {
        * private MultipleOutputs amos;
      @@ -140,8 +140,8 @@ public class AvroMultipleOutputs {
         private static final String MULTI = ".multi";
       
         private static final String COUNTERS_ENABLED = "mo.counters";
      - 
      - 
      +
      +
         /**
          * Counters group used by the counters of MultipleOutputs.
          */
      @@ -444,7 +444,7 @@ public void close(Reporter reporter) throws IOException {
             writer.close(reporter);
           }
         }
      -  
      +
         /**
          * Output Collector for the default schema.
          * 

      @@ -457,7 +457,7 @@ public void close(Reporter reporter) throws IOException { public void collect(String namedOutput, Reporter reporter,Object datum) throws IOException{ getCollector(namedOutput,reporter).collect(datum); } - + /** * OutputCollector with custom schema. *

      @@ -471,7 +471,7 @@ public void collect(String namedOutput, Reporter reporter,Object datum) throws I public void collect(String namedOutput, Reporter reporter, Schema schema,Object datum) throws IOException{ getCollector(namedOutput,reporter,schema).collect(datum); } - + /** * OutputCollector with custom schema and file name. *

      @@ -486,7 +486,7 @@ public void collect(String namedOutput, Reporter reporter, Schema schema,Object public void collect(String namedOutput,Reporter reporter,Schema schema,Object datum,String baseOutputPath) throws IOException{ getCollector(namedOutput,null,reporter,baseOutputPath,schema).collect(datum); } - + /** * Gets the output collector for a named output. *

      @@ -508,14 +508,14 @@ private AvroCollector getCollector(String namedOutput, Reporter reporter, Schema throws IOException{ return getCollector(namedOutput,null,reporter,namedOutput,schema); } - + /** * Gets the output collector for a named output. *

      * * @param namedOutput the named output name * @param reporter the reporter - * @param multiName the multiname + * @param multiName the multiname * @return the output collector for the given named output * @throws IOException thrown if output collector could not be created */ @@ -530,8 +530,8 @@ private AvroCollector getCollector(String namedOutput,Schema schema, Reporter re throws IOException{ //namedOutputs.add(baseFileName); return getCollector(namedOutput,null,reporter,baseFileName,schema); - } - + } + /** * Gets the output collector for a multi named output. *

      @@ -568,18 +568,18 @@ private AvroCollector getCollector(String namedOutput, String multiName, getRecordWriter(namedOutput, baseFileName, reporter,schema); return new AvroCollector() { - + @SuppressWarnings({"unchecked"}) public void collect(Object key) throws IOException{ AvroWrapper wrapper = new AvroWrapper(key); writer.write(wrapper, NullWritable.get()); } - + public void collect(Object key,Object value) throws IOException { writer.write(key,value); - } - + } + }; } @@ -597,7 +597,7 @@ public void close() throws IOException { writer.close(null); } } - + private static class InternalFileOutputFormat extends FileOutputFormat { public static final String CONFIG_NAMED_OUTPUT = "mo.config.namedOutput"; @@ -620,7 +620,7 @@ public RecordWriter getRecordWriter(FileSystem fs,JobConf job, S } OutputFormat outputFormat = outputConf.getOutputFormat(); return outputFormat.getRecordWriter(fs, outputConf, fileName, arg3); - } + } } } diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroOutputFormat.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroOutputFormat.java index 2a681cde665..235f768ef89 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroOutputFormat.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroOutputFormat.java @@ -76,16 +76,16 @@ public static void setDeflateLevel(JobConf job, int level) { public static void setSyncInterval(JobConf job, int syncIntervalInBytes) { job.setInt(SYNC_INTERVAL_KEY, syncIntervalInBytes); } - + static void configureDataFileWriter(DataFileWriter writer, JobConf job) throws UnsupportedEncodingException { - + CodecFactory factory = getCodecFactory(job); - + if (factory != null) { - writer.setCodec(factory); + writer.setCodec(factory); } - + writer.setSyncInterval(job.getInt(SYNC_INTERVAL_KEY, DEFAULT_SYNC_INTERVAL)); // copy metadata from job @@ -107,16 +107,16 @@ static void configureDataFileWriter(DataFileWriter writer, *

    15. Use avro.output.codec if populated
    16. *
    17. Next use mapred.output.compression.codec if populated
    18. *
    19. If not default to Deflate Codec
    20. - * + * */ static CodecFactory getCodecFactory(JobConf job) { CodecFactory factory = null; - + if (FileOutputFormat.getCompressOutput(job)) { int deflateLevel = job.getInt(DEFLATE_LEVEL_KEY, DEFAULT_DEFLATE_LEVEL); int xzLevel = job.getInt(XZ_LEVEL_KEY, DEFAULT_XZ_LEVEL); String codecName = job.get(AvroJob.OUTPUT_CODEC); - + if (codecName == null) { String codecClassName = job.get("mapred.output.compression.codec", null); String avroCodecName = HadoopCodecFactory.getAvroCodecName(codecClassName); @@ -127,7 +127,7 @@ static CodecFactory getCodecFactory(JobConf job) { } else { return CodecFactory.deflateCodec(deflateLevel); } - } else { + } else { if ( codecName.equals(DEFLATE_CODEC)) { factory = CodecFactory.deflateCodec(deflateLevel); } else if ( codecName.equals(XZ_CODEC)) { @@ -137,7 +137,7 @@ static CodecFactory getCodecFactory(JobConf job) { } } } - + return factory; } @@ -155,7 +155,7 @@ static CodecFactory getCodecFactory(JobConf job) { final DataFileWriter writer = new DataFileWriter(dataModel.createDatumWriter(null)); - + configureDataFileWriter(writer, job); Path path = FileOutputFormat.getTaskOutputPath(job, name+EXT); diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroRecordReader.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroRecordReader.java index c173d05f786..351d3c59ea7 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroRecordReader.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroRecordReader.java @@ -56,9 +56,9 @@ protected AvroRecordReader(FileReader reader, FileSplit split) public AvroWrapper createKey() { return new AvroWrapper(null); } - + public NullWritable createValue() { return NullWritable.get(); } - + public boolean next(AvroWrapper wrapper, NullWritable ignore) throws IOException { if (!reader.hasNext() || reader.pastSync(end)) @@ -66,7 +66,7 @@ public boolean next(AvroWrapper wrapper, NullWritable ignore) wrapper.datum(reader.next(wrapper.datum())); return true; } - + public float getProgress() throws IOException { if (end == start) { return 0.0f; @@ -74,12 +74,12 @@ public float getProgress() throws IOException { return Math.min(1.0f, (getPos() - start) / (float)(end - start)); } } - + public long getPos() throws IOException { return reader.tell(); } public void close() throws IOException { reader.close(); } - + } diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroSerialization.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroSerialization.java index 92501bf45e9..fa8334b249d 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroSerialization.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroSerialization.java @@ -38,13 +38,13 @@ import org.apache.avro.io.EncoderFactory; /** The {@link Serialization} used by jobs configured with {@link AvroJob}. */ -public class AvroSerialization extends Configured +public class AvroSerialization extends Configured implements Serialization> { public boolean accept(Class c) { return AvroWrapper.class.isAssignableFrom(c); } - + /** Returns the specified map output deserializer. Defaults to the final * output deserializer if no map output schema was specified. */ public Deserializer> getDeserializer(Class> c) { @@ -57,7 +57,7 @@ public Deserializer> getDeserializer(Class> c) { DatumReader datumReader = dataModel.createDatumReader(schema); return new AvroWrapperDeserializer(datumReader, isKey); } - + private static final DecoderFactory FACTORY = DecoderFactory.get(); private class AvroWrapperDeserializer @@ -66,16 +66,16 @@ private class AvroWrapperDeserializer private DatumReader reader; private BinaryDecoder decoder; private boolean isKey; - + public AvroWrapperDeserializer(DatumReader reader, boolean isKey) { this.reader = reader; this.isKey = isKey; } - + public void open(InputStream in) { this.decoder = FACTORY.directBinaryDecoder(in, decoder); } - + public AvroWrapper deserialize(AvroWrapper wrapper) throws IOException { T datum = reader.read(wrapper == null ? null : wrapper.datum(), decoder); @@ -90,9 +90,9 @@ public AvroWrapper deserialize(AvroWrapper wrapper) public void close() throws IOException { decoder.inputStream().close(); } - + } - + /** Returns the specified output serializer. */ public Serializer> getSerializer(Class> c) { // AvroWrapper used for final output, AvroKey or AvroValue for map output @@ -112,7 +112,7 @@ private class AvroWrapperSerializer implements Serializer> { private DatumWriter writer; private OutputStream out; private BinaryEncoder encoder; - + public AvroWrapperSerializer(DatumWriter writer) { this.writer = writer; } diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroTextOutputFormat.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroTextOutputFormat.java index ef1fae9a292..917e8942dcf 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroTextOutputFormat.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroTextOutputFormat.java @@ -49,7 +49,7 @@ public class AvroTextOutputFormat extends FileOutputFormat { throws IOException { Schema schema = Schema.create(Schema.Type.BYTES); - + final byte[] keyValueSeparator = job.get("mapreduce.output.textoutputformat.separator", "\t").getBytes(UTF8); @@ -63,17 +63,17 @@ public class AvroTextOutputFormat extends FileOutputFormat { return new AvroTextRecordWriter(writer, keyValueSeparator); } - + class AvroTextRecordWriter implements RecordWriter { private final DataFileWriter writer; private final byte[] keyValueSeparator; - + public AvroTextRecordWriter(DataFileWriter writer, byte[] keyValueSeparator) { this.writer = writer; this.keyValueSeparator = keyValueSeparator; } - + public void write(K key, V value) throws IOException { boolean nullKey = key == null || key instanceof NullWritable; boolean nullValue = value == null || value instanceof NullWritable; @@ -87,11 +87,11 @@ public void write(K key, V value) throws IOException { writer.append(toByteBuffer(key, keyValueSeparator, value)); } } - + public void close(Reporter reporter) throws IOException { writer.close(); } - + private ByteBuffer toByteBuffer(Object o) throws IOException { if (o instanceof Text) { Text to = (Text) o; @@ -100,7 +100,7 @@ private ByteBuffer toByteBuffer(Object o) throws IOException { return ByteBuffer.wrap(o.toString().getBytes(UTF8)); } } - + private ByteBuffer toByteBuffer(Object key, byte[] sep, Object value) throws IOException { byte[] keyBytes, valBytes; diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroUtf8InputFormat.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroUtf8InputFormat.java index ac91109b18d..abd8ae426bf 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroUtf8InputFormat.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroUtf8InputFormat.java @@ -49,15 +49,15 @@ static class Utf8LineRecordReader implements RecordReader, NullWritable> { private LineRecordReader lineRecordReader; - + private LongWritable currentKeyHolder = new LongWritable(); private Text currentValueHolder = new Text(); - - public Utf8LineRecordReader(Configuration job, + + public Utf8LineRecordReader(Configuration job, FileSplit split) throws IOException { this.lineRecordReader = new LineRecordReader(job, split); } - + public void close() throws IOException { lineRecordReader.close(); } diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroWrapper.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroWrapper.java index 12c4d9e387a..71112af5d6a 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroWrapper.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroWrapper.java @@ -33,7 +33,7 @@ public class AvroWrapper { /** Set the wrapped datum. */ public void datum(T datum) { this.datum = datum; } - + public int hashCode() { return (datum == null) ? 0 : datum.hashCode(); } @@ -53,7 +53,7 @@ public boolean equals(Object obj) { return false; return true; } - + /** Get the wrapped datum as JSON. */ @Override public String toString() { diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/HadoopCombiner.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/HadoopCombiner.java index 5f914fb8dd5..2717510949f 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/HadoopCombiner.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/HadoopCombiner.java @@ -41,7 +41,7 @@ private class PairCollector extends AvroCollector> { private final AvroKey keyWrapper = new AvroKey(null); private final AvroValue valueWrapper = new AvroValue(null); private OutputCollector,AvroValue> collector; - + public PairCollector(OutputCollector,AvroValue> collector) { this.collector = collector; } diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/HadoopMapper.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/HadoopMapper.java index 35f11d65561..54e160943f6 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/HadoopMapper.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/HadoopMapper.java @@ -33,7 +33,7 @@ * otherwise assumed to be pairs that are split. */ class HadoopMapper extends MapReduceBase implements Mapper, NullWritable, KO, VO> { - + private AvroMapper mapper; private MapCollector out; private boolean isMapOnly; @@ -48,8 +48,8 @@ public void configure(JobConf conf) { } @Override - public void map(AvroWrapper wrapper, NullWritable value, - OutputCollector collector, + public void map(AvroWrapper wrapper, NullWritable value, + OutputCollector collector, Reporter reporter) throws IOException { if (this.out == null) this.out = new MapCollector(collector, isMapOnly); diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/HadoopReducerBase.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/HadoopReducerBase.java index 68749697193..b806f76e142 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/HadoopReducerBase.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/HadoopReducerBase.java @@ -29,10 +29,10 @@ abstract class HadoopReducerBase extends MapReduceBase implements Reducer, AvroValue, KO, VO> { - + private AvroReducer reducer; private AvroCollector collector; - + protected abstract AvroReducer getReducer(JobConf conf); protected abstract AvroCollector getCollector(OutputCollector c); @@ -52,9 +52,9 @@ class ReduceIterable implements Iterable, Iterator { @Override public final void reduce(AvroKey key, Iterator> values, - OutputCollector out, + OutputCollector out, Reporter reporter) throws IOException { - if (this.collector == null) + if (this.collector == null) this.collector = getCollector(out); reduceIterable.values = values; reducer.reduce(key.datum(), reduceIterable, collector, reporter); diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/Pair.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/Pair.java index 010b08de331..a33de9940a7 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/Pair.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/Pair.java @@ -74,7 +74,7 @@ public static Schema getValueSchema(Schema pair) { return pair.getField(VALUE).schema(); } - private static final Map> SCHEMA_CACHE = + private static final Map> SCHEMA_CACHE = new WeakHashMap>(); /** Get a pair schema. */ @@ -144,7 +144,7 @@ public Object get(int i) { case 0: return key; case 1: return value; default: throw new org.apache.avro.AvroRuntimeException("Bad index: "+i); - } + } } @Override @SuppressWarnings("unchecked") @@ -153,7 +153,7 @@ public void put(int i, Object o) { case 0: this.key = (K)o; break; case 1: this.value = (V)o; break; default: throw new org.apache.avro.AvroRuntimeException("Bad index: "+i); - } + } } private static final Schema STRING_SCHEMA = Schema.create(Type.STRING); @@ -510,11 +510,11 @@ private static Schema getSchema(Object o) { // {"Double", "DOUBLE_SCHEMA"}, // {"Void", "NULL_SCHEMA"}, // }; - + // private static String f(String pattern, String value) { // return java.text.MessageFormat.format(pattern, value); // } - + // public static void main(String... args) throws Exception { // StringBuffer b = new StringBuffer(); // for (String[] k : TABLE) { diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/SequenceFileReader.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/SequenceFileReader.java index 83c9de1c347..36c9b61a342 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/SequenceFileReader.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/SequenceFileReader.java @@ -148,7 +148,7 @@ private void prepare() throws IOException { reader.sync(position); ready = false; } - + @Override public boolean pastSync(long position) throws IOException { return reader.getPosition() >= position && reader.syncSeen(); } @@ -179,7 +179,7 @@ private void prepare() throws IOException { private static class WritableData extends ReflectData { private static final WritableData INSTANCE = new WritableData(); protected WritableData() {} - + /** Return the singleton instance. */ public static WritableData get() { return INSTANCE; } @@ -194,7 +194,7 @@ protected WritableData() {} private interface Converter { T convert(Writable o); } - + private static final Map WRITABLE_CONVERTERS = new HashMap(); static { diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/SequenceFileRecordReader.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/SequenceFileRecordReader.java index 693f34e4142..bb014a34a27 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/SequenceFileRecordReader.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/SequenceFileRecordReader.java @@ -31,6 +31,6 @@ public SequenceFileRecordReader(JobConf job, FileSplit split) super(new SequenceFileReader(split.getPath().toUri(), job), split); } - + } diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherData.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherData.java index 63657453b0f..f4620caf2c5 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherData.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherData.java @@ -33,7 +33,7 @@ public TetherData() {} /** Set the count of records in the buffer. Used for task input only. */ public void count(int count) { this.count = count; } - + /** Return the buffer. */ public ByteBuffer buffer() { return buffer; } diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherInputFormat.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherInputFormat.java index de0ee26b920..e680324d8f8 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherInputFormat.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherInputFormat.java @@ -36,7 +36,7 @@ /** * An {@link org.apache.hadoop.mapred.InputFormat} for tethered Avro input. - * + * * By default, when pointed at a directory, this will silently skip over any * files in it that do not have .avro extension. To instead include all files, * set the avro.mapred.ignore.inputs.without.extension property to false. diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherJob.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherJob.java index 169699f3035..1c16618b681 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherJob.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherJob.java @@ -42,7 +42,7 @@ public class TetherJob extends Configured { public static final String TETHER_EXEC_ARGS="avro.tether.executable_args"; public static final String TETHER_EXEC_CACHED="avro.tether.executable_cached"; public static final String TETHER_PROTOCOL="avro.tether.protocol"; - + /** Get the URI of the application's executable. */ public static URI getExecutable(JobConf job) { try { @@ -51,15 +51,15 @@ public static URI getExecutable(JobConf job) { throw new RuntimeException(e); } } - + /** Set the URI for the application's executable. Normally this in HDFS. */ public static void setExecutable(JobConf job, File executable) { setExecutable(job,executable, new ArrayList(),false); } - + /** - * Set the URI for the application's executable (i.e the program to run in a subprocess - * and provides the mapper/reducer). + * Set the URI for the application's executable (i.e the program to run in a subprocess + * and provides the mapper/reducer). * @param job - Job * @param executable - The URI of the executable * @param args - List of additional arguments; Null if no arguments @@ -114,7 +114,7 @@ public static RunningJob submitJob(JobConf conf) throws IOException { setupTetherJob(conf); return new JobClient(conf).submitJob(conf); } - + /** * Determines which transport protocol (e.g http or sasl) used to communicate * between the parent and subprocess @@ -147,7 +147,7 @@ private static void setupTetherJob(JobConf job) throws IOException { // set the map output key class to TetherData job.setMapOutputKeyClass(TetherData.class); - + // if protocol isn't set if (job.getStrings(TETHER_PROTOCOL)==null) { job.set(TETHER_PROTOCOL, "sasl"); diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherKeyComparator.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherKeyComparator.java index f1b74b0eb56..3ecdb4621a1 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherKeyComparator.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherKeyComparator.java @@ -52,7 +52,7 @@ public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) { @Override public int compare(TetherData x, TetherData y) { ByteBuffer b1 = x.buffer(), b2 = y.buffer(); - int diff = BinaryData.compare(b1.array(), b1.position(), + int diff = BinaryData.compare(b1.array(), b1.position(), b2.array(), b2.position(), schema); return diff == 0 ? -1 : diff; diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherKeySerialization.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherKeySerialization.java index b91053eb1f0..7dbd6fe7501 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherKeySerialization.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherKeySerialization.java @@ -39,20 +39,20 @@ class TetherKeySerialization public boolean accept(Class c) { return TetherData.class.isAssignableFrom(c); } - + public Deserializer getDeserializer(Class c) { return new TetherDataDeserializer(); } - + private static final DecoderFactory FACTORY = DecoderFactory.get(); private class TetherDataDeserializer implements Deserializer { private BinaryDecoder decoder; - + public void open(InputStream in) { this.decoder = FACTORY.directBinaryDecoder(in, decoder); } - + public TetherData deserialize(TetherData datum) throws IOException { if (datum == null) datum = new TetherData(); datum.buffer(decoder.readBytes(datum.buffer())); @@ -63,7 +63,7 @@ public void close() throws IOException { decoder.inputStream().close(); } } - + public Serializer getSerializer(Class c) { return new TetherDataSerializer(); } @@ -72,7 +72,7 @@ private class TetherDataSerializer implements Serializer { private OutputStream out; private BinaryEncoder encoder; - + public void open(OutputStream out) { this.out = out; this.encoder = EncoderFactory.get().directBinaryEncoder(out, encoder); diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherMapRunner.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherMapRunner.java index c8b335f23a3..04c7f20c932 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherMapRunner.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherMapRunner.java @@ -56,10 +56,10 @@ public void run(RecordReader recordReader, // configure it LOG.info("send configure to subprocess for map task"); process.inputClient.configure - (TaskType.MAP, + (TaskType.MAP, job.get(AvroJob.INPUT_SCHEMA), AvroJob.getMapOutputSchema(job).toString()); - + LOG.info("send partitions to subprocess for map task"); process.inputClient.partitions(job.getNumReduceTasks()); @@ -91,5 +91,5 @@ public void run(RecordReader recordReader, process.close(); } } - + } diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherOutputFormat.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherOutputFormat.java index 83659389c02..7206947353c 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherOutputFormat.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherOutputFormat.java @@ -53,7 +53,7 @@ public static void setDeflateLevel(JobConf job, int level) { throws IOException { Schema schema = AvroJob.getOutputSchema(job); - + final DataFileWriter writer = new DataFileWriter(new GenericDatumWriter()); if (FileOutputFormat.getCompressOutput(job)) { diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherPartitioner.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherPartitioner.java index ff0c6196598..eae17226ece 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherPartitioner.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherPartitioner.java @@ -29,7 +29,7 @@ import org.apache.avro.mapred.AvroJob; class TetherPartitioner implements Partitioner { - + private static final ThreadLocal CACHE = new ThreadLocal(); private Schema schema; diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherRecordReader.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherRecordReader.java index 33c06a89173..2b8240c7a4b 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherRecordReader.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherRecordReader.java @@ -55,9 +55,9 @@ public TetherRecordReader(JobConf job, FileSplit split) public Schema getSchema() { return reader.getSchema(); } public TetherData createKey() { return new TetherData(); } - + public NullWritable createValue() { return NullWritable.get(); } - + public boolean next(TetherData data, NullWritable ignore) throws IOException { if (!reader.hasNext() || reader.pastSync(end)) @@ -66,7 +66,7 @@ public boolean next(TetherData data, NullWritable ignore) data.count((int)reader.getBlockCount()); return true; } - + public float getProgress() throws IOException { if (end == start) { return 0.0f; @@ -74,11 +74,11 @@ public float getProgress() throws IOException { return Math.min(1.0f, (in.tell() - start) / (float)(end - start)); } } - + public long getPos() throws IOException { return in.tell(); } public void close() throws IOException { reader.close(); } - + } diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherReducer.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherReducer.java index 35b4231250c..06478320d14 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherReducer.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetherReducer.java @@ -40,7 +40,7 @@ public void configure(JobConf job) { this.job = job; } - public void reduce(TetherData datum, Iterator ignore, + public void reduce(TetherData datum, Iterator ignore, OutputCollector collector, Reporter reporter) throws IOException { try { diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetheredProcess.java b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetheredProcess.java index 8ad8e8b7c74..142905a620a 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetheredProcess.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapred/tether/TetheredProcess.java @@ -101,7 +101,7 @@ public TetheredProcess(JobConf job, } outputServer.start(); - + // start sub-process, connecting back to server this.subprocess = startSubprocess(job); @@ -227,5 +227,5 @@ private Process startSubprocess(JobConf job) builder.environment().putAll(env); return builder.start(); } - + } diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroKeyRecordWriter.java b/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroKeyRecordWriter.java index ce7bc5835fb..e403123da34 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroKeyRecordWriter.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroKeyRecordWriter.java @@ -67,7 +67,7 @@ public AvroKeyRecordWriter(Schema writerSchema, GenericData dataModel, */ public AvroKeyRecordWriter(Schema writerSchema, GenericData dataModel, CodecFactory compressionCodec, OutputStream outputStream) throws IOException { - this(writerSchema, dataModel, compressionCodec, outputStream, + this(writerSchema, dataModel, compressionCodec, outputStream, DataFileConstants.DEFAULT_SYNC_INTERVAL); } @@ -82,10 +82,10 @@ public void write(AvroKey record, NullWritable ignore) throws IOException { public void close(TaskAttemptContext context) throws IOException { mAvroFileWriter.close(); } - + /** {@inheritDoc} */ @Override public long sync() throws IOException { return mAvroFileWriter.sync(); - } + } } diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroKeyValueRecordWriter.java b/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroKeyValueRecordWriter.java index 71baa414a33..ee68c48442d 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroKeyValueRecordWriter.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroKeyValueRecordWriter.java @@ -106,10 +106,10 @@ public AvroKeyValueRecordWriter(AvroDatumConverter keyConverter, public AvroKeyValueRecordWriter(AvroDatumConverter keyConverter, AvroDatumConverter valueConverter, GenericData dataModel, CodecFactory compressionCodec, OutputStream outputStream) throws IOException { - this(keyConverter, valueConverter, dataModel, compressionCodec, outputStream, + this(keyConverter, valueConverter, dataModel, compressionCodec, outputStream, DataFileConstants.DEFAULT_SYNC_INTERVAL); } - + /** * Gets the writer schema for the key/value pair generic record. * @@ -137,5 +137,5 @@ public void close(TaskAttemptContext context) throws IOException { @Override public long sync() throws IOException { return mAvroFileWriter.sync(); - } + } } diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroMultipleOutputs.java b/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroMultipleOutputs.java index 9db8c6837ec..3f8d7e03b28 100644 --- a/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroMultipleOutputs.java +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroMultipleOutputs.java @@ -41,10 +41,10 @@ import org.apache.hadoop.util.ReflectionUtils; /** - * The AvroMultipleOutputs class simplifies writing Avro output data + * The AvroMultipleOutputs class simplifies writing Avro output data * to multiple outputs - * - *

      + * + *

      * Case one: writing to additional outputs other than the job default output. * * Each additional output, or named output, may be configured with its own @@ -53,14 +53,14 @@ *

      * Case two: to write data to different files provided by user *

      - * + * *

      - * AvroMultipleOutputs supports counters, by default they are disabled. The - * counters group is the {@link AvroMultipleOutputs} class name. The names of the - * counters are the same as the output name. These count the number of records - * written to each output name. + * AvroMultipleOutputs supports counters, by default they are disabled. The + * counters group is the {@link AvroMultipleOutputs} class name. The names of the + * counters are the same as the output name. These count the number of records + * written to each output name. *

      - * + * * Usage pattern for job submission: *
        *
      @@ -72,18 +72,18 @@
        * job.setMapperClass(MyAvroMapper.class);
        * job.setReducerClass(MyAvroReducer.class);
        * ...
      - *  
      + *
        * Schema schema;
        * ...
        * // Defines additional single output 'avro1' for the job
        * AvroMultipleOutputs.addNamedOutput(job, "avro1", AvroKeyValueOutputFormat.class,
      - * keyschema, valueSchema);  // valueSchema can be set to null if there only Key to be written 
      + * keyschema, valueSchema);  // valueSchema can be set to null if there only Key to be written
                                          to file in the RecordWriter
        *
        * // Defines additional output 'avro2' with different schema for the job
        * AvroMultipleOutputs.addNamedOutput(job, "avro2",
        *   AvroKeyOutputFormat.class,
      - *   schema,null); 
      + *   schema,null);
        * ...
        *
        * job.waitForCompletion(true);
      @@ -92,7 +92,7 @@
        * 

      * Usage in Reducer: *

      - * 
      + *
        * public class MyAvroReducer extends
        *   Reducer<K, V, T, NullWritable> {
        * private MultipleOutputs amos;
      @@ -126,18 +126,18 @@ public class AvroMultipleOutputs{
       
         private static final String MULTIPLE_OUTPUTS = "avro.mapreduce.multipleoutputs";
       
      -  private static final String MO_PREFIX = 
      +  private static final String MO_PREFIX =
           "avro.mapreduce.multipleoutputs.namedOutput.";
       
         private static final String FORMAT = ".format";
      -  private static final String COUNTERS_ENABLED = 
      +  private static final String COUNTERS_ENABLED =
           "avro.mapreduce.multipleoutputs.counters";
       
         /**
          * Counters group used by the counters of MultipleOutputs.
          */
         private static final String COUNTERS_GROUP = AvroMultipleOutputs.class.getName();
      -  
      +
         /**
          * Cache for the taskContexts
          */
      @@ -181,7 +181,7 @@ private static void checkBaseOutputPath(String outputPath) {
             throw new IllegalArgumentException("output name cannot be 'part'");
           }
         }
      -  
      +
         /**
          * Checks if a named output name is valid.
          *
      @@ -270,7 +270,7 @@ public static void addNamedOutput(Job job, String namedOutput,
       
         /**
          * Enables or disables counters for the named outputs.
      -   * 
      +   *
          * The counters group is the {@link AvroMultipleOutputs} class name.
          * The names of the counters are the same as the named outputs. These
          * counters count the number records written to each output name.
      @@ -287,7 +287,7 @@ public static void setCountersEnabled(Job job, boolean enabled) {
          * Returns if the counters for the named outputs are enabled or not.
          * By default these counters are disabled.
          *
      -   * @param job    the job 
      +   * @param job    the job
          * @return TRUE if the counters are enabled, FALSE if they are disabled.
          */
         public static boolean getCountersEnabled(JobContext job) {
      @@ -295,7 +295,7 @@ public static boolean getCountersEnabled(JobContext job) {
         }
       
         /**
      -   * Wraps RecordWriter to increment counters. 
      +   * Wraps RecordWriter to increment counters.
          */
         @SuppressWarnings("unchecked")
         private static class RecordWriterWithCounter extends RecordWriter {
      @@ -311,13 +311,13 @@ public RecordWriterWithCounter(RecordWriter writer, String counterName,
           }
       
           @SuppressWarnings({"unchecked"})
      -    public void write(Object key, Object value) 
      +    public void write(Object key, Object value)
               throws IOException, InterruptedException {
             context.getCounter(COUNTERS_GROUP, counterName).increment(1);
             writer.write(key, value);
           }
       
      -    public void close(TaskAttemptContext context) 
      +    public void close(TaskAttemptContext context)
               throws IOException, InterruptedException {
             writer.close(context);
           }
      @@ -329,7 +329,7 @@ public void close(TaskAttemptContext context)
         private Set namedOutputs;
         private Map> recordWriters;
         private boolean countersEnabled;
      -  
      +
         /**
          * Creates and initializes multiple outputs support,
          * it should be instantiated in the Mapper/Reducer setup method.
      @@ -350,7 +350,7 @@ public AvroMultipleOutputs(
          *
          * Output path is a unique file generated for the namedOutput.
          * For example, {namedOutput}-(m|r)-{part-number}
      -   * 
      +   *
          * @param namedOutput the named output name
          * @param key         the key , value is NullWritable
          */
      @@ -367,7 +367,7 @@ public void write(String namedOutput, Object key)
          *
          * Output path is a unique file generated for the namedOutput.
          * For example, {namedOutput}-(m|r)-{part-number}
      -   * 
      +   *
          * @param namedOutput the named output name
          * @param key         the key
          * @param value       the value
      @@ -380,7 +380,7 @@ public void write(String namedOutput, Object key, Object value)
       
         /**
          * Write key and value to baseOutputPath using the namedOutput.
      -   * 
      +   *
          * @param namedOutput    the named output name
          * @param key            the key
          * @param value          the value
      @@ -402,26 +402,26 @@ public void write(String namedOutput, Object key, Object value,
       
         /**
          * Write key value to an output file name.
      -   * 
      -   * Gets the record writer from job's output format.  
      +   *
      +   * Gets the record writer from job's output format.
          * Job's output format should be a FileOutputFormat.
      -   * 
      +   *
          * @param key       the key
          * @param value     the value
          * @param baseOutputPath base-output path to write the record to.
          * Note: Framework will generate unique filename for the baseOutputPath
          */
      -  public void write(Object key, Object value, String baseOutputPath) 
      +  public void write(Object key, Object value, String baseOutputPath)
             throws IOException, InterruptedException {
               write(key, value, null, null, baseOutputPath);
         }
      -  
      +
         /**
          * Write key value to an output file name.
      -   * 
      +   *
          * Gets the record writer from job's output format. Job's output format should
          * be a FileOutputFormat.
      -   * 
      +   *
          * @param key   the key
          * @param value the value
          * @param keySchema   keySchema to use
      @@ -441,13 +441,13 @@ public void write(Object key, Object value, Schema keySchema,
         }
       
         /**
      -   * 
      +   *
          * Gets the record writer from job's output format. Job's output format should
      -   * be a FileOutputFormat.If the record writer implements Syncable then returns 
      +   * be a FileOutputFormat.If the record writer implements Syncable then returns
          * the current position as a value that may be passed to DataFileReader.seek(long)
      -   * otherwise returns -1. 
      +   * otherwise returns -1.
          * Forces the end of the current block, emitting a synchronization marker.
      -   * 
      +   *
          * @param namedOutput   the namedOutput
          * @param baseOutputPath base-output path to write the record to. Note: Framework will
          *          generate unique filename for the baseOutputPath
      @@ -472,12 +472,12 @@ public long sync(String namedOutput, String baseOutputPath) throws IOException,
         // MultithreadedMapper.
         @SuppressWarnings("unchecked")
         private synchronized RecordWriter getRecordWriter(
      -      TaskAttemptContext taskContext, String baseFileName) 
      +      TaskAttemptContext taskContext, String baseFileName)
             throws IOException, InterruptedException {
      -    
      +
           // look for record-writer in the cache
           RecordWriter writer = recordWriters.get(baseFileName);
      -    
      +
           // If not in cache, create a new one
           if (writer == null) {
             // get the record writer from context output format
      @@ -490,13 +490,13 @@ private synchronized RecordWriter getRecordWriter(
             } catch (ClassNotFoundException e) {
               throw new IOException(e);
             }
      - 
      -      // if counters are enabled, wrap the writer with context 
      -      // to increment counters 
      +
      +      // if counters are enabled, wrap the writer with context
      +      // to increment counters
             if (countersEnabled) {
               writer = new RecordWriterWithCounter(writer, baseFileName, context);
             }
      -      
      +
             // add the record-writer to the cache
             recordWriters.put(baseFileName, writer);
           }
      @@ -521,7 +521,7 @@ private void setSchema(Job job, Schema keySchema, Schema valSchema) {
       
         }
       
      -   // Create a taskAttemptContext for the named output with 
      +   // Create a taskAttemptContext for the named output with
          // output format and output key/value types put in the context
         @SuppressWarnings("deprecation")
         private TaskAttemptContext getContext(String nameOutput) throws IOException {
      @@ -547,13 +547,13 @@ private TaskAttemptContext getContext(String nameOutput) throws IOException {
           setSchema(job, keySchema, valSchema);
           taskContext = createTaskAttemptContext(
             job.getConfiguration(), context.getTaskAttemptID());
      -    
      +
           taskContexts.put(nameOutput, taskContext);
      -    
      +
           return taskContext;
         }
      -  
      -  private TaskAttemptContext createTaskAttemptContext(Configuration conf, 
      +
      +  private TaskAttemptContext createTaskAttemptContext(Configuration conf,
             TaskAttemptID taskId) {
           // Use reflection since the context types changed incompatibly between 1.0
           // and 2.0.
      @@ -566,7 +566,7 @@ private TaskAttemptContext createTaskAttemptContext(Configuration conf,
             throw new IllegalStateException(e);
           }
         }
      -  
      +
         private Class getTaskAttemptContextClass() {
           try {
             return Class.forName(
      @@ -580,14 +580,14 @@ private Class getTaskAttemptContextClass() {
             }
           }
         }
      -  
      +
         /**
          * Closes all the opened outputs.
      -   * 
      +   *
          * This should be called from cleanup method of map/reduce task.
          * If overridden subclasses must invoke super.close() at the
          * end of their close()
      -   * 
      +   *
          */
         @SuppressWarnings("unchecked")
         public void close() throws IOException, InterruptedException {
      @@ -597,4 +597,4 @@ public void close() throws IOException, InterruptedException {
         }
       }
       
      - 
      +
      diff --git a/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroOutputFormatBase.java b/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroOutputFormatBase.java
      index 5f77190a0b2..c702c9b6376 100644
      --- a/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroOutputFormatBase.java
      +++ b/lang/java/mapred/src/main/java/org/apache/avro/mapreduce/AvroOutputFormatBase.java
      @@ -36,7 +36,7 @@
        * @param  The type of value to write.
        */
       public abstract class AvroOutputFormatBase extends FileOutputFormat {
      -  
      +
         /**
          * Gets the configured compression codec from the task context.
          *
      @@ -52,7 +52,7 @@ protected static CodecFactory getCompressionCodec(TaskAttemptContext context) {
             int xzLevel = context.getConfiguration().getInt(
                     org.apache.avro.mapred.AvroOutputFormat.XZ_LEVEL_KEY,
                     CodecFactory.DEFAULT_XZ_LEVEL);
      -      
      +
             String outputCodec = context.getConfiguration()
               .get(AvroJob.CONF_OUTPUT_CODEC);
       
      @@ -72,7 +72,7 @@ protected static CodecFactory getCompressionCodec(TaskAttemptContext context) {
               } else {
                 return CodecFactory.fromString(outputCodec);
               }
      -      
      +
             }
       
           // No compression.
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/hadoop/file/TestHadoopCodecFactory.java b/lang/java/mapred/src/test/java/org/apache/avro/hadoop/file/TestHadoopCodecFactory.java
      index af340d8b895..913286603fb 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/hadoop/file/TestHadoopCodecFactory.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/hadoop/file/TestHadoopCodecFactory.java
      @@ -23,35 +23,35 @@
       import static org.junit.Assert.assertTrue;
       
       public class TestHadoopCodecFactory {
      -  
      +
         @Test
         public void testHadoopCodecFactoryDeflate(){
           CodecFactory hadoopDeflateCodec = HadoopCodecFactory.fromHadoopString("org.apache.hadoop.io.compress.DeflateCodec");
           CodecFactory avroDeflateCodec = CodecFactory.fromString("deflate");
           assertTrue(hadoopDeflateCodec.getClass().equals(avroDeflateCodec.getClass()));
         }
      -  
      +
         @Test
         public void testHadoopCodecFactorySnappy(){
           CodecFactory hadoopSnappyCodec = HadoopCodecFactory.fromHadoopString("org.apache.hadoop.io.compress.SnappyCodec");
           CodecFactory avroSnappyCodec = CodecFactory.fromString("snappy");
           assertTrue(hadoopSnappyCodec.getClass().equals(avroSnappyCodec.getClass()));
         }
      -  
      +
         @Test
         public void testHadoopCodecFactoryBZip2(){
           CodecFactory hadoopSnappyCodec = HadoopCodecFactory.fromHadoopString("org.apache.hadoop.io.compress.BZip2Codec");
           CodecFactory avroSnappyCodec = CodecFactory.fromString("bzip2");
           assertTrue(hadoopSnappyCodec.getClass().equals(avroSnappyCodec.getClass()));
         }
      -  
      +
         @Test
         public void testHadoopCodecFactoryGZip(){
           CodecFactory hadoopSnappyCodec = HadoopCodecFactory.fromHadoopString("org.apache.hadoop.io.compress.GZipCodec");
           CodecFactory avroSnappyCodec = CodecFactory.fromString("deflate");
           assertTrue(hadoopSnappyCodec.getClass().equals(avroSnappyCodec.getClass()));
         }
      -  
      +
         @Test
         public void testHadoopCodecFactoryFail(){
           CodecFactory hadoopSnappyCodec = HadoopCodecFactory.fromHadoopString("org.apache.hadoop.io.compress.FooCodec");
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroInputFormat.java b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroInputFormat.java
      index 81d35ffd0d5..99618147fda 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroInputFormat.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroInputFormat.java
      @@ -34,26 +34,26 @@
       import org.junit.Test;
       
       public class TestAvroInputFormat {
      -  
      +
         private static final String TEST_DIR = System.getProperty("test.dir", ".") +
             File.separator + TestAvroInputFormat.class.getName();
         private JobConf conf;
         private FileSystem fs;
         private Path inputDir;
      -  
      +
         @Before
         public void setUp() throws Exception {
           conf = new JobConf();
           fs = FileSystem.getLocal(conf);
           inputDir = new Path(TEST_DIR);
         }
      -  
      -  
      +
      +
         @After
         public void tearDown() throws Exception {
           fs.delete(inputDir, true);
         }
      -  
      +
         @SuppressWarnings("rawtypes")
         @Test
         public void testIgnoreFilesWithoutExtension() throws Exception {
      @@ -62,15 +62,15 @@ public void testIgnoreFilesWithoutExtension() throws Exception {
           Path textFile = new Path(inputDir, "someotherfile.txt");
           fs.create(avroFile).close();
           fs.create(textFile).close();
      -    
      +
           FileInputFormat.setInputPaths(conf, inputDir);
       
      -    
      +
           AvroInputFormat inputFormat = new AvroInputFormat();
           FileStatus[] statuses = inputFormat.listStatus(conf);
           Assert.assertEquals(1, statuses.length);
           Assert.assertEquals("somefile.avro", statuses[0].getPath().getName());
      -    
      +
           conf.setBoolean(AvroInputFormat.IGNORE_FILES_WITHOUT_EXTENSION_KEY, false);
           statuses = inputFormat.listStatus(conf);
           Assert.assertEquals(2, statuses.length);
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroMultipleOutputs.java b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroMultipleOutputs.java
      index e520c87d5ab..98205bae388 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroMultipleOutputs.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroMultipleOutputs.java
      @@ -64,22 +64,22 @@ public void map(Utf8 text, AvroCollector> collector,
               amos.getCollector("myavro2",reporter)
                 .collect(new Pair(new Utf8(tok),1L).toString());
             }
      -        
      +
           }
           public void close() throws IOException {
             amos.close();
           }
       
         }
      -  
      +
         public static class ReduceImpl
           extends AvroReducer > {
           private AvroMultipleOutputs amos;
      -    
      +
           public void configure(JobConf Job)
           {
               amos=new AvroMultipleOutputs(Job);
      -    }    
      +    }
       
           @Override
           public void reduce(Utf8 word, Iterable counts,
      @@ -99,7 +99,7 @@ public void close() throws IOException
           {
             amos.close();
           }
      -  }    
      +  }
       
         @Test public void runTestsInOrder() throws Exception {
           testJob();
      @@ -110,70 +110,70 @@ public void close() throws IOException
           testJob_noreducer();
           testProjection_noreducer();
         }
      -  
      +
         @SuppressWarnings("deprecation")
         public void testJob() throws Exception {
           JobConf job = new JobConf();
      -    
      +
       //    private static final String UTF8 = "UTF-8";
           String dir = System.getProperty("test.dir", ".") + "/mapred";
           Path outputPath = new Path(dir + "/out");
      -    
      +
           outputPath.getFileSystem(job).delete(outputPath);
           WordCountUtil.writeLinesFile();
      -    
      +
           job.setJobName("AvroMultipleOutputs");
      -    
      +
           AvroJob.setInputSchema(job, Schema.create(Schema.Type.STRING));
           AvroJob.setOutputSchema(job,
                                   new Pair(new Utf8(""), 0L).getSchema());
      -    
      -    AvroJob.setMapperClass(job, MapImpl.class);        
      +
      +    AvroJob.setMapperClass(job, MapImpl.class);
           AvroJob.setReducerClass(job, ReduceImpl.class);
      -    
      +
           FileInputFormat.setInputPaths(job, new Path(dir + "/in"));
           FileOutputFormat.setOutputPath(job, outputPath);
           FileOutputFormat.setCompressOutput(job, false);
           AvroMultipleOutputs.addNamedOutput(job,"myavro",AvroOutputFormat.class, new Pair(new Utf8(""), 0L).getSchema());
           AvroMultipleOutputs.addNamedOutput(job,"myavro1",AvroOutputFormat.class, Schema.create(Schema.Type.STRING));
      -    AvroMultipleOutputs.addNamedOutput(job,"myavro2",AvroOutputFormat.class, Schema.create(Schema.Type.STRING));   
      +    AvroMultipleOutputs.addNamedOutput(job,"myavro2",AvroOutputFormat.class, Schema.create(Schema.Type.STRING));
           WordCountUtil.setMeta(job);
       
       
           JobClient.runJob(job);
      -    
      +
           WordCountUtil.validateCountsFile();
         }
      -  
      +
         @SuppressWarnings("deprecation")
         public void testProjection() throws Exception {
           JobConf job = new JobConf();
      -    
      +
           Integer defaultRank = new Integer(-1);
      -    
      -    String jsonSchema = 
      +
      +    String jsonSchema =
             "{\"type\":\"record\"," +
             "\"name\":\"org.apache.avro.mapred.Pair\","+
      -      "\"fields\": [ " + 
      +      "\"fields\": [ " +
               "{\"name\":\"rank\", \"type\":\"int\", \"default\": -1}," +
      -        "{\"name\":\"value\", \"type\":\"long\"}" + 
      +        "{\"name\":\"value\", \"type\":\"long\"}" +
             "]}";
      -    
      +
           Schema readerSchema = Schema.parse(jsonSchema);
      -    
      +
           AvroJob.setInputSchema(job, readerSchema);
      -    
      +
           String dir = System.getProperty("test.dir", ".") + "/mapred";
           Path inputPath = new Path(dir + "/out" + "/myavro-r-00000.avro");
           FileStatus fileStatus = FileSystem.get(job).getFileStatus(inputPath);
           FileSplit fileSplit = new FileSplit(inputPath, 0, fileStatus.getLen(), job);
       
      -    
      +
           AvroRecordReader> recordReader = new AvroRecordReader>(job, fileSplit);
      -    
      +
           AvroWrapper> inputPair = new AvroWrapper>(null);
           NullWritable ignore = NullWritable.get();
      -    
      +
           long sumOfCounts = 0;
           long numOfCounts = 0;
           while(recordReader.next(inputPair, ignore)) {
      @@ -181,47 +181,47 @@ public void testProjection() throws Exception {
             sumOfCounts += (Long) inputPair.datum().get(1);
             numOfCounts++;
           }
      -    
      +
           Assert.assertEquals(numOfCounts, WordCountUtil.COUNTS.size());
      -    
      +
           long actualSumOfCounts = 0;
           for(Long count : WordCountUtil.COUNTS.values()) {
             actualSumOfCounts += count;
           }
      -    
      +
           Assert.assertEquals(sumOfCounts, actualSumOfCounts);
       
         }
      -  
      +
         @SuppressWarnings("deprecation")
         public void testProjection_newmethods() throws Exception {
           JobConf job = new JobConf();
      -    
      +
           Integer defaultRank = new Integer(-1);
      -    
      -    String jsonSchema = 
      +
      +    String jsonSchema =
             "{\"type\":\"record\"," +
             "\"name\":\"org.apache.avro.mapred.Pair\","+
      -      "\"fields\": [ " + 
      +      "\"fields\": [ " +
               "{\"name\":\"rank\", \"type\":\"int\", \"default\": -1}," +
      -        "{\"name\":\"value\", \"type\":\"long\"}" + 
      +        "{\"name\":\"value\", \"type\":\"long\"}" +
             "]}";
      -    
      +
           Schema readerSchema = Schema.parse(jsonSchema);
      -    
      +
           AvroJob.setInputSchema(job, readerSchema);
      -    
      +
           String dir = System.getProperty("test.dir", ".") + "/mapred";
           Path inputPath = new Path(dir + "/out" + "/testavrofile-r-00000.avro");
           FileStatus fileStatus = FileSystem.get(job).getFileStatus(inputPath);
           FileSplit fileSplit = new FileSplit(inputPath, 0, fileStatus.getLen(), job);
       
      -    
      +
           AvroRecordReader> recordReader = new AvroRecordReader>(job, fileSplit);
      -    
      +
           AvroWrapper> inputPair = new AvroWrapper>(null);
           NullWritable ignore = NullWritable.get();
      -    
      +
           long sumOfCounts = 0;
           long numOfCounts = 0;
           while(recordReader.next(inputPair, ignore)) {
      @@ -229,18 +229,18 @@ public void testProjection_newmethods() throws Exception {
             sumOfCounts += (Long) inputPair.datum().get(1);
             numOfCounts++;
           }
      -    
      +
           Assert.assertEquals(numOfCounts, WordCountUtil.COUNTS.size());
      -    
      +
           long actualSumOfCounts = 0;
           for(Long count : WordCountUtil.COUNTS.values()) {
             actualSumOfCounts += count;
           }
      -    
      +
           Assert.assertEquals(sumOfCounts, actualSumOfCounts);
       
         }
      -  
      +
       
         @SuppressWarnings("deprecation")
         // Test for a differnt schema output
      @@ -269,7 +269,7 @@ public void testProjection1() throws Exception {
           }
           Assert.assertEquals(sumOfCounts, actualSumOfCounts);
         }
      -  
      +
         @SuppressWarnings("deprecation")
         // Test for a differnt schema output
         public void testProjection_newmethods_1() throws Exception {
      @@ -323,7 +323,7 @@ public void testJob_noreducer() throws Exception {
           AvroMultipleOutputs.addNamedOutput(job,"myavro2",AvroOutputFormat.class, Schema.create(Schema.Type.STRING));
           JobClient.runJob(job);
         }
      -  
      +
         public void testProjection_noreducer() throws Exception {
           JobConf job = new JobConf();
           long onel = 1;
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroOutputFormat.java b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroOutputFormat.java
      index 6de471023c2..6f5c0a04c32 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroOutputFormat.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroOutputFormat.java
      @@ -35,107 +35,107 @@ public void testSetSyncInterval() {
           assertEquals(newSyncInterval, jobConf.getInt(
               AvroOutputFormat.SYNC_INTERVAL_KEY, -1));
         }
      -  
      +
         @Test
         public void testNoCodec() throws UnsupportedEncodingException {
      -    
      -    
      +
      +
           JobConf job = new JobConf();
           assertTrue(AvroOutputFormat.getCodecFactory(job) == null);
      -    
      +
           job = new JobConf();
           job.set("mapred.output.compress", "false");
           job.set("mapred.output.compression.codec", "org.apache.hadoop.io.compress.BZip2Codec");
           assertTrue(AvroOutputFormat.getCodecFactory(job) == null);
      -    
      +
           job = new JobConf();
           job.set("mapred.output.compress", "false");
           job.set(AvroJob.OUTPUT_CODEC, "bzip2");
           assertTrue(AvroOutputFormat.getCodecFactory(job) == null);
         }
      -  
      +
         @Test
         public void testBZip2CodecUsingHadoopClass() throws UnsupportedEncodingException {
           CodecFactory avroBZip2Codec = CodecFactory.fromString("bzip2");
      -    
      +
           JobConf job = new JobConf();
           job.set("mapred.output.compress", "true");
           job.set("mapred.output.compression.codec", "org.apache.hadoop.io.compress.BZip2Codec");
           CodecFactory factory = AvroOutputFormat.getCodecFactory(job);
           assertTrue(factory != null);
      -    assertTrue(factory.getClass().equals(avroBZip2Codec.getClass()));    
      +    assertTrue(factory.getClass().equals(avroBZip2Codec.getClass()));
         }
      -  
      +
         @Test
         public void testBZip2CodecUsingAvroCodec() throws UnsupportedEncodingException {
           CodecFactory avroBZip2Codec = CodecFactory.fromString("bzip2");
      -    
      +
           JobConf job = new JobConf();
           job.set("mapred.output.compress", "true");
           job.set(AvroJob.OUTPUT_CODEC, "bzip2");
           CodecFactory factory = AvroOutputFormat.getCodecFactory(job);
           assertTrue(factory != null);
      -    assertTrue(factory.getClass().equals(avroBZip2Codec.getClass()));    
      +    assertTrue(factory.getClass().equals(avroBZip2Codec.getClass()));
         }
      -  
      +
         @Test
         public void testDeflateCodecUsingHadoopClass() throws UnsupportedEncodingException {
           CodecFactory avroDeflateCodec = CodecFactory.fromString("deflate");
      -    
      +
           JobConf job = new JobConf();
           job.set("mapred.output.compress", "true");
           job.set("mapred.output.compression.codec", "org.apache.hadoop.io.compress.DeflateCodec");
           CodecFactory factory = AvroOutputFormat.getCodecFactory(job);
           assertTrue(factory != null);
      -    assertTrue(factory.getClass().equals(avroDeflateCodec.getClass()));    
      +    assertTrue(factory.getClass().equals(avroDeflateCodec.getClass()));
         }
      -  
      +
         @Test
         public void testDeflateCodecUsingAvroCodec() throws UnsupportedEncodingException {
           CodecFactory avroDeflateCodec = CodecFactory.fromString("deflate");
      -    
      +
           JobConf job = new JobConf();
           job.set("mapred.output.compress", "true");
           job.set(AvroJob.OUTPUT_CODEC, "deflate");
           CodecFactory factory = AvroOutputFormat.getCodecFactory(job);
           assertTrue(factory != null);
      -    assertTrue(factory.getClass().equals(avroDeflateCodec.getClass()));    
      +    assertTrue(factory.getClass().equals(avroDeflateCodec.getClass()));
         }
      -  
      +
         @Test
         public void testSnappyCodecUsingHadoopClass() throws UnsupportedEncodingException {
           CodecFactory avroSnappyCodec = CodecFactory.fromString("snappy");
      -    
      +
           JobConf job = new JobConf();
           job.set("mapred.output.compress", "true");
           job.set("mapred.output.compression.codec", "org.apache.hadoop.io.compress.SnappyCodec");
           CodecFactory factory = AvroOutputFormat.getCodecFactory(job);
           assertTrue(factory != null);
      -    assertTrue(factory.getClass().equals(avroSnappyCodec.getClass()));    
      +    assertTrue(factory.getClass().equals(avroSnappyCodec.getClass()));
         }
      -  
      +
         @Test
         public void testSnappyCodecUsingAvroCodec() throws UnsupportedEncodingException {
           CodecFactory avroSnappyCodec = CodecFactory.fromString("snappy");
      -    
      +
           JobConf job = new JobConf();
           job.set("mapred.output.compress", "true");
           job.set(AvroJob.OUTPUT_CODEC, "snappy");
           CodecFactory factory = AvroOutputFormat.getCodecFactory(job);
           assertTrue(factory != null);
      -    assertTrue(factory.getClass().equals(avroSnappyCodec.getClass()));    
      +    assertTrue(factory.getClass().equals(avroSnappyCodec.getClass()));
         }
      -  
      +
         @Test
         public void testGZipCodecUsingHadoopClass() throws UnsupportedEncodingException {
           CodecFactory avroDeflateCodec = CodecFactory.fromString("deflate");
      -    
      +
           JobConf job = new JobConf();
           job.set("mapred.output.compress", "true");
           job.set("mapred.output.compression.codec", "org.apache.hadoop.io.compress.GZipCodec");
           CodecFactory factory = AvroOutputFormat.getCodecFactory(job);
           assertTrue(factory != null);
      -    assertTrue(factory.getClass().equals(avroDeflateCodec.getClass()));    
      +    assertTrue(factory.getClass().equals(avroDeflateCodec.getClass()));
         }
       
       
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroTextOutputFormat.java b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroTextOutputFormat.java
      index 264251a3812..e4743ccddc7 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroTextOutputFormat.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroTextOutputFormat.java
      @@ -38,7 +38,7 @@
       import org.junit.Test;
       
       public class TestAvroTextOutputFormat {
      -  
      +
         private static final String UTF8 = "UTF-8";
       
         @Test
      @@ -52,12 +52,12 @@ public void testAvroTextRecordWriter() throws Exception {
           fileWriter.create(schema, file);
           RecordWriter rw = new AvroTextOutputFormat()
             .new AvroTextRecordWriter(fileWriter, "\t".getBytes(UTF8));
      -    
      +
           rw.write(null, null);
           rw.write(null, NullWritable.get());
           rw.write(NullWritable.get(), null);
           rw.write(NullWritable.get(), NullWritable.get());
      -    
      +
           rw.write("k1", null);
           rw.write("k2", NullWritable.get());
       
      @@ -66,7 +66,7 @@ public void testAvroTextRecordWriter() throws Exception {
       
           rw.write("k3", "v3");
           rw.write(new Text("k4"), new Text("v4"));
      -    
      +
           rw.close(null);
       
           DatumReader reader = new GenericDatumReader();
      @@ -80,7 +80,7 @@ public void testAvroTextRecordWriter() throws Exception {
           assertEquals("k4\tv4", asString(fileReader.next()));
           assertFalse("End", fileReader.hasNext());
         }
      -  
      +
         private String asString(ByteBuffer buf) throws UnsupportedEncodingException {
           byte[] b = new byte[buf.remaining()];
           buf.get(b);
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroTextSort.java b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroTextSort.java
      index 7273bdd461c..17bc18d6ddb 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroTextSort.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestAvroTextSort.java
      @@ -27,7 +27,7 @@
       import org.junit.Test;
       
       public class TestAvroTextSort {
      -  
      +
         @Test
         /**
          * Run the identity job on a "bytes" Avro file using AvroAsTextInputFormat
      @@ -37,19 +37,19 @@ public void testSort() throws Exception {
           JobConf job = new JobConf();
           String dir = System.getProperty("test.dir", ".") + "/mapred";
           Path outputPath = new Path(dir + "/out");
      -    
      +
           outputPath.getFileSystem(job).delete(outputPath);
           WordCountUtil.writeLinesBytesFile();
      -    
      +
           job.setInputFormat(AvroAsTextInputFormat.class);
           job.setOutputFormat(AvroTextOutputFormat.class);
           job.setOutputKeyClass(Text.class);
      -    
      +
           FileInputFormat.setInputPaths(job, new Path(dir + "/in"));
           FileOutputFormat.setOutputPath(job, outputPath);
      -    
      +
           JobClient.runJob(job);
      -    
      +
           WordCountUtil.validateSortedFile();
         }
       
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestGenericJob.java b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestGenericJob.java
      index 5dcbb6ccad9..2c61598b068 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestGenericJob.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestGenericJob.java
      @@ -59,7 +59,7 @@ public class TestGenericJob {
         private static Schema createSchema() {
           List fields = new ArrayList();
       
      -      
      +
           fields.add(new Field("Optional", createArraySchema(), "", new ArrayList()));
       
           Schema recordSchema =
      @@ -73,7 +73,7 @@ private static Schema createArraySchema() {
           for (int i = 0; i < 5; i++) {
             schemas.add(createInnerSchema("optional_field_" + i));
           }
      -        
      +
           Schema unionSchema = Schema.createUnion(schemas);
           return Schema.createArray(unionSchema);
         }
      @@ -96,7 +96,7 @@ public void setup() throws IOException {
           file.writeChars("aa bb cc\ndd ee ff\n");
           file.close();
         }
      -    
      +
         @After
           public void tearDown() throws IOException {
           FileUtil.fullyDelete(new File(dir));
      @@ -106,9 +106,9 @@ static class AvroTestConverter
           extends MapReduceBase
           implements Mapper>, NullWritable> {
      -      
      -    public void map(LongWritable key, Text value, 
      -                    OutputCollector>,NullWritable> out, 
      +
      +    public void map(LongWritable key, Text value,
      +                    OutputCollector>,NullWritable> out,
                           Reporter reporter) throws IOException {
             GenericData.Record optional_entry =
               new GenericData.Record(createInnerSchema("optional_field_1"));
      @@ -124,7 +124,7 @@ public void map(LongWritable key, Text value,
                         (new Pair(key.get(), container)),
                         NullWritable.get());
           }
      -  }  
      +  }
       
       
         @Test
      @@ -132,10 +132,10 @@ public void testJob() throws Exception {
           JobConf job = new JobConf();
           Path outputPath = new Path(dir + "/out");
           outputPath.getFileSystem(job).delete(outputPath);
      -        
      +
           job.setInputFormat(TextInputFormat.class);
           FileInputFormat.setInputPaths(job, dir + "/in");
      -        
      +
           job.setMapperClass(AvroTestConverter.class);
           job.setNumReduceTasks(0);
       
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestReflectJob.java b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestReflectJob.java
      index e8a63f11381..1b6ab685994 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestReflectJob.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestReflectJob.java
      @@ -81,7 +81,7 @@ public void map(Text text, AvroCollector> collector,
                                                      new Count(1L)));
           }
         }
      -  
      +
         public static class ReduceImpl
           extends AvroReducer {
           @Override
      @@ -93,7 +93,7 @@ public void reduce(Text word, Iterable counts,
               sum += count.count;
             collector.collect(new WordCount(word.text, sum));
           }
      -  }    
      +  }
       
         @Test
         @SuppressWarnings("deprecation")
      @@ -107,25 +107,25 @@ public void testJob() throws Exception {
           inputPath.getFileSystem(job).delete(inputPath);
       
           writeLinesFile(new File(dir+"/in"));
      -    
      +
           job.setJobName("reflect");
      -    
      +
           AvroJob.setInputSchema(job, ReflectData.get().getSchema(Text.class));
           AvroJob.setMapOutputSchema
             (job, new Pair(new Text(""), new Count(0L)).getSchema());
           AvroJob.setOutputSchema(job, ReflectData.get().getSchema(WordCount.class));
      -    
      -    AvroJob.setMapperClass(job, MapImpl.class);        
      +
      +    AvroJob.setMapperClass(job, MapImpl.class);
           //AvroJob.setCombinerClass(job, ReduceImpl.class);
           AvroJob.setReducerClass(job, ReduceImpl.class);
      -    
      +
           FileInputFormat.setInputPaths(job, inputPath);
           FileOutputFormat.setOutputPath(job, outputPath);
       
           AvroJob.setReflect(job);                      // use reflection
       
           JobClient.runJob(job);
      -    
      +
           validateCountsFile(new File(new File(dir, "out"), "part-00000.avro"));
         }
       
      @@ -139,7 +139,7 @@ private void writeLinesFile(File dir) throws IOException {
             out.append(new Text(line));
           out.close();
         }
      -  
      +
         private void validateCountsFile(File file) throws Exception {
           DatumReader reader = new ReflectDatumReader();
           InputStream in = new BufferedInputStream(new FileInputStream(file));
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestSequenceFileReader.java b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestSequenceFileReader.java
      index 1a3c966eecf..9d3bda27038 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestSequenceFileReader.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestSequenceFileReader.java
      @@ -104,7 +104,7 @@ public void testSequenceFileInputFormat() throws Exception {
           Path output = new Path(System.getProperty("test.dir",".")+"/seq-out");
       
           output.getFileSystem(job).delete(output);
      -    
      +
           // configure input for Avro from sequence file
           AvroJob.setInputSequenceFile(job);
           FileInputFormat.setInputPaths(job, FILE.toURI().toString());
      @@ -116,7 +116,7 @@ public void testSequenceFileInputFormat() throws Exception {
           // configure output for avro
           AvroJob.setOutputSchema(job, SCHEMA);
           FileOutputFormat.setOutputPath(job, output);
      -    
      +
           JobClient.runJob(job);
       
           checkFile(new DataFileReader>
      @@ -127,9 +127,9 @@ public void testSequenceFileInputFormat() throws Exception {
         private static class NonAvroMapper
           extends MapReduceBase
           implements Mapper,AvroValue> {
      -    
      -    public void map(LongWritable key, Text value, 
      -                  OutputCollector,AvroValue> out, 
      +
      +    public void map(LongWritable key, Text value,
      +                  OutputCollector,AvroValue> out,
                         Reporter reporter) throws IOException {
             out.collect(new AvroKey(key.get()),
                         new AvroValue(new Utf8(value.toString())));
      @@ -142,7 +142,7 @@ public void testNonAvroMapper() throws Exception {
           Path output = new Path(System.getProperty("test.dir",".")+"/seq-out");
       
           output.getFileSystem(job).delete(output);
      -    
      +
           // configure input for non-Avro sequence file
           job.setInputFormat(SequenceFileInputFormat.class);
           FileInputFormat.setInputPaths(job, FILE.toURI().toString());
      @@ -166,9 +166,9 @@ public void testNonAvroMapper() throws Exception {
         private static class NonAvroOnlyMapper
           extends MapReduceBase
           implements Mapper>,NullWritable> {
      -    
      -    public void map(LongWritable key, Text value, 
      -                    OutputCollector>,NullWritable> out, 
      +
      +    public void map(LongWritable key, Text value,
      +                    OutputCollector>,NullWritable> out,
                           Reporter reporter) throws IOException {
             out.collect(new AvroWrapper>(new Pair(key.get(), new Utf8(value.toString()))),
                         NullWritable.get());
      @@ -181,7 +181,7 @@ public void testNonAvroMapOnly() throws Exception {
           Path output = new Path(System.getProperty("test.dir",".")+"/seq-out");
       
           output.getFileSystem(job).delete(output);
      -    
      +
       
           // configure input for non-Avro sequence file
           job.setInputFormat(SequenceFileInputFormat.class);
      @@ -205,9 +205,9 @@ public void testNonAvroMapOnly() throws Exception {
         private static class NonAvroReducer
           extends MapReduceBase
           implements Reducer,AvroValue,LongWritable,Text> {
      -    
      +
           public void reduce(AvroKey key, Iterator> values,
      -                       OutputCollector out, 
      +                       OutputCollector out,
                              Reporter reporter) throws IOException {
             while (values.hasNext()) {
               AvroValue value = values.next();
      @@ -223,7 +223,7 @@ public void testNonAvroReducer() throws Exception {
           Path output = new Path(System.getProperty("test.dir",".")+"/seq-out");
       
           output.getFileSystem(job).delete(output);
      -    
      +
           // configure input for Avro from sequence file
           AvroJob.setInputSequenceFile(job);
           AvroJob.setInputSchema(job, SCHEMA);
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestWeather.java b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestWeather.java
      index c32c403a8e2..49ac89f664b 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestWeather.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestWeather.java
      @@ -68,18 +68,18 @@ public void testMapOnly() throws Exception {
           String inDir = System.getProperty("share.dir","../../../share")+"/test/data";
           Path input = new Path(inDir+"/weather.avro");
           Path output = new Path(System.getProperty("test.dir","target/test")+"/weather-ident");
      -    
      +
           output.getFileSystem(job).delete(output);
      -    
      +
           job.setJobName("identity map weather");
      -    
      +
           AvroJob.setInputSchema(job, Weather.SCHEMA$);
           AvroJob.setOutputSchema(job, Weather.SCHEMA$);
       
           FileInputFormat.setInputPaths(job, input);
           FileOutputFormat.setOutputPath(job, output);
           FileOutputFormat.setCompressOutput(job, true);
      -    
      +
           job.setNumReduceTasks(0);                     // map-only
       
           JobClient.runJob(job);
      @@ -145,24 +145,24 @@ public void testSort() throws Exception {
           String inDir = System.getProperty("share.dir","../../../share")+"/test/data";
           Path input = new Path(inDir+"/weather.avro");
           Path output = new Path(System.getProperty("test.dir","target/test")+"/weather-sort");
      -    
      +
           output.getFileSystem(job).delete(output);
      -    
      +
           job.setJobName("sort weather");
      -    
      +
           AvroJob.setInputSchema(job, Weather.SCHEMA$);
           AvroJob.setMapOutputSchema
             (job, Pair.getPairSchema(Weather.SCHEMA$, Schema.create(Type.NULL)));
           AvroJob.setOutputSchema(job, Weather.SCHEMA$);
      -    
      -    AvroJob.setMapperClass(job, SortMapper.class);        
      +
      +    AvroJob.setMapperClass(job, SortMapper.class);
           AvroJob.setReducerClass(job, SortReducer.class);
       
           FileInputFormat.setInputPaths(job, input);
           FileOutputFormat.setOutputPath(job, output);
           FileOutputFormat.setCompressOutput(job, true);
           AvroJob.setOutputCodec(job, SNAPPY_CODEC);
      -    
      +
           JobClient.runJob(job);
       
           // check output is correct
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestWordCount.java b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestWordCount.java
      index 4e729dc7ed4..a0b61cf737e 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestWordCount.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapred/TestWordCount.java
      @@ -49,7 +49,7 @@ public void map(Utf8 text, AvroCollector> collector,
               collector.collect(new Pair(new Utf8(tokens.nextToken()),1L));
           }
         }
      -  
      +
         public static class ReduceImpl
           extends AvroReducer > {
           @Override
      @@ -61,7 +61,7 @@ public void reduce(Utf8 word, Iterable counts,
               sum += count;
             collector.collect(new Pair(word, sum));
           }
      -  }    
      +  }
       
         @Test public void runTestsInOrder() throws Exception {
           testJob();
      @@ -73,59 +73,59 @@ public void testJob() throws Exception {
           JobConf job = new JobConf();
           String dir = System.getProperty("test.dir", ".") + "/mapred";
           Path outputPath = new Path(dir + "/out");
      -    
      +
           outputPath.getFileSystem(job).delete(outputPath);
           WordCountUtil.writeLinesFile();
      -    
      +
           job.setJobName("wordcount");
      -    
      +
           AvroJob.setInputSchema(job, Schema.create(Schema.Type.STRING));
           AvroJob.setOutputSchema(job,
                                   new Pair(new Utf8(""), 0L).getSchema());
      -    
      -    AvroJob.setMapperClass(job, MapImpl.class);        
      +
      +    AvroJob.setMapperClass(job, MapImpl.class);
           AvroJob.setCombinerClass(job, ReduceImpl.class);
           AvroJob.setReducerClass(job, ReduceImpl.class);
      -    
      +
           FileInputFormat.setInputPaths(job, new Path(dir + "/in"));
           FileOutputFormat.setOutputPath(job, outputPath);
           FileOutputFormat.setCompressOutput(job, true);
      -    
      +
           WordCountUtil.setMeta(job);
       
           JobClient.runJob(job);
      -    
      +
           WordCountUtil.validateCountsFile();
         }
      -  
      +
         @SuppressWarnings("deprecation")
         public void testProjection() throws Exception {
           JobConf job = new JobConf();
      -    
      +
           Integer defaultRank = new Integer(-1);
      -    
      -    String jsonSchema = 
      +
      +    String jsonSchema =
             "{\"type\":\"record\"," +
             "\"name\":\"org.apache.avro.mapred.Pair\","+
      -      "\"fields\": [ " + 
      +      "\"fields\": [ " +
               "{\"name\":\"rank\", \"type\":\"int\", \"default\": -1}," +
      -        "{\"name\":\"value\", \"type\":\"long\"}" + 
      +        "{\"name\":\"value\", \"type\":\"long\"}" +
             "]}";
      -    
      +
           Schema readerSchema = Schema.parse(jsonSchema);
      -    
      +
           AvroJob.setInputSchema(job, readerSchema);
      -    
      +
           String dir = System.getProperty("test.dir", ".") + "/mapred";
           Path inputPath = new Path(dir + "/out" + "/part-00000" + AvroOutputFormat.EXT);
           FileStatus fileStatus = FileSystem.get(job).getFileStatus(inputPath);
           FileSplit fileSplit = new FileSplit(inputPath, 0, fileStatus.getLen(), job);
      -    
      +
           AvroRecordReader> recordReader = new AvroRecordReader>(job, fileSplit);
      -    
      +
           AvroWrapper> inputPair = new AvroWrapper>(null);
           NullWritable ignore = NullWritable.get();
      -    
      +
           long sumOfCounts = 0;
           long numOfCounts = 0;
           while(recordReader.next(inputPair, ignore)) {
      @@ -133,14 +133,14 @@ public void testProjection() throws Exception {
             sumOfCounts += (Long) inputPair.datum().get(1);
             numOfCounts++;
           }
      -    
      +
           Assert.assertEquals(numOfCounts, WordCountUtil.COUNTS.size());
      -    
      +
           long actualSumOfCounts = 0;
           for(Long count : WordCountUtil.COUNTS.values()) {
             actualSumOfCounts += count;
           }
      -    
      +
           Assert.assertEquals(sumOfCounts, actualSumOfCounts);
         }
       
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapred/WordCountUtil.java b/lang/java/mapred/src/test/java/org/apache/avro/mapred/WordCountUtil.java
      index af60f90bec4..8d88bd37705 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapred/WordCountUtil.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapred/WordCountUtil.java
      @@ -104,7 +104,7 @@ public static void writeLinesBytesFile() throws IOException {
             out.append(ByteBuffer.wrap(line.getBytes("UTF-8")));
           out.close();
         }
      -  
      +
         public static void writeLinesTextFile() throws IOException {
           FileUtil.fullyDelete(DIR);
           LINES_FILE.getParentFile().mkdirs();
      @@ -130,7 +130,7 @@ public static void validateCountsFile() throws Exception {
           in.close();
           assertEquals(COUNTS.size(), numWords);
         }
      -  
      +
         public static void validateSortedFile() throws Exception {
           DatumReader reader = new GenericDatumReader();
           InputStream in = new BufferedInputStream(
      @@ -150,12 +150,12 @@ public static void validateSortedFile() throws Exception {
           }
           assertFalse(lines.hasNext());
         }
      -  
      +
         // metadata tests
         private static final String STRING_KEY = "string-key";
         private static final String LONG_KEY = "long-key";
         private static final String BYTES_KEY = "bytes-key";
      -  
      +
         private static final String STRING_META_VALUE = "value";
         private static final long LONG_META_VALUE = 666;
         private static final byte[] BYTES_META_VALUE
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapred/tether/TetherTask.java b/lang/java/mapred/src/test/java/org/apache/avro/mapred/tether/TetherTask.java
      index b551ef91c16..f3eb638e45c 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapred/tether/TetherTask.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapred/tether/TetherTask.java
      @@ -77,7 +77,7 @@ public class Collector {
           private Buffer buffer = new Buffer();
           private BinaryEncoder encoder = new EncoderFactory()
               .configureBlockSize(512).binaryEncoder(buffer, null);
      -    
      +
           private Collector(Schema schema) {
             this.writer = new SpecificDatumWriter(schema);
           }
      @@ -89,7 +89,7 @@ public void collect(T record) throws IOException {
             encoder.flush();
             outputClient.output(buffer.data());
           }
      -    
      +
           /** Collect a pre-partitioned map output value. */
           public void collect(T record, int partition) throws IOException {
             buffer.reset();
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapred/tether/WordCountTask.java b/lang/java/mapred/src/test/java/org/apache/avro/mapred/tether/WordCountTask.java
      index 48cae252e2e..58df52caea4 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapred/tether/WordCountTask.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapred/tether/WordCountTask.java
      @@ -31,7 +31,7 @@
        * functions for word count. */
       public class WordCountTask
         extends TetherTask,Pair> {
      -  
      +
         static final Logger LOG = LoggerFactory.getLogger(WordCountTask.class);
         @Override public void map(Utf8 text, Collector> collector)
           throws IOException {
      @@ -39,14 +39,14 @@ public class WordCountTask
           while (tokens.hasMoreTokens())
             collector.collect(new Pair(new Utf8(tokens.nextToken()),1L));
         }
      -  
      +
         private long sum;
       
         @Override public void reduce(Pair wc,
                                      Collector> c) {
           sum += wc.value();
         }
      -    
      +
         @Override public void reduceFlush(Pair wc, Collector> c)
           throws IOException {
           wc.value(sum);
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroKeyRecordWriter.java b/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroKeyRecordWriter.java
      index a867f02d7bb..a2779a0d54d 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroKeyRecordWriter.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroKeyRecordWriter.java
      @@ -82,7 +82,7 @@ public void testWrite() throws IOException {
       
           dataFileReader.close();
         }
      -  
      +
         @Test
         public void testSycnableWrite() throws IOException {
           Schema writerSchema = Schema.create(Schema.Type.INT);
      @@ -105,20 +105,20 @@ public void testSycnableWrite() throws IOException {
           verify(context);
       
           // Verify that the file was written as expected.
      -	Configuration conf = new Configuration();
      -	conf.set("fs.default.name", "file:///");
      -	Path avroFile = new Path("target/temp.avro");
      -	DataFileReader dataFileReader = new DataFileReader(new FsInput(avroFile,
      -			conf), new SpecificDatumReader());
      +    Configuration conf = new Configuration();
      +    conf.set("fs.default.name", "file:///");
      +    Path avroFile = new Path("target/temp.avro");
      +    DataFileReader dataFileReader = new DataFileReader(new FsInput(avroFile,
      +      conf), new SpecificDatumReader());
       
           dataFileReader.seek(positionTwo);
           assertTrue(dataFileReader.hasNext());  // Record 2.
           assertEquals(2, dataFileReader.next());
       
      -	dataFileReader.seek(positionOne);
      +    dataFileReader.seek(positionOne);
           assertTrue(dataFileReader.hasNext());  // Record 1.
           assertEquals(1, dataFileReader.next());
      -    
      +
           dataFileReader.close();
      -  }  
      +  }
       }
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroKeyValueRecordWriter.java b/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroKeyValueRecordWriter.java
      index 1cd1dedb7d2..2de056fd063 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroKeyValueRecordWriter.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroKeyValueRecordWriter.java
      @@ -168,7 +168,7 @@ keyConverter, valueConverter, new ReflectData(),
           assertEquals("reflectionData", firstRecord.getKey().toString());
           assertEquals(record.attribute, firstRecord.getValue().attribute);
         }
      - 
      +
         @Test
         public void testSyncableWriteRecords() throws IOException {
           Job job = new Job();
      @@ -202,14 +202,14 @@ public void testSyncableWriteRecords() throws IOException {
       
           verify(context);
       
      -	Configuration conf = new Configuration();
      -	conf.set("fs.default.name", "file:///");
      -	Path avroFile = new Path("target/temp.avro");
      -	DataFileReader avroFileReader = new DataFileReader(new FsInput(avroFile,
      -			conf), new SpecificDatumReader());
      -    
      -	
      -	avroFileReader.seek(pointTwo);
      +    Configuration conf = new Configuration();
      +    conf.set("fs.default.name", "file:///");
      +    Path avroFile = new Path("target/temp.avro");
      +    DataFileReader avroFileReader = new DataFileReader(new FsInput(avroFile,
      +      conf), new SpecificDatumReader());
      +
      +
      +    avroFileReader.seek(pointTwo);
           // Verify that the second record was written;
           assertTrue(avroFileReader.hasNext());
           AvroKeyValue secondRecord
      @@ -218,8 +218,8 @@ public void testSyncableWriteRecords() throws IOException {
           assertEquals("banana", secondRecord.getKey().toString());
           assertEquals("banana", secondRecord.getValue().name.toString());
       
      -    
      -	avroFileReader.seek(pointOne);
      +
      +    avroFileReader.seek(pointOne);
           // Verify that the first record was written.
           assertTrue(avroFileReader.hasNext());
           AvroKeyValue firstRecord
      @@ -231,5 +231,5 @@ public void testSyncableWriteRecords() throws IOException {
       
           // That's all, folks.
           avroFileReader.close();
      -  }  
      +  }
       }
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroMultipleOutputs.java b/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroMultipleOutputs.java
      index 83cc8ee44f4..13c7cc10b12 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroMultipleOutputs.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroMultipleOutputs.java
      @@ -59,10 +59,10 @@ public class TestAvroMultipleOutputs {
             Schema.parse("{\"name\":\"stats\",\"type\":\"record\","
                 + "\"fields\":[{\"name\":\"count\",\"type\":\"int\"},"
                 + "{\"name\":\"name\",\"type\":\"string\"}]}");
      -  public static final Schema STATS_SCHEMA_2 = 
      +  public static final Schema STATS_SCHEMA_2 =
             Schema.parse("{\"name\":\"stats\",\"type\":\"record\","
                 + "\"fields\":[{\"name\":\"count1\",\"type\":\"int\"},"
      -          + "{\"name\":\"name1\",\"type\":\"string\"}]}");  
      +          + "{\"name\":\"name1\",\"type\":\"string\"}]}");
       
         private static class LineCountMapper extends Mapper {
           private IntWritable mOne;
      @@ -122,17 +122,17 @@ protected void reduce(Text line, Iterable counts, Context context)
             record.put("name", new Utf8(line.toString()));
             record.put("count", new Integer(sum));
             mStats.datum(record);
      -      context.write(mStats, NullWritable.get()); 
      +      context.write(mStats, NullWritable.get());
             amos.write("myavro",mStats,NullWritable.get());
             record2.put("name1", new Utf8(line.toString()));
             record2.put("count1", new Integer(sum));
      -      mStats.datum(record2); 
      +      mStats.datum(record2);
             amos.write(mStats, NullWritable.get(), STATS_SCHEMA_2, null, "testnewwrite2");
             amos.write("myavro1",mStats);
             amos.write(mStats, NullWritable.get(), STATS_SCHEMA, null, "testnewwrite");
             amos.write(mStats, NullWritable.get(), "testwritenonschema");
           }
      -   
      +
           @Override
           protected void cleanup(Context context) throws IOException,InterruptedException
           {
      @@ -202,9 +202,9 @@ public void testAvroGenericOutput() throws Exception {
           job.setMapOutputValueClass(IntWritable.class);
       
           job.setReducerClass(GenericStatsReducer.class);
      -    AvroJob.setOutputKeySchema(job, STATS_SCHEMA);    
      +    AvroJob.setOutputKeySchema(job, STATS_SCHEMA);
           AvroMultipleOutputs.addNamedOutput(job,"myavro",AvroKeyOutputFormat.class,STATS_SCHEMA,null);
      -    AvroMultipleOutputs.addNamedOutput(job,"myavro1", AvroKeyOutputFormat.class, STATS_SCHEMA_2); 
      +    AvroMultipleOutputs.addNamedOutput(job,"myavro1", AvroKeyOutputFormat.class, STATS_SCHEMA_2);
           job.setOutputFormatClass(AvroKeyOutputFormat.class);
           String dir = System.getProperty("test.dir", ".") + "/mapred";
           Path outputPath = new Path(dir + "/out");
      @@ -244,7 +244,7 @@ public void testAvroGenericOutput() throws Exception {
           Assert.assertEquals(3, counts.get("apple").intValue());
           Assert.assertEquals(2, counts.get("banana").intValue());
           Assert.assertEquals(1, counts.get("carrot").intValue());
      -  
      +
           outputFiles = fileSystem.globStatus(outputPath.suffix("/testnewwrite-r-00000.avro"));
           Assert.assertEquals(1, outputFiles.length);
           reader = new DataFileReader(
      @@ -255,11 +255,11 @@ public void testAvroGenericOutput() throws Exception {
              counts.put(((Utf8) record.get("name")).toString(), (Integer) record.get("count"));
           }
           reader.close();
      -    
      +
           Assert.assertEquals(3, counts.get("apple").intValue());
           Assert.assertEquals(2, counts.get("banana").intValue());
           Assert.assertEquals(1, counts.get("carrot").intValue());
      -        
      +
           outputFiles = fileSystem.globStatus(outputPath.suffix("/testnewwrite2-r-00000.avro"));
           Assert.assertEquals(1, outputFiles.length);
           reader = new DataFileReader(
      @@ -273,7 +273,7 @@ public void testAvroGenericOutput() throws Exception {
           Assert.assertEquals(3, counts.get("apple").intValue());
           Assert.assertEquals(2, counts.get("banana").intValue());
           Assert.assertEquals(1, counts.get("carrot").intValue());
      -    
      +
           outputFiles = fileSystem.globStatus(outputPath.suffix("/testwritenonschema-r-00000.avro"));
           Assert.assertEquals(1, outputFiles.length);
           reader = new DataFileReader(
      @@ -288,8 +288,8 @@ public void testAvroGenericOutput() throws Exception {
           Assert.assertEquals(3, counts.get("apple").intValue());
           Assert.assertEquals(2, counts.get("banana").intValue());
           Assert.assertEquals(1, counts.get("carrot").intValue());
      -    
      -    
      +
      +
         }
       
         @Test
      @@ -312,7 +312,7 @@ public void testAvroSpecificOutput() throws Exception {
           job.setOutputFormatClass(AvroKeyOutputFormat.class);
           String dir = System.getProperty("test.dir", ".") + "/mapred";
           Path outputPath = new Path(dir + "/out-specific");
      -    outputPath.getFileSystem(job.getConfiguration()).delete(outputPath); 
      +    outputPath.getFileSystem(job.getConfiguration()).delete(outputPath);
           FileOutputFormat.setOutputPath(job, outputPath);
       
           Assert.assertTrue(job.waitForCompletion(true));
      diff --git a/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroMultipleOutputsSyncable.java b/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroMultipleOutputsSyncable.java
      index 8298984c3e4..058f73b42ef 100644
      --- a/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroMultipleOutputsSyncable.java
      +++ b/lang/java/mapred/src/test/java/org/apache/avro/mapreduce/TestAvroMultipleOutputsSyncable.java
      @@ -56,10 +56,10 @@ public class TestAvroMultipleOutputsSyncable {
             Schema.parse("{\"name\":\"stats\",\"type\":\"record\","
                 + "\"fields\":[{\"name\":\"count\",\"type\":\"int\"},"
                 + "{\"name\":\"name\",\"type\":\"string\"}]}");
      -  public static final Schema STATS_SCHEMA_2 = 
      +  public static final Schema STATS_SCHEMA_2 =
             Schema.parse("{\"name\":\"stats\",\"type\":\"record\","
                 + "\"fields\":[{\"name\":\"count1\",\"type\":\"int\"},"
      -          + "{\"name\":\"name1\",\"type\":\"string\"}]}");  
      +          + "{\"name\":\"name1\",\"type\":\"string\"}]}");
       
         private static class LineCountMapper extends Mapper {
           private IntWritable mOne;
      @@ -124,14 +124,14 @@ protected void reduce(Text line, Iterable counts, Context context)
             amos.write("myavro",mStats,NullWritable.get());
             record2.put("name1", new Utf8(line.toString()));
             record2.put("count1", new Integer(sum));
      -      mStats.datum(record2); 
      +      mStats.datum(record2);
             amos.write(mStats, NullWritable.get(), STATS_SCHEMA_2, null, "testnewwrite2");
             amos.sync("myavro1","myavro1");
             amos.write("myavro1",mStats);
             amos.write(mStats, NullWritable.get(), STATS_SCHEMA, null, "testnewwrite");
             amos.write(mStats, NullWritable.get(), "testwritenonschema");
           }
      -   
      +
           @Override
           protected void cleanup(Context context) throws IOException,InterruptedException
           {
      @@ -202,9 +202,9 @@ public void testAvroGenericOutput() throws Exception {
           job.setMapOutputValueClass(IntWritable.class);
       
           job.setReducerClass(GenericStatsReducer.class);
      -    AvroJob.setOutputKeySchema(job, STATS_SCHEMA);    
      +    AvroJob.setOutputKeySchema(job, STATS_SCHEMA);
           AvroMultipleOutputs.addNamedOutput(job,"myavro",AvroKeyOutputFormat.class,STATS_SCHEMA,null);
      -    AvroMultipleOutputs.addNamedOutput(job,"myavro1", AvroKeyOutputFormat.class, STATS_SCHEMA_2); 
      +    AvroMultipleOutputs.addNamedOutput(job,"myavro1", AvroKeyOutputFormat.class, STATS_SCHEMA_2);
           job.setOutputFormatClass(AvroKeyOutputFormat.class);
           String dir = System.getProperty("test.dir", ".") + "/mapred";
           Path outputPath = new Path(dir + "/out");
      @@ -244,7 +244,7 @@ public void testAvroGenericOutput() throws Exception {
           Assert.assertEquals(3, counts.get("apple").intValue());
           Assert.assertEquals(2, counts.get("banana").intValue());
           Assert.assertEquals(1, counts.get("carrot").intValue());
      -  
      +
           outputFiles = fileSystem.globStatus(outputPath.suffix("/testnewwrite-r-00000.avro"));
           Assert.assertEquals(1, outputFiles.length);
           reader = new DataFileReader(
      @@ -255,11 +255,11 @@ public void testAvroGenericOutput() throws Exception {
              counts.put(((Utf8) record.get("name")).toString(), (Integer) record.get("count"));
           }
           reader.close();
      -    
      +
           Assert.assertEquals(3, counts.get("apple").intValue());
           Assert.assertEquals(2, counts.get("banana").intValue());
           Assert.assertEquals(1, counts.get("carrot").intValue());
      -        
      +
           outputFiles = fileSystem.globStatus(outputPath.suffix("/testnewwrite2-r-00000.avro"));
           Assert.assertEquals(1, outputFiles.length);
           reader = new DataFileReader(
      @@ -273,7 +273,7 @@ public void testAvroGenericOutput() throws Exception {
           Assert.assertEquals(3, counts.get("apple").intValue());
           Assert.assertEquals(2, counts.get("banana").intValue());
           Assert.assertEquals(1, counts.get("carrot").intValue());
      -    
      +
           outputFiles = fileSystem.globStatus(outputPath.suffix("/testwritenonschema-r-00000.avro"));
           Assert.assertEquals(1, outputFiles.length);
           reader = new DataFileReader(
      @@ -288,8 +288,8 @@ public void testAvroGenericOutput() throws Exception {
           Assert.assertEquals(3, counts.get("apple").intValue());
           Assert.assertEquals(2, counts.get("banana").intValue());
           Assert.assertEquals(1, counts.get("carrot").intValue());
      -    
      -    
      +
      +
         }
       
         @Test
      @@ -312,7 +312,7 @@ public void testAvroSpecificOutput() throws Exception {
           job.setOutputFormatClass(AvroKeyOutputFormat.class);
           String dir = System.getProperty("test.dir", ".") + "/mapred";
           Path outputPath = new Path(dir + "/out-specific");
      -    outputPath.getFileSystem(job.getConfiguration()).delete(outputPath); 
      +    outputPath.getFileSystem(job.getConfiguration()).delete(outputPath);
           FileOutputFormat.setOutputPath(job, outputPath);
       
           Assert.assertTrue(job.waitForCompletion(true));
      diff --git a/lang/java/maven-plugin/pom.xml b/lang/java/maven-plugin/pom.xml
      index 971e5efadab..2003ff21e0d 100644
      --- a/lang/java/maven-plugin/pom.xml
      +++ b/lang/java/maven-plugin/pom.xml
      @@ -40,7 +40,7 @@
         
           1.3
         
      -  
      +
         
           
             
      diff --git a/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java b/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
      index a5d8b311f11..83db1c061d4 100644
      --- a/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
      +++ b/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
      @@ -76,15 +76,15 @@ public abstract class AbstractAvroMojo extends AbstractMojo {
          * A list of files or directories that should be compiled first thus making
          * them importable by subsequently compiled schemas. Note that imported files
          * should not reference each other.
      -   * @parameter 
      +   * @parameter
          */
         protected String[] imports;
      -  
      +
         /**
          * A set of Ant-like exclusion patterns used to prevent certain files from
          * being processed. By default, this set is empty such that no files are
          * excluded.
      -   * 
      +   *
          * @parameter
          */
         protected String[] excludes = new String[0];
      @@ -93,7 +93,7 @@ public abstract class AbstractAvroMojo extends AbstractMojo {
          * A set of Ant-like exclusion patterns used to prevent certain files from
          * being processed. By default, this set is empty such that no files are
          * excluded.
      -   * 
      +   *
          * @parameter
          */
         protected String[] testExcludes = new String[0];
      @@ -124,7 +124,7 @@ public abstract class AbstractAvroMojo extends AbstractMojo {
       
         /**
          * The current Maven project.
      -   * 
      +   *
          * @parameter default-value="${project}"
          * @readonly
          * @required
      @@ -164,11 +164,11 @@ public void execute() throws MojoExecutionException {
                 sourceDirectory.getAbsolutePath(), excludes, getIncludes());
             compileFiles(includedFiles, sourceDirectory, outputDirectory);
           }
      -    
      +
           if (hasImports || hasSourceDir) {
             project.addCompileSourceRoot(outputDirectory.getAbsolutePath());
           }
      -    
      +
           if (hasTestDir) {
             String[] includedFiles = getIncludedFiles(
                 testSourceDirectory.getAbsolutePath(), testExcludes,
      @@ -184,7 +184,7 @@ private String[] getIncludedFiles(String absPath, String[] excludes,
           FileSet fs = new FileSet();
           fs.setDirectory(absPath);
           fs.setFollowSymlinks(false);
      -    
      +
           //exclude imports directory since it has already been compiled.
           if (imports != null) {
             String importExclude = null;
      diff --git a/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/IDLProtocolMojo.java b/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/IDLProtocolMojo.java
      index 0e9ef9cbe45..48f90508bf6 100644
      --- a/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/IDLProtocolMojo.java
      +++ b/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/IDLProtocolMojo.java
      @@ -35,7 +35,7 @@
       
       /**
        * Generate Java classes and interfaces from AvroIDL files (.avdl)
      - * 
      + *
        * @goal idl-protocol
        * @requiresDependencyResolution runtime
        * @phase generate-sources
      @@ -46,16 +46,16 @@ public class IDLProtocolMojo extends AbstractAvroMojo {
          * A set of Ant-like inclusion patterns used to select files from the source
          * directory for processing. By default, the pattern
          * **/*.avdl is used to select IDL files.
      -   * 
      +   *
          * @parameter
          */
         private String[] includes = new String[] { "**/*.avdl" };
      -  
      +
         /**
          * A set of Ant-like inclusion patterns used to select files from the source
          * directory for processing. By default, the pattern
          * **/*.avdl is used to select IDL files.
      -   * 
      +   *
          * @parameter
          */
         private String[] testIncludes = new String[] { "**/*.avdl" };
      diff --git a/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/ProtocolMojo.java b/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/ProtocolMojo.java
      index 461559b24e8..d49ec8c6574 100644
      --- a/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/ProtocolMojo.java
      +++ b/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/ProtocolMojo.java
      @@ -28,7 +28,7 @@
       
       /**
        * Generate Java classes and interfaces from Avro protocol files (.avpr)
      - * 
      + *
        * @goal protocol
        * @phase generate-sources
        * @threadSafe
      @@ -38,7 +38,7 @@ public class ProtocolMojo extends AbstractAvroMojo {
          * A set of Ant-like inclusion patterns used to select files from the source
          * directory for processing. By default, the pattern
          * **/*.avpr is used to select grammar files.
      -   * 
      +   *
          * @parameter
          */
         private String[] includes = new String[] { "**/*.avpr" };
      @@ -47,11 +47,11 @@ public class ProtocolMojo extends AbstractAvroMojo {
          * A set of Ant-like inclusion patterns used to select files from the source
          * directory for processing. By default, the pattern
          * **/*.avpr is used to select grammar files.
      -   * 
      +   *
          * @parameter
          */
         private String[] testIncludes = new String[] { "**/*.avpr" };
      -  
      +
         @Override
         protected void doCompile(String filename, File sourceDirectory, File outputDirectory) throws IOException {
           File src = new File(sourceDirectory, filename);
      diff --git a/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/SchemaMojo.java b/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/SchemaMojo.java
      index 7a7eaf96aab..6fc3d8da5dd 100644
      --- a/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/SchemaMojo.java
      +++ b/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/SchemaMojo.java
      @@ -28,32 +28,32 @@
       
       /**
        * Generate Java classes from Avro schema files (.avsc)
      - * 
      + *
        * @goal schema
        * @phase generate-sources
        * @threadSafe
        */
       public class SchemaMojo extends AbstractAvroMojo {
         /**
      -   * A parser used to parse all schema files. Using a common parser will 
      +   * A parser used to parse all schema files. Using a common parser will
          * facilitate the import of external schemas.
          */
          private Schema.Parser schemaParser = new Schema.Parser();
      -  
      +
          /**
          * A set of Ant-like inclusion patterns used to select files from the source
          * directory for processing. By default, the pattern
          * **/*.avsc is used to select grammar files.
      -   * 
      +   *
          * @parameter
          */
         private String[] includes = new String[] { "**/*.avsc" };
      -  
      +
         /**
          * A set of Ant-like inclusion patterns used to select files from the source
          * directory for processing. By default, the pattern
          * **/*.avsc is used to select grammar files.
      -   * 
      +   *
          * @parameter
          */
         private String[] testIncludes = new String[] { "**/*.avsc" };
      @@ -63,7 +63,7 @@ protected void doCompile(String filename, File sourceDirectory, File outputDirec
           File src = new File(sourceDirectory, filename);
           Schema schema;
       
      -    // This is necessary to maintain backward-compatibility. If there are  
      +    // This is necessary to maintain backward-compatibility. If there are
           // no imported files then isolate the schemas from each other, otherwise
           // allow them to share a single schema so resuse and sharing of schema
           // is possible.
      @@ -72,7 +72,7 @@ protected void doCompile(String filename, File sourceDirectory, File outputDirec
           } else {
             schema = schemaParser.parse(src);
           }
      -    
      +
           SpecificCompiler compiler = new SpecificCompiler(schema);
           compiler.setTemplateDir(templateDirectory);
           compiler.setStringType(StringType.valueOf(stringType));
      diff --git a/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/AbstractAvroMojoTest.java b/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/AbstractAvroMojoTest.java
      index e6f20916e5c..23487814ea9 100644
      --- a/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/AbstractAvroMojoTest.java
      +++ b/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/AbstractAvroMojoTest.java
      @@ -41,7 +41,7 @@ protected void tearDown() throws Exception {
       
         /**
          * Assert the existence files in the given given directory.
      -   * 
      +   *
          * @param directory the directory being checked
          * @param files the files whose existence is being checked.
          */
      diff --git a/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/TestIDLProtocolMojo.java b/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/TestIDLProtocolMojo.java
      index 6442bc843da..9316872849e 100644
      --- a/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/TestIDLProtocolMojo.java
      +++ b/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/TestIDLProtocolMojo.java
      @@ -21,7 +21,7 @@
       
       /**
        * Test the IDL Protocol Mojo.
      - * 
      + *
        * @author saden
        */
       public class TestIDLProtocolMojo extends AbstractAvroMojoTest {
      diff --git a/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/TestProtocolMojo.java b/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/TestProtocolMojo.java
      index 95ebbc64594..342c155f431 100644
      --- a/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/TestProtocolMojo.java
      +++ b/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/TestProtocolMojo.java
      @@ -21,7 +21,7 @@
       
       /**
        * Test the Protocol Mojo.
      - * 
      + *
        * @author saden
        */
       public class TestProtocolMojo extends AbstractAvroMojoTest {
      diff --git a/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/TestSchemaMojo.java b/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/TestSchemaMojo.java
      index 8a47be0f7d4..3e7fe745494 100644
      --- a/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/TestSchemaMojo.java
      +++ b/lang/java/maven-plugin/src/test/java/org/apache/avro/mojo/TestSchemaMojo.java
      @@ -21,7 +21,7 @@
       
       /**
        * Test the Schema Mojo.
      - * 
      + *
        * @author saden
        */
       public class TestSchemaMojo extends AbstractAvroMojoTest {
      diff --git a/lang/java/maven-plugin/src/test/resources/unit/idl/pom.xml b/lang/java/maven-plugin/src/test/resources/unit/idl/pom.xml
      index ec6b9d88bbf..69c504bb35e 100644
      --- a/lang/java/maven-plugin/src/test/resources/unit/idl/pom.xml
      +++ b/lang/java/maven-plugin/src/test/resources/unit/idl/pom.xml
      @@ -28,7 +28,7 @@
         jar
       
         testproject
      - 
      +
         
           
             
      @@ -59,7 +59,7 @@
             org.codehaus.jackson
             jackson-mapper-asl
             1.9.10
      -     
      +    
         
      -    
      +
       
      diff --git a/lang/java/maven-plugin/src/test/resources/unit/protocol/pom.xml b/lang/java/maven-plugin/src/test/resources/unit/protocol/pom.xml
      index 341bb1ab1b4..b484e3dd47a 100644
      --- a/lang/java/maven-plugin/src/test/resources/unit/protocol/pom.xml
      +++ b/lang/java/maven-plugin/src/test/resources/unit/protocol/pom.xml
      @@ -28,7 +28,7 @@
         jar
       
         testproject
      - 
      +
         
           
             
      @@ -59,7 +59,7 @@
             org.codehaus.jackson
             jackson-mapper-asl
             1.9.10
      -     
      +    
         
      -    
      +
       
      diff --git a/lang/java/maven-plugin/src/test/resources/unit/schema/pom.xml b/lang/java/maven-plugin/src/test/resources/unit/schema/pom.xml
      index 0faef29a548..cc000df05ec 100644
      --- a/lang/java/maven-plugin/src/test/resources/unit/schema/pom.xml
      +++ b/lang/java/maven-plugin/src/test/resources/unit/schema/pom.xml
      @@ -18,12 +18,12 @@
       
         4.0.0
      -  
      +
         avro-maven-plugin-test
         jar
       
         testproject
      - 
      +
         
           
             
      @@ -58,7 +58,7 @@
             org.codehaus.jackson
             jackson-mapper-asl
             1.9.10
      -     
      +    
         
      -    
      +
       
      diff --git a/lang/java/pom.xml b/lang/java/pom.xml
      index da6e6e20eea..dd6007b57bf 100644
      --- a/lang/java/pom.xml
      +++ b/lang/java/pom.xml
      @@ -37,7 +37,7 @@
           UTF-8
       
           
      -    
      +
           
      +        because that contains the word count example.-->
           
             ${project.groupId}
             avro-mapred
      diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/BinaryFragmentToJsonTool.java b/lang/java/tools/src/main/java/org/apache/avro/tool/BinaryFragmentToJsonTool.java
      index 14372e09591..32e7999776d 100644
      --- a/lang/java/tools/src/main/java/org/apache/avro/tool/BinaryFragmentToJsonTool.java
      +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/BinaryFragmentToJsonTool.java
      @@ -47,12 +47,12 @@ public int run(InputStream stdin, PrintStream out, PrintStream err,
               .accepts("schema-file", "File containing schema, must not occur with inline schema.")
               .withOptionalArg()
               .ofType(String.class);
      -    
      +
           OptionSet optionSet = optionParser.parse(args.toArray(new String[0]));
           Boolean noPretty = optionSet.has(noPrettyOption);
           List nargs = (List)optionSet.nonOptionArguments();
           String schemaFile = schemaFileOption.value(optionSet);
      -    
      +
           if (nargs.size() != (schemaFile == null ? 2 : 1)) {
             err.println("fragtojson --no-pretty --schema-file  [inline-schema] input-file");
             err.println("   converts Avro fragments to JSON.");
      diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/CatTool.java b/lang/java/tools/src/main/java/org/apache/avro/tool/CatTool.java
      index 1fd10876e52..162a6dea9e9 100644
      --- a/lang/java/tools/src/main/java/org/apache/avro/tool/CatTool.java
      +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/CatTool.java
      @@ -40,17 +40,17 @@
       
       /** Tool to extract samples from an Avro data file. */
       public class CatTool implements Tool {
      -  
      +
         private long totalCopied;
         private double sampleCounter;
      -  
      +
         private GenericRecord reuse;
         private DataFileStream reader;
         private DataFileWriter writer;
         private Schema schema;
         private List inFiles;
         private int currentInput;
      -  
      +
         @Override
         public int run(InputStream in, PrintStream out, PrintStream err,
             List args) throws Exception {
      @@ -64,12 +64,12 @@ public int run(InputStream in, PrintStream out, PrintStream err,
             .accepts("limit", "maximum number of records in the outputfile")
             .withRequiredArg()
             .ofType(Long.class)
      -      .defaultsTo(Long.MAX_VALUE); 
      +      .defaultsTo(Long.MAX_VALUE);
           OptionSpec fracOpt = optParser
             .accepts("samplerate", "rate at which records will be collected")
             .withRequiredArg()
             .ofType(Double.class)
      -      .defaultsTo(new Double(1)); 
      +      .defaultsTo(new Double(1));
       
           OptionSet opts = optParser.parse(args.toArray(new String[0]));
           List nargs = (List)opts.nonOptionArguments();
      @@ -77,7 +77,7 @@ public int run(InputStream in, PrintStream out, PrintStream err,
             printHelp(out);
             return 0;
           }
      -    
      +
           inFiles = Util.getFiles(nargs.subList(0, nargs.size()-1));
       
           System.out.println("List of input files:");
      @@ -86,7 +86,7 @@ public int run(InputStream in, PrintStream out, PrintStream err,
           }
           currentInput = -1;
           nextInput();
      -   
      +
           OutputStream output = out;
           String lastArg = nargs.get(nargs.size()-1);
           if (nargs.size() > 1 && !lastArg.equals("-")) {
      @@ -94,7 +94,7 @@ public int run(InputStream in, PrintStream out, PrintStream err,
           }
           writer = new DataFileWriter(
               new GenericDatumWriter());
      -    
      +
           String codecName = reader.getMetaString(DataFileConstants.CODEC);
           CodecFactory codec = (codecName == null)
               ? CodecFactory.fromString(DataFileConstants.NULL_CODEC)
      @@ -106,14 +106,14 @@ public int run(InputStream in, PrintStream out, PrintStream err,
             }
           }
           writer.create(schema, output);
      -    
      +
           long  offset = opts.valueOf(offsetOpt);
           long limit = opts.valueOf(limitOpt);
           double samplerate = opts.valueOf(fracOpt);
           sampleCounter = 1;
           totalCopied = 0;
           reuse = null;
      -    
      +
           if (limit < 0) {
             System.out.println("limit has to be non-negative");
             this.printHelp(out);
      @@ -133,16 +133,16 @@ public int run(InputStream in, PrintStream out, PrintStream err,
           skip(offset);
           writeRecords(limit, samplerate);
           System.out.println(totalCopied + " records written.");
      -  
      +
           writer.flush();
           writer.close();
           Util.close(out);
           return 0;
         }
      -  
      +
         private void nextInput() throws IOException{
           currentInput++;
      -    Path path = inFiles.get(currentInput); 
      +    Path path = inFiles.get(currentInput);
           FSDataInputStream input = new FSDataInputStream(Util.openFromFS(path));
           reader = new DataFileStream(input, new GenericDatumReader());
           if (schema == null) {                            // if this is the first file, the schema gets saved
      @@ -152,11 +152,11 @@ else if (!schema.equals(reader.getSchema())) {   // subsequent files have to hav
             throw new IOException("schemas dont match");
           }
         }
      -  
      +
         private boolean hasNextInput() {
           return inFiles.size() > (currentInput + 1);
         }
      -  
      +
         /**skips a number of records from the input*/
         private long skip(long skip) throws IOException {
           long skipped = 0;
      @@ -171,7 +171,7 @@ private long skip(long skip) throws IOException {
           }
         return skipped;
       }
      -  
      +
         /** writes records with the given samplerate
          * The record at position offset is guaranteed to be taken*/
         private long writeRecords(long count, double samplerate) throws IOException {
      @@ -188,11 +188,11 @@ private long writeRecords(long count, double samplerate) throws IOException {
           totalCopied = totalCopied + written;
           if (written < count && hasNextInput()) { // goto next file
             nextInput();
      -      written = written + writeRecords(count - written, samplerate);  
      +      written = written + writeRecords(count - written, samplerate);
           }
           return written;
         }
      -  
      +
         private void printHelp(PrintStream out) {
           out.println("cat --offset  --limit  --samplerate  [input-files...] output-file");
           out.println();
      @@ -212,5 +212,5 @@ public String getName() {
         public String getShortDescription() {
           return "extracts samples from files";
         }
      -  
      +
       }
      diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/DataFileGetMetaTool.java b/lang/java/tools/src/main/java/org/apache/avro/tool/DataFileGetMetaTool.java
      index bc9c6f3a3fa..4711d8f9a5f 100644
      --- a/lang/java/tools/src/main/java/org/apache/avro/tool/DataFileGetMetaTool.java
      +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/DataFileGetMetaTool.java
      @@ -45,7 +45,7 @@ public String getShortDescription() {
         @Override
         public int run(InputStream stdin, PrintStream out, PrintStream err,
             List args) throws Exception {
      -    
      +
           OptionParser p = new OptionParser();
           OptionSpec keyOption =
               p.accepts("key", "Metadata key")
      @@ -53,7 +53,7 @@ public int run(InputStream stdin, PrintStream out, PrintStream err,
               .ofType(String.class);
           OptionSet opts = p.parse(args.toArray(new String[0]));
           String keyName = keyOption.value(opts);
      -    
      +
           List nargs = (List)opts.nonOptionArguments();
           if (nargs.size() != 1) {
             err.println("Expected 1 arg: input_file");
      @@ -81,7 +81,7 @@ public int run(InputStream stdin, PrintStream out, PrintStream err,
           }
           return 0;
         }
      -  
      +
         // escape TAB, NL and CR in keys, so that output can be reliably parsed
         static String escapeKey(String key) {
           key = key.replace("\\","\\\\");               // escape backslashes first
      diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/DataFileRepairTool.java b/lang/java/tools/src/main/java/org/apache/avro/tool/DataFileRepairTool.java
      index 0fdd8e5dc1a..c3d31bca41c 100644
      --- a/lang/java/tools/src/main/java/org/apache/avro/tool/DataFileRepairTool.java
      +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/DataFileRepairTool.java
      @@ -45,7 +45,7 @@ public String getName() {
         public String getShortDescription() {
           return "Recovers data from a corrupt Avro Data file";
         }
      -  
      +
         private void printInfo(PrintStream output) {
           output.println("Insufficient arguments.  Arguments:  [-o option] "
               + "input_file output_file \n"
      @@ -101,7 +101,7 @@ public int run(InputStream stdin, PrintStream out, PrintStream err,
             if (args.size() - index < 1) {
               printInfo(err);
               return 1;
      -      } 
      +      }
           }
           if (ALL.equals(option)) {
             return recoverAll(input, args.get(index), out, err);
      @@ -151,7 +151,7 @@ private int recover(String input, String output, PrintStream out,
               } catch (Exception e) {
                 e.printStackTrace(err);
                 return 1;
      -        } 
      +        }
             } else {
               return innerRecover(fileReader, null, out, err, recoverPrior,
                   recoverAfter, null, null);
      @@ -236,7 +236,7 @@ private int innerRecover(DataFileReader fileReader,
                           + (pos));
                       if (lastRecordWasBad) {
                         // consecutive bad record
      -                  err.println("Second consecutive bad record in block: " + numBlocks 
      +                  err.println("Second consecutive bad record in block: " + numBlocks
                             + ". Skipping remainder of block. ");
                         numCorruptRecords += blockRemaining;
                         badRecordsInBlock += blockRemaining;
      @@ -272,7 +272,7 @@ private int innerRecover(DataFileReader fileReader,
                   e2.printStackTrace(err);
                   return 1;
                 }
      -        } 
      +        }
             }
           } finally {
             if (fileWritten) {
      diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/DataFileWriteTool.java b/lang/java/tools/src/main/java/org/apache/avro/tool/DataFileWriteTool.java
      index a8c85e05fd0..bce948e74c9 100644
      --- a/lang/java/tools/src/main/java/org/apache/avro/tool/DataFileWriteTool.java
      +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/DataFileWriteTool.java
      @@ -82,7 +82,7 @@ public int run(InputStream stdin, PrintStream out, PrintStream err,
           Schema schema = (schemafile != null)
               ? Util.parseSchemaFromFS(schemafile)
               : new Schema.Parser().parse(schemastr);
      -    
      +
           DatumReader reader = new GenericDatumReader(schema);
       
           InputStream input = Util.fileOrStdin(nargs.get(0), stdin);
      diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/FromTextTool.java b/lang/java/tools/src/main/java/org/apache/avro/tool/FromTextTool.java
      index 115155e85c2..0026a24d26e 100644
      --- a/lang/java/tools/src/main/java/org/apache/avro/tool/FromTextTool.java
      +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/FromTextTool.java
      @@ -34,13 +34,13 @@
       import org.apache.avro.generic.GenericDatumWriter;
       
       /** Reads a text file into an Avro data file.
      - * 
      + *
        * Can accept a file name, and HDFS file URI, or stdin. Can write to a file
        * name, an HDFS URI, or stdout.*/
       public class FromTextTool implements Tool {
      -  private static final String TEXT_FILE_SCHEMA = 
      +  private static final String TEXT_FILE_SCHEMA =
           "\"bytes\"";
      -  
      +
         @Override
         public String getName() {
           return "fromtext";
      @@ -54,7 +54,7 @@ public String getShortDescription() {
         @Override
         public int run(InputStream stdin, PrintStream out, PrintStream err,
             List args) throws Exception {
      -    
      +
           OptionParser p = new OptionParser();
           OptionSpec level = Util.compressionLevelOption(p);
           OptionSpec codec = Util.compressionCodecOption(p);
      @@ -68,12 +68,12 @@ public int run(InputStream stdin, PrintStream out, PrintStream err,
             p.printHelpOn(err);
             return 1;
           }
      - 
      +
           CodecFactory codecFactory = Util.codecFactory(opts, codec, level);
      -  
      +
           BufferedInputStream inStream = Util.fileOrStdin(nargs.get(0), stdin);
           BufferedOutputStream outStream = Util.fileOrStdout(nargs.get(1), out);
      -    
      +
           DataFileWriter writer =
               new DataFileWriter(new GenericDatumWriter());
           writer.setCodec(codecFactory);
      diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/IdlTool.java b/lang/java/tools/src/main/java/org/apache/avro/tool/IdlTool.java
      index 48352e35588..f3cfe24756c 100644
      --- a/lang/java/tools/src/main/java/org/apache/avro/tool/IdlTool.java
      +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/IdlTool.java
      @@ -57,7 +57,7 @@ public int run(InputStream in, PrintStream out, PrintStream err,
           } else {
             parser = new Idl(in);
           }
      -    
      +
           if (args.size() == 2 && ! "-".equals(args.get(1))) {
             parseOut = new PrintStream(new FileOutputStream(args.get(1)));
           }
      diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/JsonToBinaryFragmentTool.java b/lang/java/tools/src/main/java/org/apache/avro/tool/JsonToBinaryFragmentTool.java
      index ba56cea3b39..1232d2af1bb 100644
      --- a/lang/java/tools/src/main/java/org/apache/avro/tool/JsonToBinaryFragmentTool.java
      +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/JsonToBinaryFragmentTool.java
      @@ -44,11 +44,11 @@ public int run(InputStream stdin, PrintStream out, PrintStream err,
               .accepts("schema-file", "File containing schema, must not occur with inline schema.")
               .withOptionalArg()
               .ofType(String.class);
      -    
      +
           OptionSet optionSet = optionParser.parse(args.toArray(new String[0]));
           List nargs = (List)optionSet.nonOptionArguments();
           String schemaFile = schemaFileOption.value(optionSet);
      -    
      +
           if (nargs.size() != (schemaFile == null ? 2 : 1)) {
             err.println("jsontofrag --schema-file  [inline-schema] input-file");
             err.println("   converts JSON to Avro fragments.");
      @@ -68,12 +68,12 @@ public int run(InputStream stdin, PrintStream out, PrintStream err,
           InputStream input = Util.fileOrStdin(inputFile, stdin);
       
           try {
      -      GenericDatumReader reader = 
      +      GenericDatumReader reader =
                 new GenericDatumReader(schema);
      -    
      -      JsonDecoder jsonDecoder = 
      +
      +      JsonDecoder jsonDecoder =
             DecoderFactory.get().jsonDecoder(schema, input);
      -      GenericDatumWriter writer = 
      +      GenericDatumWriter writer =
                 new GenericDatumWriter(schema);
             Encoder e = EncoderFactory.get().binaryEncoder(out, null);
             Object datum = null;
      diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/RpcReceiveTool.java b/lang/java/tools/src/main/java/org/apache/avro/tool/RpcReceiveTool.java
      index 29eb7389783..aebca552db7 100644
      --- a/lang/java/tools/src/main/java/org/apache/avro/tool/RpcReceiveTool.java
      +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/RpcReceiveTool.java
      @@ -60,7 +60,7 @@ public String getName() {
         public String getShortDescription() {
           return "Opens an RPC Server and listens for one message.";
         }
      -  
      +
         private class SinkResponder extends GenericResponder {
       
           public SinkResponder(Protocol local) {
      @@ -71,7 +71,7 @@ public SinkResponder(Protocol local) {
           public Object respond(Message message, Object request)
           throws AvroRemoteException {
             if (!message.equals(expectedMessage)) {
      -        out.println(String.format("Expected message '%s' but received '%s'.", 
      +        out.println(String.format("Expected message '%s' but received '%s'.",
                   expectedMessage.getName(), message.getName()));
               latch.countDown();
               throw new IllegalArgumentException("Unexpected message.");
      @@ -102,7 +102,7 @@ public void run() {
             return response;
           }
         }
      -  
      +
         @Override
         public int run(InputStream in, PrintStream out, PrintStream err,
             List args) throws Exception {
      @@ -154,16 +154,16 @@ int run1(InputStream in, PrintStream out, PrintStream err,
             err.println("One of -data or -file must be specified.");
             return 1;
           }
      -    
      +
           this.out = out;
      -    
      +
           latch = new CountDownLatch(1);
           server = Ipc.createServer(new SinkResponder(protocol), uri);
           server.start();
           out.println("Port: " + server.getPort());
           return 0;
         }
      -  
      +
         int run2(PrintStream err) throws InterruptedException {
           latch.await();
           err.println("Closing server.");
      diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/RpcSendTool.java b/lang/java/tools/src/main/java/org/apache/avro/tool/RpcSendTool.java
      index 04e729c7927..20a680160c3 100644
      --- a/lang/java/tools/src/main/java/org/apache/avro/tool/RpcSendTool.java
      +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/RpcSendTool.java
      @@ -85,7 +85,7 @@ public int run(InputStream in, PrintStream out, PrintStream err,
                 messageName, protocol));
             return 1;
           }
      -    
      +
           Object datum;
           if (data.value(opts) != null) {
             datum = Util.jsonToGenericDatum(message.getRequest(), data.value(opts));
      @@ -103,7 +103,7 @@ public int run(InputStream in, PrintStream out, PrintStream err,
           return 0;
         }
       
      -  private void dumpJson(PrintStream out, Schema schema, Object datum) 
      +  private void dumpJson(PrintStream out, Schema schema, Object datum)
         throws IOException {
           DatumWriter writer = new GenericDatumWriter(schema);
           JsonGenerator g =
      diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/ToTextTool.java b/lang/java/tools/src/main/java/org/apache/avro/tool/ToTextTool.java
      index 3eebf3b1db0..a36d54c0dbb 100644
      --- a/lang/java/tools/src/main/java/org/apache/avro/tool/ToTextTool.java
      +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/ToTextTool.java
      @@ -33,11 +33,11 @@
       
       /** Reads an avro data file into a plain text file. */
       public class ToTextTool implements Tool {
      -  private static final String TEXT_FILE_SCHEMA = 
      +  private static final String TEXT_FILE_SCHEMA =
               "\"bytes\"";
      -  private static final byte[] LINE_SEPARATOR = 
      +  private static final byte[] LINE_SEPARATOR =
               System.getProperty("line.separator").getBytes();
      -    
      +
         @Override
         public String getName() {
           return "totext";
      @@ -51,7 +51,7 @@ public String getShortDescription() {
         @Override
         public int run(InputStream stdin, PrintStream out, PrintStream err,
             List args) throws Exception {
      -      
      +
           OptionParser p = new OptionParser();
           OptionSet opts = p.parse(args.toArray(new String[0]));
           if (opts.nonOptionArguments().size() != 2) {
      @@ -73,7 +73,7 @@ public int run(InputStream stdin, PrintStream out, PrintStream err,
             fileReader.close();
             return 1;
           }
      -    
      +
           while (fileReader.hasNext()) {
             ByteBuffer outBuff = (ByteBuffer) fileReader.next();
             outStream.write(outBuff.array());
      diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/TrevniMetadataTool.java b/lang/java/tools/src/main/java/org/apache/avro/tool/TrevniMetadataTool.java
      index 361e6f63f20..bbd6fe5d64a 100644
      --- a/lang/java/tools/src/main/java/org/apache/avro/tool/TrevniMetadataTool.java
      +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/TrevniMetadataTool.java
      @@ -64,7 +64,7 @@ public int run(InputStream stdin, PrintStream out, PrintStream err,
             err.println("Usage: [-pretty] input");
             return 1;
           }
      -    
      +
           dump(TrevniUtil.input(filename), out, pretty);
       
           return 0;
      diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/TrevniToJsonTool.java b/lang/java/tools/src/main/java/org/apache/avro/tool/TrevniToJsonTool.java
      index 7ae815a991a..ae629a26e80 100644
      --- a/lang/java/tools/src/main/java/org/apache/avro/tool/TrevniToJsonTool.java
      +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/TrevniToJsonTool.java
      @@ -68,7 +68,7 @@ public int run(InputStream stdin, PrintStream out, PrintStream err,
             err.println("Usage: [-pretty] input");
             return 1;
           }
      -    
      +
           toJson(TrevniUtil.input(filename), out, pretty);
       
           return 0;
      @@ -109,7 +109,7 @@ public void toJson(Input input, PrintStream out, boolean pretty)
           out.println();
           reader.close();
         }
      -  
      +
         private void valueToJson(ColumnMetaData column) throws IOException {
           generator.writeFieldName(shortNames[column.getNumber()]);
           ColumnValues in = values[column.getNumber()];
      @@ -138,7 +138,7 @@ private void valueToJson(ColumnMetaData column) throws IOException {
           }
         }
       
      -  private void primitiveToJson(ColumnMetaData column, Object value) 
      +  private void primitiveToJson(ColumnMetaData column, Object value)
           throws IOException {
           switch (column.getType()) {
           case NULL:
      diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/TrevniUtil.java b/lang/java/tools/src/main/java/org/apache/avro/tool/TrevniUtil.java
      index 9b499573f0a..0158d1ba0c2 100644
      --- a/lang/java/tools/src/main/java/org/apache/avro/tool/TrevniUtil.java
      +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/TrevniUtil.java
      @@ -45,11 +45,11 @@ static Input input(String filename) throws IOException {
             return new InputFile(new File(filename));
           }
         }
      -  
      +
         /**
          * Returns stdin if filename is "-", else opens the local or HDFS file
          * and returns an InputStream for it.
      -   * @throws IOException 
      +   * @throws IOException
          */
         static InputStream input(String filename, InputStream stdin)
           throws IOException {
      @@ -62,13 +62,13 @@ else if (filename.startsWith("hdfs://")) {
             return new BufferedInputStream(new FileInputStream(new File(filename)));
           }
         }
      -  
      +
         /**
          * Returns stdout if filename is "-", else opens the local or HDFS file
          * and returns an OutputStream for it.
      -   * @throws IOException 
      +   * @throws IOException
          */
      -  static OutputStream output(String filename, OutputStream stdout) 
      +  static OutputStream output(String filename, OutputStream stdout)
           throws IOException {
           if (filename.equals("-"))
             return new BufferedOutputStream(stdout);
      diff --git a/lang/java/tools/src/main/java/org/apache/avro/tool/Util.java b/lang/java/tools/src/main/java/org/apache/avro/tool/Util.java
      index 22213af1eeb..708bb41c40f 100644
      --- a/lang/java/tools/src/main/java/org/apache/avro/tool/Util.java
      +++ b/lang/java/tools/src/main/java/org/apache/avro/tool/Util.java
      @@ -51,65 +51,65 @@ class Util {
         /**
          * Returns stdin if filename is "-", else opens the File in the owning filesystem
          * and returns an InputStream for it.
      -   * Relative paths will be opened in the default filesystem. 
      +   * Relative paths will be opened in the default filesystem.
          * @param filename The filename to be opened
      -   * @throws IOException 
      +   * @throws IOException
          */
      -  static BufferedInputStream fileOrStdin(String filename, InputStream stdin) 
      +  static BufferedInputStream fileOrStdin(String filename, InputStream stdin)
             throws IOException {
           return new BufferedInputStream(filename.equals("-")
               ? stdin
      -        : openFromFS(filename));  
      +        : openFromFS(filename));
         }
      -  
      +
         /**
          * Returns stdout if filename is "-", else opens the file from the owning filesystem
          * and returns an OutputStream for it.
      -   * Relative paths will be opened in the default filesystem.  
      +   * Relative paths will be opened in the default filesystem.
          * @param filename The filename to be opened
      -   * @throws IOException 
      +   * @throws IOException
          */
      -  static BufferedOutputStream fileOrStdout(String filename, OutputStream stdout) 
      +  static BufferedOutputStream fileOrStdout(String filename, OutputStream stdout)
             throws IOException {
           return new BufferedOutputStream(filename.equals("-")
               ? stdout
               : createFromFS(filename));
         }
      -  
      +
         /**
          * Returns an InputStream for the file using the owning filesystem,
          * or the default if none is given.
          * @param filename The filename to be opened
      -   * @throws IOException 
      +   * @throws IOException
          */
      -  static InputStream openFromFS(String filename) 
      +  static InputStream openFromFS(String filename)
             throws IOException {
           Path p = new Path(filename);
           return p.getFileSystem(new Configuration()).open(p);
         }
      -  
      +
         /**
          * Returns an InputStream for the file using the owning filesystem,
          * or the default if none is given.
          * @param filename The filename to be opened
      -   * @throws IOException 
      +   * @throws IOException
          */
      -  static InputStream openFromFS(Path filename) 
      +  static InputStream openFromFS(Path filename)
             throws IOException {
           return filename.getFileSystem(new Configuration()).open(filename);
         }
      -  
      +
         /**
      -   * Returns a seekable FsInput using the owning filesystem, 
      +   * Returns a seekable FsInput using the owning filesystem,
          * or the default if none is given.
          * @param filename The filename to be opened
      -   * @throws IOException 
      +   * @throws IOException
          */
      -  static FsInput openSeekableFromFS(String filename) 
      -      throws IOException {       
      +  static FsInput openSeekableFromFS(String filename)
      +      throws IOException {
           return new FsInput(new Path(filename), new Configuration());
         }
      -  
      +
         /**
          * Opens the file for writing in the owning filesystem,
          * or the default if none is given.
      @@ -117,14 +117,14 @@ static FsInput openSeekableFromFS(String filename)
          * @return An OutputStream to the specified file.
          * @throws IOException
          */
      -  static OutputStream createFromFS(String filename) 
      +  static OutputStream createFromFS(String filename)
             throws IOException {
           Path p = new Path(filename);
           return new BufferedOutputStream(p.getFileSystem(new Configuration()).create(p));
         }
      -  
      +
         /**
      -   * Closes the inputstream created from {@link Util.fileOrStdin} 
      +   * Closes the inputstream created from {@link Util.fileOrStdin}
          * unless it is System.in.
          * @param in The inputstream to be closed.
          */
      @@ -137,7 +137,7 @@ static void close(InputStream in) {
             }
           }
         }
      -  
      +
         /**
          * Closes the outputstream created from {@link Util.fileOrStdout}
          * unless it is System.out.
      @@ -152,7 +152,7 @@ static void close(OutputStream out) {
             }
           }
         }
      -  
      +
         /**
          * Parses a schema from the specified file.
          * @param filename The file name to parse
      @@ -172,18 +172,18 @@ static Schema parseSchemaFromFS(String filename) throws IOException {
          * if pathname is a directory, this method returns a list of Pathes to all the files within
          * this directory.
          * Only files inside that directory are included, no subdirectories or files in subdirectories
      -   * will be added. 
      +   * will be added.
          * The List is sorted alphabetically.
          * @param fileOrDirName filename or directoryname
      -   * @return A Path List 
      +   * @return A Path List
          * @throws IOException
          */
      -  static List getFiles(String fileOrDirName) 
      +  static List getFiles(String fileOrDirName)
           throws IOException {
      -    List pathList = new ArrayList();  
      +    List pathList = new ArrayList();
           Path path = new Path(fileOrDirName);
           FileSystem fs = path.getFileSystem(new Configuration());
      -    
      +
           if (fs.isFile(path)) {
             pathList.add(path);
           }
      @@ -197,16 +197,16 @@ else if (fs.getFileStatus(path).isDir()) {
           Collections.sort(pathList);
           return pathList;
         }
      -  
      +
         /**
          * This method returns a list which contains a path to every given file
          * in the input and a path to every file inside a given directory.
          * The list is sorted alphabetically and contains no subdirectories or files within those.
          * @param fileOrDirNames A list of filenames and directorynames
      -   * @return A list of Pathes, one for each file 
      +   * @return A list of Pathes, one for each file
          * @throws IOException
          */
      -  static List getFiles(List fileOrDirNames) 
      +  static List getFiles(List fileOrDirNames)
             throws IOException {
           ArrayList pathList = new ArrayList();
           for(String name : fileOrDirNames) {
      @@ -215,11 +215,11 @@ static List getFiles(List fileOrDirNames)
           Collections.sort(pathList);
           return pathList;
         }
      -  
      -  /** 
      +
      +  /**
          * Converts a String JSON object into a generic datum.
      -   * 
      -   * This is inefficient (creates extra objects), so should be used 
      +   *
      +   * This is inefficient (creates extra objects), so should be used
          * sparingly.
          */
         static Object jsonToGenericDatum(Schema schema, String jsonData)
      diff --git a/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java b/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
      index 9d7fbc82ac9..07a34838f67 100644
      --- a/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
      +++ b/lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java
      @@ -1,9 +1,9 @@
       /**
        * Autogenerated by Avro
      - * 
      + *
        * DO NOT EDIT DIRECTLY
        */
      -package avro.examples.baseball;  
      +package avro.examples.baseball;
       
       import org.apache.avro.specific.SpecificData;
       
      @@ -23,7 +23,7 @@ public class Player extends org.apache.avro.specific.SpecificRecordBase implemen
         /**
          * Default constructor.  Note that this does not initialize fields
          * to their default values from the schema.  If that is desired then
      -   * one should use newBuilder(). 
      +   * one should use newBuilder().
          */
         public Player() {}
       
      @@ -42,7 +42,7 @@ public Player(java.lang.Integer number, java.lang.String first_name, java.lang.S
         }
       
         public org.apache.avro.Schema getSchema() { return SCHEMA$; }
      -  // Used by DatumWriter.  Applications should not call. 
      +  // Used by DatumWriter.  Applications should not call.
         public java.lang.Object get(int field$) {
           switch (field$) {
           case 0: return number;
      @@ -52,7 +52,7 @@ public java.lang.Object get(int field$) {
           default: throw new org.apache.avro.AvroRuntimeException("Bad index");
           }
         }
      -  // Used by DatumReader.  Applications should not call. 
      +  // Used by DatumReader.  Applications should not call.
         @SuppressWarnings(value="unchecked")
         public void put(int field$, java.lang.Object value$) {
           switch (field$) {
      @@ -136,7 +136,7 @@ public void setPosition(java.util.List value) {
         public static avro.examples.baseball.Player.Builder newBuilder() {
           return new avro.examples.baseball.Player.Builder();
         }
      -  
      +
         /**
          * Creates a new Player RecordBuilder by copying an existing Builder.
          * @param other The existing builder to copy.
      @@ -145,7 +145,7 @@ public static avro.examples.baseball.Player.Builder newBuilder() {
         public static avro.examples.baseball.Player.Builder newBuilder(avro.examples.baseball.Player.Builder other) {
           return new avro.examples.baseball.Player.Builder(other);
         }
      -  
      +
         /**
          * Creates a new Player RecordBuilder by copying an existing Player instance.
          * @param other The existing instance to copy.
      @@ -154,7 +154,7 @@ public static avro.examples.baseball.Player.Builder newBuilder(avro.examples.bas
         public static avro.examples.baseball.Player.Builder newBuilder(avro.examples.baseball.Player other) {
           return new avro.examples.baseball.Player.Builder(other);
         }
      -  
      +
         /**
          * RecordBuilder for Player instances.
          */
      @@ -171,7 +171,7 @@ public static class Builder extends org.apache.avro.specific.SpecificRecordBuild
           private Builder() {
             super(SCHEMA$);
           }
      -    
      +
           /**
            * Creates a Builder by copying an existing Builder.
            * @param other The existing Builder to copy.
      @@ -195,7 +195,7 @@ private Builder(avro.examples.baseball.Player.Builder other) {
               fieldSetFlags()[3] = true;
             }
           }
      -    
      +
           /**
            * Creates a Builder by copying an existing Player instance
            * @param other The existing instance to copy.
      @@ -239,7 +239,7 @@ public avro.examples.baseball.Player.Builder setNumber(int value) {
             validate(fields()[0], value);
             this.number = value;
             fieldSetFlags()[0] = true;
      -      return this; 
      +      return this;
           }
       
           /**
      @@ -279,7 +279,7 @@ public avro.examples.baseball.Player.Builder setFirstName(java.lang.String value
             validate(fields()[1], value);
             this.first_name = value;
             fieldSetFlags()[1] = true;
      -      return this; 
      +      return this;
           }
       
           /**
      @@ -318,7 +318,7 @@ public avro.examples.baseball.Player.Builder setLastName(java.lang.String value)
             validate(fields()[2], value);
             this.last_name = value;
             fieldSetFlags()[2] = true;
      -      return this; 
      +      return this;
           }
       
           /**
      @@ -357,7 +357,7 @@ public avro.examples.baseball.Player.Builder setPosition(java.util.ListnewBuilder(). 
      +   * one should use newBuilder().
          */
         public Player() {}
       
      @@ -42,7 +42,7 @@ public Player(java.lang.Integer number, java.lang.CharSequence first_name, java.
         }
       
         public org.apache.avro.Schema getSchema() { return SCHEMA$; }
      -  // Used by DatumWriter.  Applications should not call. 
      +  // Used by DatumWriter.  Applications should not call.
         public java.lang.Object get(int field$) {
           switch (field$) {
           case 0: return number;
      @@ -52,7 +52,7 @@ public java.lang.Object get(int field$) {
           default: throw new org.apache.avro.AvroRuntimeException("Bad index");
           }
         }
      -  // Used by DatumReader.  Applications should not call. 
      +  // Used by DatumReader.  Applications should not call.
         @SuppressWarnings(value="unchecked")
         public void put(int field$, java.lang.Object value$) {
           switch (field$) {
      @@ -136,7 +136,7 @@ public void setPosition(java.util.List value) {
         public static avro.examples.baseball.Player.Builder newBuilder() {
           return new avro.examples.baseball.Player.Builder();
         }
      -  
      +
         /**
          * Creates a new Player RecordBuilder by copying an existing Builder.
          * @param other The existing builder to copy.
      @@ -145,7 +145,7 @@ public static avro.examples.baseball.Player.Builder newBuilder() {
         public static avro.examples.baseball.Player.Builder newBuilder(avro.examples.baseball.Player.Builder other) {
           return new avro.examples.baseball.Player.Builder(other);
         }
      -  
      +
         /**
          * Creates a new Player RecordBuilder by copying an existing Player instance.
          * @param other The existing instance to copy.
      @@ -154,7 +154,7 @@ public static avro.examples.baseball.Player.Builder newBuilder(avro.examples.bas
         public static avro.examples.baseball.Player.Builder newBuilder(avro.examples.baseball.Player other) {
           return new avro.examples.baseball.Player.Builder(other);
         }
      -  
      +
         /**
          * RecordBuilder for Player instances.
          */
      @@ -171,7 +171,7 @@ public static class Builder extends org.apache.avro.specific.SpecificRecordBuild
           private Builder() {
             super(SCHEMA$);
           }
      -    
      +
           /**
            * Creates a Builder by copying an existing Builder.
            * @param other The existing Builder to copy.
      @@ -195,7 +195,7 @@ private Builder(avro.examples.baseball.Player.Builder other) {
               fieldSetFlags()[3] = true;
             }
           }
      -    
      +
           /**
            * Creates a Builder by copying an existing Player instance
            * @param other The existing instance to copy.
      @@ -239,7 +239,7 @@ public avro.examples.baseball.Player.Builder setNumber(int value) {
             validate(fields()[0], value);
             this.number = value;
             fieldSetFlags()[0] = true;
      -      return this; 
      +      return this;
           }
       
           /**
      @@ -279,7 +279,7 @@ public avro.examples.baseball.Player.Builder setFirstName(java.lang.CharSequence
             validate(fields()[1], value);
             this.first_name = value;
             fieldSetFlags()[1] = true;
      -      return this; 
      +      return this;
           }
       
           /**
      @@ -318,7 +318,7 @@ public avro.examples.baseball.Player.Builder setLastName(java.lang.CharSequence
             validate(fields()[2], value);
             this.last_name = value;
             fieldSetFlags()[2] = true;
      -      return this; 
      +      return this;
           }
       
           /**
      @@ -357,7 +357,7 @@ public avro.examples.baseball.Player.Builder setPosition(java.util.List metadata,
           if(type.equals(Schema.Type.STRING)) {
             schema = STRINGSCHEMA;
           }
      -       
      +
           DataFileWriter writer = new DataFileWriter(
                     new GenericDatumWriter(schema));
           for(Entry metadatum : metadata.entrySet()) {
      @@ -111,10 +111,10 @@ private File generateData(String file, Type type, Map metadata,
       
           return inputFile;
         }
      - 
      -  
      +
      +
         private int getFirstIntDatum(File file) throws Exception {
      -    DataFileStream reader = new DataFileStream( new FileInputStream(file) , 
      +    DataFileStream reader = new DataFileStream( new FileInputStream(file) ,
             new GenericDatumReader());
       
           int result = (Integer) reader.next().get(0);
      @@ -166,7 +166,7 @@ public void testCat() throws Exception {
           assertEquals(0, returnCode);
       
           assertEquals(LIMIT_WITHIN_INPUT_BOUNDS, numRowsInFile(output));
      -    
      +
       //    folder input
           args = asList(
             input1.getParentFile().getAbsolutePath(),
      @@ -182,7 +182,7 @@ public void testCat() throws Exception {
           assertEquals(LIMIT_WITHIN_INPUT_BOUNDS, numRowsInFile(output));
         }
       
      -  
      +
         @Test
         public void testLimitOutOfBounds() throws Exception {
           Map metadata = new HashMap();
      @@ -203,9 +203,9 @@ public void testLimitOutOfBounds() throws Exception {
             System.err,
             args);
           assertEquals(0, returnCode);
      -    assertEquals(ROWS_IN_INPUT_FILES - OFFSET, numRowsInFile(output)); 
      +    assertEquals(ROWS_IN_INPUT_FILES - OFFSET, numRowsInFile(output));
         }
      -  
      +
         @Test
         public void testSamplerateAccuracy() throws Exception {
           Map metadata = new HashMap();
      @@ -226,9 +226,9 @@ public void testSamplerateAccuracy() throws Exception {
             System.err,
             args);
           assertEquals(0, returnCode);
      -    
      +
           assertTrue("Outputsize is not roughly (Inputsize - Offset) * samplerate",
      -      (ROWS_IN_INPUT_FILES - OFFSET)*SAMPLERATE - numRowsInFile(output) < 2);    
      +      (ROWS_IN_INPUT_FILES - OFFSET)*SAMPLERATE - numRowsInFile(output) < 2);
           assertTrue("", (ROWS_IN_INPUT_FILES - OFFSET)*SAMPLERATE - numRowsInFile(output) > -2);
         }
       
      @@ -256,7 +256,7 @@ public void testOffSetAccuracy() throws Exception {
           assertEquals("output does not start at offset",
             OFFSET, getFirstIntDatum(output));
         }
      -  
      +
         @Test
         public void testOffsetBiggerThanInput() throws Exception{
           Map metadata = new HashMap();
      @@ -279,7 +279,7 @@ public void testOffsetBiggerThanInput() throws Exception{
           assertEquals("output is not empty",
             0, numRowsInFile(output));
         }
      -  
      +
         @Test
         public void testSamplerateSmallerThanInput() throws Exception{
           Map metadata = new HashMap();
      @@ -300,12 +300,12 @@ public void testSamplerateSmallerThanInput() throws Exception{
             System.err,
             args);
           assertEquals(0, returnCode);
      -    
      +
           assertEquals("output should only contain the record at offset",
             (int) OFFSET, getFirstIntDatum(output));
         }
      -  
      -  
      +
      +
         @Test(expected = IOException.class)
         public void testDifferentSchemasFail() throws Exception {
           Map metadata = new HashMap();
      diff --git a/lang/java/tools/src/test/java/org/apache/avro/tool/TestCreateRandomFileTool.java b/lang/java/tools/src/test/java/org/apache/avro/tool/TestCreateRandomFileTool.java
      index f5c6056fe7d..e752961065b 100644
      --- a/lang/java/tools/src/test/java/org/apache/avro/tool/TestCreateRandomFileTool.java
      +++ b/lang/java/tools/src/test/java/org/apache/avro/tool/TestCreateRandomFileTool.java
      @@ -56,7 +56,7 @@ private byte[] run(List args) throws Exception {
           }
           return baos.toByteArray();
         }
      -  
      +
         public void check(String... extraArgs) throws Exception {
           ArrayList args = new ArrayList();
           args.addAll(Arrays.asList(new String[] {
      @@ -69,7 +69,7 @@ public void check(String... extraArgs) throws Exception {
       
           DataFileReader reader =
             new DataFileReader(OUT_FILE, new GenericDatumReader());
      -    
      +
           Iterator found = reader.iterator();
           for (Object expected :
                  new RandomData(Schema.parse(SCHEMA_FILE), Integer.parseInt(COUNT)))
      @@ -94,11 +94,11 @@ public void testStdOut() throws Exception {
           byte[] file =
             run(Arrays.asList(new String[]
               { "-", "--count", COUNT, "--schema-file", SCHEMA_FILE.toString() }));
      -    
      +
           DataFileStream reader =
             new DataFileStream(new ByteArrayInputStream(file),
                                new GenericDatumReader());
      -    
      +
           Iterator found = reader.iterator();
           for (Object expected :
                  new RandomData(Schema.parse(SCHEMA_FILE), Integer.parseInt(COUNT)))
      diff --git a/lang/java/tools/src/test/java/org/apache/avro/tool/TestDataFileTools.java b/lang/java/tools/src/test/java/org/apache/avro/tool/TestDataFileTools.java
      index 9661e4e4f85..0270b713fcf 100644
      --- a/lang/java/tools/src/test/java/org/apache/avro/tool/TestDataFileTools.java
      +++ b/lang/java/tools/src/test/java/org/apache/avro/tool/TestDataFileTools.java
      @@ -52,7 +52,7 @@ public class TestDataFileTools {
         static String jsonData;
         static Schema schema;
         static File schemaFile;
      -  
      +
         private static final String KEY_NEEDING_ESCAPES = "trn\\\r\t\n";
         private static final String ESCAPED_KEY = "trn\\\\\\r\\t\\n";
       
      @@ -65,7 +65,7 @@ public static void writeSampleFile() throws IOException {
           FileWriter fw = new FileWriter(schemaFile);
           fw.append(schema.toString());
           fw.close();
      -    
      +
           DataFileWriter writer
             = new DataFileWriter(new GenericDatumWriter(schema))
             .setMeta(KEY_NEEDING_ESCAPES, "")
      @@ -80,10 +80,10 @@ public static void writeSampleFile() throws IOException {
       
           writer.flush();
           writer.close();
      -    
      +
           jsonData = builder.toString();
         }
      -  
      +
         private String run(Tool tool, String... args) throws Exception {
           return run(tool, null, args);
         }
      @@ -110,49 +110,49 @@ public void testReadStdin() throws Exception {
           FileInputStream stdin = new FileInputStream(sampleFile);
           assertEquals(jsonData, run(new DataFileReadTool(), stdin, "-"));
         }
      -  
      +
         @Test
         public void testReadToJsonPretty() throws Exception {
           assertEquals(jsonData,
               run(new DataFileReadTool(), "--pretty", sampleFile.getPath()));
         }
      -  
      +
         @Test
         public void testGetMeta() throws Exception {
           String output = run(new DataFileGetMetaTool(), sampleFile.getPath());
           assertTrue(output, output.contains("avro.schema\t"+schema.toString()+"\n"));
           assertTrue(output, output.contains(ESCAPED_KEY+"\t\n"));
         }
      -  
      +
         @Test
         public void testGetMetaForSingleKey() throws Exception {
           assertEquals(schema.toString() + "\n",
               run(new DataFileGetMetaTool(), sampleFile.getPath(), "--key",
                   "avro.schema"));
         }
      -  
      +
         @Test
         public void testGetSchema() throws Exception {
           assertEquals(schema.toString() + "\n",
               run(new DataFileGetSchemaTool(), sampleFile.getPath()));
         }
      -  
      +
         @Test
         public void testWriteWithDeflate() throws Exception {
           testWrite("deflate", Arrays.asList("--codec", "deflate"), "deflate");
         }
      -  
      +
         @Test
         public void testWrite() throws Exception {
           testWrite("plain", Collections.emptyList(), "null");
         }
      -  
      -  public void testWrite(String name, List extra, String expectedCodec) 
      +
      +  public void testWrite(String name, List extra, String expectedCodec)
             throws Exception {
             testWrite(name, extra, expectedCodec, "-schema", schema.toString());
             testWrite(name, extra, expectedCodec, "-schema-file", schemaFile.toString());
         }
      -  public void testWrite(String name, List extra, String expectedCodec, String... extraArgs) 
      +  public void testWrite(String name, List extra, String expectedCodec, String... extraArgs)
         throws Exception {
           File outFile = AvroTestUtil.tempFile(getClass(),
               TestDataFileTools.class + ".testWrite." + name + ".avro");
      @@ -171,7 +171,7 @@ public void testWrite(String name, List extra, String expectedCodec, Str
               args);
           out.close();
           fout.close();
      -    
      +
           // Read it back, and make sure it's valid.
           GenericDatumReader reader = new GenericDatumReader();
           DataFileReader fileReader = new DataFileReader(outFile,reader);
      @@ -188,7 +188,7 @@ public void testWrite(String name, List extra, String expectedCodec, Str
           }
           assertEquals(expectedCodec, codecStr);
         }
      -  
      +
         @Test
         public void testFailureOnWritingPartialJSONValues() throws Exception {
           ByteArrayOutputStream baos = new ByteArrayOutputStream();
      @@ -197,7 +197,7 @@ public void testFailureOnWritingPartialJSONValues() throws Exception {
             new DataFileWriteTool().run(
                 new StringBufferInputStream("{"),
                 new PrintStream(out), // stdout
      -          null, // stderr          
      +          null, // stderr
                 Arrays.asList("-schema", "{ \"type\":\"record\", \"fields\":" +
                               "[{\"name\":\"foo\", \"type\":\"string\"}], " +
                               "\"name\":\"boring\" }", "-"));
      @@ -206,7 +206,7 @@ public void testFailureOnWritingPartialJSONValues() throws Exception {
             // expected
           }
         }
      -  
      +
         @Test
         public void testWritingZeroJsonValues() throws Exception {
           File outFile = writeToAvroFile("zerojsonvalues",
      @@ -214,10 +214,10 @@ public void testWritingZeroJsonValues() throws Exception {
               "");
           assertEquals(0, countRecords(outFile));
         }
      -  
      +
         private int countRecords(File outFile) throws IOException {
           GenericDatumReader reader = new GenericDatumReader();
      -    DataFileReader fileReader = 
      +    DataFileReader fileReader =
             new DataFileReader(outFile,reader);
           int i = 0;
           for (@SuppressWarnings("unused") Object datum : fileReader) {
      @@ -229,12 +229,12 @@ private int countRecords(File outFile) throws IOException {
         @Test
         public void testDifferentSeparatorsBetweenJsonRecords() throws Exception {
           File outFile = writeToAvroFile(
      -        "seperators", 
      -        "{ \"type\":\"array\", \"items\":\"int\" }", 
      +        "seperators",
      +        "{ \"type\":\"array\", \"items\":\"int\" }",
               "[]    [] []\n[][3]     ");
           assertEquals(5, countRecords(outFile));
         }
      -  
      +
         public File writeToAvroFile(String testName, String schema, String json) throws Exception {
           File outFile = AvroTestUtil.tempFile(getClass(),
               TestDataFileTools.class + "." + testName + ".avro");
      @@ -249,5 +249,5 @@ public File writeToAvroFile(String testName, String schema, String json) throws
           fout.close();
           return outFile;
         }
      -  
      +
       }
      diff --git a/lang/java/tools/src/test/java/org/apache/avro/tool/TestJsonToFromBinaryFragmentTools.java b/lang/java/tools/src/test/java/org/apache/avro/tool/TestJsonToFromBinaryFragmentTools.java
      index 557cac9312c..c5e3c975363 100644
      --- a/lang/java/tools/src/test/java/org/apache/avro/tool/TestJsonToFromBinaryFragmentTools.java
      +++ b/lang/java/tools/src/test/java/org/apache/avro/tool/TestJsonToFromBinaryFragmentTools.java
      @@ -37,22 +37,22 @@
       import org.junit.Test;
       
       /**
      - * Tests both {@link JsonToBinaryFragmentTool} 
      + * Tests both {@link JsonToBinaryFragmentTool}
        * and {@link BinaryFragmentToJsonTool}.
        */
       public class TestJsonToFromBinaryFragmentTools {
         private static final String STRING_SCHEMA = Schema.create(Type.STRING).toString();
         private static final String UTF8 = "utf-8";
      -  private static final String AVRO = 
      +  private static final String AVRO =
           "ZLong string implies readable length encoding.";
      -  private static final String JSON = 
      +  private static final String JSON =
           "\"Long string implies readable length encoding.\"\n";
       
         @Test
         public void testBinaryToJson() throws Exception {
           binaryToJson(AVRO, JSON, STRING_SCHEMA);
         }
      -  
      +
         @Test
           public void testJsonToBinary() throws Exception {
           jsonToBinary(JSON, AVRO, STRING_SCHEMA);
      @@ -82,7 +82,7 @@ public void testMultiBinaryToNoPrettyJson() throws Exception {
         public void testBinaryToJsonSchemaFile() throws Exception {
           binaryToJson(AVRO, JSON, "--schema-file", schemaFile());
         }
      -  
      +
         @Test
           public void testJsonToBinarySchemaFile() throws Exception {
           jsonToBinary(JSON, AVRO, "--schema-file", schemaFile());
      @@ -91,7 +91,7 @@ public void testJsonToBinarySchemaFile() throws Exception {
         private void binaryToJson(String avro, String json, String... options) throws Exception {
           ByteArrayOutputStream baos = new ByteArrayOutputStream();
           PrintStream p = new PrintStream(new BufferedOutputStream(baos));
      -    
      +
           List args = new ArrayList();
           args.addAll(Arrays.asList(options));
           args.add("-");
      diff --git a/lang/java/tools/src/test/java/org/apache/avro/tool/TestRpcReceiveAndSendTools.java b/lang/java/tools/src/test/java/org/apache/avro/tool/TestRpcReceiveAndSendTools.java
      index 97e527dd22a..7e381982c9c 100644
      --- a/lang/java/tools/src/test/java/org/apache/avro/tool/TestRpcReceiveAndSendTools.java
      +++ b/lang/java/tools/src/test/java/org/apache/avro/tool/TestRpcReceiveAndSendTools.java
      @@ -27,7 +27,7 @@
       import org.junit.Test;
       
       public class TestRpcReceiveAndSendTools {
      -  
      +
         /**
          * Starts a server (using the tool) and sends a single message to it.
          */
      @@ -38,7 +38,7 @@ public void testServeAndSend() throws Exception {
           ByteArrayOutputStream baos1 = new ByteArrayOutputStream();
           PrintStream p1 = new PrintStream(baos1);
           RpcReceiveTool receive = new RpcReceiveTool();
      -    receive.run1(null, p1, System.err, 
      +    receive.run1(null, p1, System.err,
                        Arrays.asList("http://0.0.0.0:0/",
                                      protocolFile, "hello",
                                      "-data", "\"Hello!\""));
      @@ -47,10 +47,10 @@ public void testServeAndSend() throws Exception {
           RpcSendTool send = new RpcSendTool();
           send.run(null, p2, System.err,
                    Arrays.asList("http://127.0.0.1:"+receive.server.getPort()+"/",
      -                           protocolFile, "hello",  
      +                           protocolFile, "hello",
                                  "-data", "{ \"greeting\": \"Hi!\" }"));
           receive.run2(System.err);
      -    
      +
           assertTrue(baos1.toString("UTF-8").replace("\r", "")
                      .endsWith("hello\t{\"greeting\":\"Hi!\"}\n"));
           assertEquals("\"Hello!\"\n", baos2.toString("UTF-8").replace("\r", ""));
      diff --git a/lang/java/tools/src/test/java/org/apache/avro/tool/TestTextFileTools.java b/lang/java/tools/src/test/java/org/apache/avro/tool/TestTextFileTools.java
      index eee4027ecd9..0e3c5e86ced 100644
      --- a/lang/java/tools/src/test/java/org/apache/avro/tool/TestTextFileTools.java
      +++ b/lang/java/tools/src/test/java/org/apache/avro/tool/TestTextFileTools.java
      @@ -57,7 +57,7 @@ public class TestTextFileTools {
         static ByteBuffer[] lines;
         static Schema schema;
         static File schemaFile;
      -  
      +
         @BeforeClass
         public static void writeRandomFile() throws IOException {
           schema = Schema.create(Type.BYTES);
      @@ -82,7 +82,7 @@ public static void writeRandomFile() throws IOException {
           }
           out.close();
         }
      -  
      +
         private void fromText(String name, String... args) throws Exception {
           File avroFile = AvroTestUtil.tempFile(getClass(), name + ".avro");
       
      @@ -92,7 +92,7 @@ private void fromText(String name, String... args) throws Exception {
           arglist.add(avroFile.toString());
       
           new FromTextTool().run(null, null, null, arglist);
      -    
      +
           // Read it back, and make sure it's valid.
           DataFileReader file = new DataFileReader
             (avroFile, new GenericDatumReader());
      @@ -104,7 +104,7 @@ private void fromText(String name, String... args) throws Exception {
           }
           assertEquals(COUNT, i);
         }
      -  
      +
         @Test
         public void testFromText() throws Exception {
           fromText("null", "--codec", "null");
      @@ -128,7 +128,7 @@ private static void toText(String name) throws Exception {
           arglist.add(outFile.toString());
       
           new ToTextTool().run(null, null, null, arglist);
      -    
      +
           // Read it back, and make sure it's valid.
           InputStream orig = new BufferedInputStream(new FileInputStream(linesFile));
           InputStream after = new BufferedInputStream(new FileInputStream(outFile));
      diff --git a/lang/java/tools/src/test/java/org/apache/avro/tool/TestToTrevniTool.java b/lang/java/tools/src/test/java/org/apache/avro/tool/TestToTrevniTool.java
      index 31f1ab6d597..164acaf7667 100644
      --- a/lang/java/tools/src/test/java/org/apache/avro/tool/TestToTrevniTool.java
      +++ b/lang/java/tools/src/test/java/org/apache/avro/tool/TestToTrevniTool.java
      @@ -50,7 +50,7 @@ private String run(String... args) throws Exception {
           new ToTrevniTool().run(null, p, null, Arrays.asList(args));
           return baos.toString("UTF-8").replace("\r", "");
         }
      -  
      +
         @Test
         public void test() throws Exception {
           Schema schema = Schema.parse(SCHEMA_FILE);
      diff --git a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroColumnReader.java b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroColumnReader.java
      index f7514dbad91..97ee485ca21 100644
      --- a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroColumnReader.java
      +++ b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroColumnReader.java
      @@ -50,7 +50,7 @@ public class AvroColumnReader
         private GenericData model;
         private Schema fileSchema;
         private Schema readSchema;
      -  
      +
         private ColumnValues[] values;
         private int[] arrayWidths;
         private int column;                          // current index in values
      @@ -125,16 +125,16 @@ private void findDefaults(Schema read, Schema write) {
           switch (read.getType()) {
           case NULL: case BOOLEAN:
           case INT: case LONG:
      -    case FLOAT: case DOUBLE: 
      -    case BYTES: case STRING: 
      +    case FLOAT: case DOUBLE:
      +    case BYTES: case STRING:
           case ENUM: case FIXED:
             if (read.getType() != write.getType())
               throw new TrevniRuntimeException("Type mismatch: "+read+" & "+write);
             break;
      -    case MAP: 
      +    case MAP:
             findDefaults(read.getValueType(), write.getValueType());
             break;
      -    case ARRAY: 
      +    case ARRAY:
             findDefaults(read.getElementType(), write.getElementType());
             break;
           case UNION:
      @@ -145,7 +145,7 @@ private void findDefaults(Schema read, Schema write) {
               findDefaults(s, write.getTypes().get(index));
             }
             break;
      -    case RECORD: 
      +    case RECORD:
             for (Field f : read.getFields()) {
               Field g = write.getField(f.name());
               if (g == null)
      @@ -200,7 +200,7 @@ private Object read(Schema s) throws IOException {
           final int startColumn = column;
       
           switch (s.getType()) {
      -    case MAP: 
      +    case MAP:
             int size = values[column].nextLength();
             Map map = (Map)new HashMap(size);
             for (int i = 0; i < size; i++) {
      @@ -211,7 +211,7 @@ private Object read(Schema s) throws IOException {
             }
             column = startColumn + arrayWidths[startColumn];
             return map;
      -    case RECORD: 
      +    case RECORD:
             Object record = model.newRecord(null, s);
             Map rDefaults = defaults.get(s.getFullName());
             for (Field f : s.getFields()) {
      @@ -221,7 +221,7 @@ private Object read(Schema s) throws IOException {
               model.setField(record, f.name(), f.pos(), value);
             }
             return record;
      -    case ARRAY: 
      +    case ARRAY:
             int length = values[column].nextLength();
             List elements = (List)new GenericData.Array(length, s);
             for (int i = 0; i < length; i++) {
      @@ -254,7 +254,7 @@ private Object read(Schema s) throws IOException {
       
         private Object nextValue(Schema s, int column) throws IOException {
           Object v = values[column].nextValue();
      -    
      +
           switch (s.getType()) {
           case ENUM:
             return model.createEnum(s.getEnumSymbols().get((Integer)v), s);
      diff --git a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroColumnWriter.java b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroColumnWriter.java
      index abb5682f70e..caf7fd59316 100644
      --- a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroColumnWriter.java
      +++ b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroColumnWriter.java
      @@ -89,14 +89,14 @@ public void write(D value) throws IOException {
           assert(count == writer.getColumnCount());
           writer.endRow();
         }
      -  
      +
         private int write(Object o, Schema s, int column) throws IOException {
           if (isSimple(s)) {
             writeValue(o, s, column);
             return column+1;
           }
           switch (s.getType()) {
      -    case MAP: 
      +    case MAP:
             Map map = (Map)o;
             writer.writeLength(map.size(), column);
             for (Map.Entry e : map.entrySet()) {
      @@ -106,11 +106,11 @@ private int write(Object o, Schema s, int column) throws IOException {
               assert(c == column+arrayWidths[column]);
             }
             return column+arrayWidths[column];
      -    case RECORD: 
      +    case RECORD:
             for (Field f : s.getFields())
               column = write(model.getField(o,f.name(),f.pos()), f.schema(), column);
             return column;
      -    case ARRAY: 
      +    case ARRAY:
             Collection elements = (Collection)o;
             writer.writeLength(elements.size(), column);
             if (isSimple(s.getElementType())) {         // optimize simple arrays
      @@ -151,7 +151,7 @@ private int write(Object o, Schema s, int column) throws IOException {
       
         private void writeValue(Object value, Schema s, int column)
           throws IOException {
      -    
      +
           switch (s.getType()) {
           case STRING:
             if (value instanceof Utf8)                    // convert Utf8 to String
      @@ -160,7 +160,7 @@ private void writeValue(Object value, Schema s, int column)
           case ENUM:
             if (value instanceof Enum)
               value = ((Enum)value).ordinal();
      -      else 
      +      else
               value = s.getEnumOrdinal(value.toString());
             break;
           case FIXED:
      diff --git a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroColumnator.java b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroColumnator.java
      index 2f9a3efdd89..a546c14a04c 100644
      --- a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroColumnator.java
      +++ b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroColumnator.java
      @@ -71,9 +71,9 @@ private void columnize(String path, Schema s,
           if (seen.containsKey(s))                      // catch recursion
             throw new TrevniRuntimeException("Cannot shred recursive schemas: "+s);
           seen.put(s, s);
      -    
      +
           switch (s.getType()) {
      -    case MAP: 
      +    case MAP:
             path = path == null ? ">" : path+">";
             int start = columns.size();
             ColumnMetaData p = addColumn(path, ValueType.NULL, parent, true);
      @@ -85,7 +85,7 @@ private void columnize(String path, Schema s,
             for (Field field : s.getFields())           // flatten fields to columns
               columnize(p(path, field.name(), "#"), field.schema(), parent, isArray);
             break;
      -    case ARRAY: 
      +    case ARRAY:
             path = path == null ? "[]" : path+"[]";
             addArrayColumn(path, s.getElementType(), parent);
             break;
      @@ -131,7 +131,7 @@ private void addArrayColumn(String path, Schema element,
           // complex array: insert a parent column with lengths
           int start = columns.size();
           ColumnMetaData array = addColumn(path, ValueType.NULL, parent, true);
      -    columnize(path, element, array, false); 
      +    columnize(path, element, array, false);
           arrayWidths.set(start, columns.size()-start); // fixup with actual width
         }
       
      @@ -139,8 +139,8 @@ static boolean isSimple(Schema s) {
           switch (s.getType()) {
           case NULL: case BOOLEAN:
           case INT: case LONG:
      -    case FLOAT: case DOUBLE: 
      -    case BYTES: case STRING: 
      +    case FLOAT: case DOUBLE:
      +    case BYTES: case STRING:
           case ENUM: case FIXED:
             return true;
           default:
      @@ -165,4 +165,4 @@ private ValueType simpleValueType(Schema s) {
           }
         }
       
      -}    
      +}
      diff --git a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroTrevniInputFormat.java b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroTrevniInputFormat.java
      index 47bec01880c..003c2660c0a 100644
      --- a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroTrevniInputFormat.java
      +++ b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroTrevniInputFormat.java
      @@ -79,9 +79,9 @@ protected FileStatus[] listStatus(JobConf job) throws IOException {
             private long row;
       
             public AvroWrapper createKey() { return new AvroWrapper(null); }
      -  
      +
             public NullWritable createValue() { return NullWritable.get(); }
      -    
      +
             public boolean next(AvroWrapper wrapper, NullWritable ignore)
               throws IOException {
               if (!reader.hasNext())
      @@ -90,13 +90,13 @@ public boolean next(AvroWrapper wrapper, NullWritable ignore)
               row++;
               return true;
             }
      -  
      +
             public float getProgress() throws IOException { return row / rows; }
      -  
      +
             public long getPos() throws IOException { return row; }
       
             public void close() throws IOException { reader.close(); }
      -  
      +
           };
       
         }
      diff --git a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroTrevniOutputFormat.java b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroTrevniOutputFormat.java
      index 60b432bfa71..ca711071d37 100644
      --- a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroTrevniOutputFormat.java
      +++ b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/AvroTrevniOutputFormat.java
      @@ -52,7 +52,7 @@ public class AvroTrevniOutputFormat 
       
         /** The file name extension for trevni files. */
         public final static String EXT = ".trv";
      -  
      +
         public static final String META_PREFIX = "trevni.meta.";
       
         /** Add metadata to job output files.*/
      @@ -84,7 +84,7 @@ public static void setMeta(JobConf job, String key, String value) {
       
             private AvroColumnWriter writer =
               new AvroColumnWriter(schema, meta, ReflectData.get());
      -    
      +
             private void flush() throws IOException {
               OutputStream out = fs.create(new Path(dir, "part-"+(part++)+EXT));
               try {
      diff --git a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyInputFormat.java b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyInputFormat.java
      index 89287e65ba2..30d1682502b 100644
      --- a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyInputFormat.java
      +++ b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyInputFormat.java
      @@ -29,28 +29,28 @@
       
       /**
        * An {@link org.apache.hadoop.mapreduce.InputFormat} for Trevni files.
      - * 
      + *
        * This implement was modeled off
        * {@link org.apache.avro.mapreduce.AvroKeyInputFormat} to allow for easy
        * transition
      - * 
      + *
        * A MapReduce InputFormat that can handle Trevni container files.
        *
        * 

      Keys are AvroKey wrapper objects that contain the Trevni data. Since Trevni * container files store only records (not key/value pairs), the value from * this InputFormat is a NullWritable.

      - * + * *

      * A subset schema to be read may be specified with * {@link org.apache.avro.mapreduce.AvroJob#setInputKeySchema}. */ public class AvroTrevniKeyInputFormat extends FileInputFormat, NullWritable> { - + @Override public RecordReader, NullWritable> createRecordReader( InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { - + return new AvroTrevniKeyRecordReader(); } diff --git a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyOutputFormat.java b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyOutputFormat.java index 34354f7cf90..cc1f48f9e0b 100644 --- a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyOutputFormat.java +++ b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyOutputFormat.java @@ -29,17 +29,17 @@ /** An {@link org.apache.hadoop.mapreduce.OutputFormat} that writes Avro data to * Trevni files. * - * This implement was modeled off + * This implement was modeled off * {@link org.apache.avro.mapreduce.AvroKeyOutputFormat} to allow for easy * transition - * + * * FileOutputFormat for writing Trevni container files. * *

      Since Trevni container files only contain records (not key/value pairs), this output * format ignores the value.

      * * @param The (java) type of the Trevni data to write. - * + * *

      Writes a directory of files per task, each comprising a single filesystem * block. To reduce the number of files, increase the default filesystem block * size for the job. Each task also requires enough memory to buffer a @@ -50,7 +50,7 @@ public class AvroTrevniKeyOutputFormat extends FileOutputFormat, @Override public RecordWriter, NullWritable> getRecordWriter(TaskAttemptContext context) throws IOException, InterruptedException { - + return new AvroTrevniKeyRecordWriter(context ); } } diff --git a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyRecordReader.java b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyRecordReader.java index 88f241098f3..4751983e6e2 100644 --- a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyRecordReader.java +++ b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyRecordReader.java @@ -29,10 +29,10 @@ * @param The (java) type of data in Trevni container file. */ public class AvroTrevniKeyRecordReader extends AvroTrevniRecordReaderBase, NullWritable, T> { - + /** A reusable object to hold records of the Avro container file. */ private final AvroKey mCurrentKey = new AvroKey(); - + /** {@inheritDoc} */ @Override public AvroKey getCurrentKey() throws IOException, diff --git a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueInputFormat.java b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueInputFormat.java index c16e38156cc..2fb1b33f1fa 100644 --- a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueInputFormat.java +++ b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueInputFormat.java @@ -28,11 +28,11 @@ /** * An {@link org.apache.hadoop.mapreduce.InputFormat} for Trevni files. - * + * * This implement was modeled off * {@link org.apache.avro.mapreduce.AvroKeyValueInputFormat} to allow for easy * transition - * + * *

      * A MapReduce InputFormat that reads from Trevni container files of key/value generic records. * @@ -43,7 +43,7 @@ * * @param The type of the Trevni key to read. * @param The type of the Trevni value to read. - * + * *

      * A subset schema to be read may be specified with * {@link org.apache.avro.mapreduce.AvroJob#setInputKeySchema} and @@ -56,7 +56,7 @@ public class AvroTrevniKeyValueInputFormat extends FileInputFormat, AvroValue> createRecordReader( InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException { - + return new AvroTrevniKeyValueRecordReader(); } diff --git a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueOutputFormat.java b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueOutputFormat.java index c508df33f4b..9f6b23f7a8b 100644 --- a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueOutputFormat.java +++ b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueOutputFormat.java @@ -28,11 +28,11 @@ /** An {@link org.apache.hadoop.mapreduce.OutputFormat} that writes Avro data to * Trevni files. - * - * This implement was modeled off + * + * This implement was modeled off * {@link org.apache.avro.mapreduce.AvroKeyValueOutputFormat} to allow for easy - * transition - * + * transition + * * * FileOutputFormat for writing Trevni container files of key/value pairs. * *

      Since Trevni container files can only contain records (not key/value pairs), this @@ -46,19 +46,19 @@ * * @param The type of key. If an Avro type, it must be wrapped in an AvroKey. * @param The type of value. If an Avro type, it must be wrapped in an AvroValue. - * + * *

      Writes a directory of files per task, each comprising a single filesystem * block. To reduce the number of files, increase the default filesystem block * size for the job. Each task also requires enough memory to buffer a * filesystem block. */ -public class AvroTrevniKeyValueOutputFormat extends FileOutputFormat, AvroValue> { - +public class AvroTrevniKeyValueOutputFormat extends FileOutputFormat, AvroValue> { + /** {@inheritDoc} */ @Override public RecordWriter, AvroValue> getRecordWriter(TaskAttemptContext context) throws IOException, InterruptedException { - + return new AvroTrevniKeyValueRecordWriter(context ); } } diff --git a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueRecordReader.java b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueRecordReader.java index 3aa956f6a08..31fe3f4af73 100644 --- a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueRecordReader.java +++ b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueRecordReader.java @@ -41,7 +41,7 @@ public class AvroTrevniKeyValueRecordReader extends AvroTrevniRecordReader private final AvroKey mCurrentKey = new AvroKey(); /** The current value the reader is on. */ private final AvroValue mCurrentValue = new AvroValue(); - + /** {@inheritDoc} */ @Override public AvroKey getCurrentKey() throws IOException, diff --git a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueRecordWriter.java b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueRecordWriter.java index 136ef06b57a..90380281bd7 100644 --- a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueRecordWriter.java +++ b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniKeyValueRecordWriter.java @@ -46,16 +46,16 @@ public class AvroTrevniKeyValueRecordWriter extends AvroTrevniRecordWrite /** The writer schema for the generic record entries of the Trevni container file. */ Schema mKeyValuePairSchema; - + /** A reusable Avro generic record for writing key/value pairs to the file. */ AvroKeyValue keyValueRecord; - + /** A helper object that converts the input key to an Avro datum. */ AvroDatumConverter keyConverter; - + /** A helper object that converts the input value to an Avro datum. */ AvroDatumConverter valueConverter; - + /** * Constructor. * @param context The TaskAttempContext to supply the writer with information form the job configuration @@ -63,30 +63,30 @@ public class AvroTrevniKeyValueRecordWriter extends AvroTrevniRecordWrite public AvroTrevniKeyValueRecordWriter(TaskAttemptContext context) throws IOException { super(context); - + mKeyValuePairSchema = initSchema(context); keyValueRecord = new AvroKeyValue(new GenericData.Record(mKeyValuePairSchema)); } - + /** {@inheritDoc} */ @Override public void write(AvroKey key, AvroValue value) throws IOException, InterruptedException { - + keyValueRecord.setKey(key.datum()); keyValueRecord.setValue(value.datum()); writer.write(keyValueRecord.get()); if (writer.sizeEstimate() >= blockSize) // block full flush(); } - + /** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override protected Schema initSchema(TaskAttemptContext context) { AvroDatumConverterFactory converterFactory = new AvroDatumConverterFactory( context.getConfiguration()); - + keyConverter = converterFactory.create((Class) context .getOutputKeyClass()); valueConverter = converterFactory.create((Class) context @@ -95,7 +95,7 @@ protected Schema initSchema(TaskAttemptContext context) { // Create the generic record schema for the key/value pair. return AvroKeyValue.getSchema( keyConverter.getWriterSchema(), valueConverter.getWriterSchema()); - + } - + } diff --git a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniRecordReaderBase.java b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniRecordReaderBase.java index b68669fbf6e..1a3114f1821 100644 --- a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniRecordReaderBase.java +++ b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniRecordReaderBase.java @@ -37,16 +37,16 @@ * @param The type of the entries within the Trevni container file being read. */ public abstract class AvroTrevniRecordReaderBase extends RecordReader { - + /** The Trevni file reader */ private AvroColumnReader reader; - + /** Number of rows in the Trevni file */ private float rows; - + /** The current row number being read in */ private long row; - + /** A reusable object to hold records of the Avro container file. */ private T mCurrentRecord; @@ -60,11 +60,11 @@ public void initialize(InputSplit inputSplit, TaskAttemptContext context) final AvroColumnReader.Params params = new AvroColumnReader.Params(new HadoopInput(file.getPath(), context.getConfiguration())); params.setModel(ReflectData.get()); - + if (AvroJob.getInputKeySchema(context.getConfiguration()) != null) { params.setSchema(AvroJob.getInputKeySchema(context.getConfiguration())); } - + reader = new AvroColumnReader(params); rows = reader.getRowCount(); } @@ -78,7 +78,7 @@ public boolean nextKeyValue() throws IOException, InterruptedException { row++; return true; } - + /** * Gets the current record read from the Trevni container file. * @@ -93,7 +93,7 @@ protected T getCurrentRecord() { /** {@inheritDoc} */ @Override public void close() throws IOException { - reader.close(); + reader.close(); } /** {@inheritDoc} */ diff --git a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniRecordWriterBase.java b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniRecordWriterBase.java index 94a332d4a8e..7f1d57b4210 100644 --- a/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniRecordWriterBase.java +++ b/lang/java/trevni/avro/src/main/java/org/apache/trevni/avro/mapreduce/AvroTrevniRecordWriterBase.java @@ -43,15 +43,15 @@ * @param The type of the entries within the Trevni container file being writen. */ public abstract class AvroTrevniRecordWriterBase extends RecordWriter { - + /** trevni file extension */ public final static String EXT = ".trv"; - + /** prefix of job configs that we care about */ public static final String META_PREFIX = "trevni.meta."; - - /** Counter that increments as new trevni files are create because the current file - * has exceeded the block size + + /** Counter that increments as new trevni files are create because the current file + * has exceeded the block size * */ protected int part = 0; @@ -60,31 +60,31 @@ public abstract class AvroTrevniRecordWriterBase extends RecordWriter(schema, meta, ReflectData.get()); Path outputPath = FileOutputFormat.getOutputPath(context); - + String dir = FileOutputFormat.getUniqueFile(context, "part", ""); dirPath = new Path(outputPath.toString() + "/" + dir); fs = dirPath.getFileSystem(context.getConfiguration()); @@ -97,8 +97,8 @@ public AvroTrevniRecordWriterBase(TaskAttemptContext context) throws IOException * Use the task context to construct a schema for writing * @throws IOException */ - abstract protected Schema initSchema(TaskAttemptContext context); - + abstract protected Schema initSchema(TaskAttemptContext context); + /** * A Trevni flush will close the current file and prep a new writer * @throws IOException @@ -112,14 +112,14 @@ public void flush() throws IOException { } writer = new AvroColumnWriter(schema, meta, ReflectData.get()); } - + /** {@inheritDoc} */ @Override public void close(TaskAttemptContext arg0) throws IOException, InterruptedException { flush(); } - + static ColumnFileMetaData filterMetadata(final Configuration configuration) { final ColumnFileMetaData meta = new ColumnFileMetaData(); Iterator> keyIterator = configuration.iterator(); diff --git a/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/RandomData.java b/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/RandomData.java index 8f5976a5a34..5d43aaeae1f 100644 --- a/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/RandomData.java +++ b/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/RandomData.java @@ -45,7 +45,7 @@ public RandomData(Schema schema, int count) { this.root = schema; this.count = count; } - + public Iterator iterator() { return new Iterator() { private int n; @@ -58,14 +58,14 @@ public Object next() { public void remove() { throw new UnsupportedOperationException(); } }; } - + @SuppressWarnings(value="unchecked") private static Object generate(Schema schema, Random random, int d) { switch (schema.getType()) { case RECORD: GenericRecord record = new GenericData.Record(schema); for (Schema.Field field : schema.getFields()) { - Object value = (field.getJsonProp(USE_DEFAULT) == null) + Object value = (field.getJsonProp(USE_DEFAULT) == null) ? generate(field.schema(), random, d+1) : GenericData.get().getDefaultValue(field); record.put(field.name(), value); diff --git a/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/TestMetadataFiltering.java b/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/TestMetadataFiltering.java index 920eb8953dd..e3b95076514 100644 --- a/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/TestMetadataFiltering.java +++ b/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/TestMetadataFiltering.java @@ -27,15 +27,15 @@ public class TestMetadataFiltering { @Test public void testMetadataFiltering() throws Exception { JobConf job = new JobConf(); - + job.set(AvroTrevniOutputFormat.META_PREFIX + "test1", "1"); job.set(AvroTrevniOutputFormat.META_PREFIX + "test2", "2"); job.set("test3", "3"); job.set(AvroJob.TEXT_PREFIX + "test4", "4"); job.set(AvroTrevniOutputFormat.META_PREFIX + "test5", "5"); - + ColumnFileMetaData metadata = AvroTrevniOutputFormat.filterMetadata(job); - + assertTrue(metadata.get("test1") != null); assertTrue(new String(metadata.get("test1")).equals("1")); assertTrue(metadata.get("test2") != null); @@ -44,7 +44,7 @@ public class TestMetadataFiltering { assertTrue(new String(metadata.get("test5")).equals("5")); assertTrue(metadata.get("test3") == null); assertTrue(metadata.get("test4") == null); - + } - + } diff --git a/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/TestShredder.java b/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/TestShredder.java index 06fdd0939bb..9ca73446dfe 100644 --- a/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/TestShredder.java +++ b/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/TestShredder.java @@ -78,7 +78,7 @@ public class TestShredder { } @Test public void testDefaultValue() throws Exception { - String s = + String s = "{\"type\":\"record\",\"name\":\"R\",\"fields\":[" +SIMPLE_FIELDS+"," +"{\"name\":\"z\",\"type\":\"int\"," @@ -89,7 +89,7 @@ public class TestShredder { } @Test public void testNestedRecord() throws Exception { - String s = + String s = "{\"type\":\"record\",\"name\":\"S\",\"fields\":[" +"{\"name\":\"x\",\"type\":\"int\"}," +"{\"name\":\"R\",\"type\":"+SIMPLE_RECORD+"}," @@ -103,25 +103,25 @@ public class TestShredder { } @Test public void testNamedRecord() throws Exception { - String s = - "{\"type\":\"record\",\"name\":\"S\",\"fields\":[" - +"{\"name\":\"R1\",\"type\":"+SIMPLE_RECORD+"}," - +"{\"name\":\"R2\",\"type\":\"R\"}" - +"]}"; - check(Schema.parse(s), - new ColumnMetaData("R1#x", ValueType.INT), - new ColumnMetaData("R1#y", ValueType.STRING), - new ColumnMetaData("R2#x", ValueType.INT), - new ColumnMetaData("R2#y", ValueType.STRING)); - } - + String s = + "{\"type\":\"record\",\"name\":\"S\",\"fields\":[" + +"{\"name\":\"R1\",\"type\":"+SIMPLE_RECORD+"}," + +"{\"name\":\"R2\",\"type\":\"R\"}" + +"]}"; + check(Schema.parse(s), + new ColumnMetaData("R1#x", ValueType.INT), + new ColumnMetaData("R1#y", ValueType.STRING), + new ColumnMetaData("R2#x", ValueType.INT), + new ColumnMetaData("R2#y", ValueType.STRING)); + } + @Test public void testSimpleArray() throws Exception { String s = "{\"type\":\"array\",\"items\":\"long\"}"; check(Schema.parse(s), new ColumnMetaData("[]", ValueType.LONG).isArray(true)); } - private static final String RECORD_ARRAY = + private static final String RECORD_ARRAY = "{\"type\":\"array\",\"items\":"+SIMPLE_RECORD+"}"; @Test public void testArray() throws Exception { @@ -157,7 +157,7 @@ public class TestShredder { } @Test public void testNestedArray() throws Exception { - String s = + String s = "{\"type\":\"record\",\"name\":\"S\",\"fields\":[" +"{\"name\":\"x\",\"type\":\"int\"}," +"{\"name\":\"A\",\"type\":"+RECORD_ARRAY+"}," @@ -173,7 +173,7 @@ public class TestShredder { } @Test public void testNestedUnion() throws Exception { - String s = + String s = "{\"type\":\"record\",\"name\":\"S\",\"fields\":[" +"{\"name\":\"x\",\"type\":\"int\"}," +"{\"name\":\"u\",\"type\":"+UNION+"}," @@ -190,7 +190,7 @@ public class TestShredder { } @Test public void testUnionInArray() throws Exception { - String s = + String s = "{\"type\":\"record\",\"name\":\"S\",\"fields\":[" +"{\"name\":\"a\",\"type\":{\"type\":\"array\",\"items\":"+UNION+"}}" +"]}"; @@ -209,7 +209,7 @@ public class TestShredder { } @Test public void testArrayInUnion() throws Exception { - String s = + String s = "{\"type\":\"record\",\"name\":\"S\",\"fields\":[" +"{\"name\":\"a\",\"type\":[\"int\","+RECORD_ARRAY+"]}]}"; ColumnMetaData q = new ColumnMetaData("a/array",ValueType.NULL) diff --git a/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/TestWordCount.java b/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/TestWordCount.java index d928a9fe2ac..79a8fffb389 100644 --- a/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/TestWordCount.java +++ b/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/TestWordCount.java @@ -62,7 +62,7 @@ public void map(String text, AvroCollector> collector, collector.collect(new Pair(tokens.nextToken(),1L)); } } - + public static class ReduceImpl extends AvroReducer > { @Override @@ -74,7 +74,7 @@ public void reduce(String word, Iterable counts, sum += count; collector.collect(new Pair(word, sum)); } - } + } @Test public void runTestsInOrder() throws Exception { testOutputFormat(); @@ -87,26 +87,26 @@ public void reduce(String word, Iterable counts, public void testOutputFormat() throws Exception { JobConf job = new JobConf(); - + WordCountUtil wordCountUtil = new WordCountUtil("trevniMapredTest"); - + wordCountUtil.writeLinesFile(); - + AvroJob.setInputSchema(job, STRING); AvroJob.setOutputSchema(job, Pair.getPairSchema(STRING,LONG)); - - AvroJob.setMapperClass(job, MapImpl.class); + + AvroJob.setMapperClass(job, MapImpl.class); AvroJob.setCombinerClass(job, ReduceImpl.class); AvroJob.setReducerClass(job, ReduceImpl.class); - + FileInputFormat.setInputPaths(job, new Path(wordCountUtil.getDir().toString() + "/in")); FileOutputFormat.setOutputPath(job, new Path(wordCountUtil.getDir().toString() + "/out")); FileOutputFormat.setCompressOutput(job, true); - + job.setOutputFormat(AvroTrevniOutputFormat.class); JobClient.runJob(job); - + wordCountUtil.validateCountsFile(); } @@ -118,20 +118,20 @@ public static class Counter extends AvroMapper { total += (Long)r.get("value"); } } - + public void testInputFormat() throws Exception { JobConf job = new JobConf(); WordCountUtil wordCountUtil = new WordCountUtil("trevniMapredTest"); - - + + Schema subSchema = Schema.parse("{\"type\":\"record\"," + "\"name\":\"PairValue\","+ - "\"fields\": [ " + - "{\"name\":\"value\", \"type\":\"long\"}" + + "\"fields\": [ " + + "{\"name\":\"value\", \"type\":\"long\"}" + "]}"); AvroJob.setInputSchema(job, subSchema); - AvroJob.setMapperClass(job, Counter.class); + AvroJob.setMapperClass(job, Counter.class); FileInputFormat.setInputPaths(job, new Path(wordCountUtil.getDir().toString() + "/out/*")); job.setInputFormat(AvroTrevniInputFormat.class); diff --git a/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/WordCountUtil.java b/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/WordCountUtil.java index 68af7a3915a..775992aa076 100644 --- a/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/WordCountUtil.java +++ b/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/WordCountUtil.java @@ -60,13 +60,13 @@ public class WordCountUtil { public WordCountUtil (String testName) { this(testName, "part-00000"); } - + public WordCountUtil (String testName, String partDirName) { dir = new File("target/wc", testName); linesFiles = new File(new File(dir, "in"), "lines.avro"); countFiles = new File(new File(dir, "out"), partDirName + "/part-0.trv"); } - + public static final String[] LINES = new String[] { "the quick brown fox jumps over the lazy dog", "the cow jumps over the moon", @@ -93,7 +93,7 @@ public WordCountUtil (String testName, String partDirName) { public File getDir() { return dir; } - + public void writeLinesFile() throws IOException { FileUtil.fullyDelete(dir); DatumWriter writer = new GenericDatumWriter(); @@ -117,7 +117,7 @@ public void validateCountsFile() throws Exception { reader.close(); assertEquals(COUNTS.size(), numWords); } - + public void validateCountsFileGenericRecord() throws Exception { AvroColumnReader reader = new AvroColumnReader diff --git a/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/mapreduce/TestKeyValueWordCount.java b/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/mapreduce/TestKeyValueWordCount.java index deea1ca1d0a..47cbee461e8 100644 --- a/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/mapreduce/TestKeyValueWordCount.java +++ b/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/mapreduce/TestKeyValueWordCount.java @@ -43,13 +43,13 @@ import org.junit.Test; public class TestKeyValueWordCount { - + private static long total = 0; static final Schema STRING = Schema.create(Schema.Type.STRING); static { GenericData.setStringType(STRING, GenericData.StringType.String); } static final Schema LONG = Schema.create(Schema.Type.LONG); - + private static class WordCountMapper extends Mapper, NullWritable, Text, LongWritable> { private LongWritable mCount = new LongWritable(); @@ -76,12 +76,12 @@ protected void map(AvroKey key, NullWritable value, Context context) } } - + private static class WordCountReducer extends Reducer< Text, LongWritable, AvroKey, AvroValue> { - + AvroKey resultKey = new AvroKey(); AvroValue resultValue = new AvroValue(); - + @Override protected void reduce(Text key, Iterable values, Context context) throws IOException, InterruptedException { long sum = 0; @@ -90,11 +90,11 @@ protected void reduce(Text key, Iterable values, Context context) } resultKey.datum(key.toString()); resultValue.datum(sum); - + context.write(resultKey, resultValue); } } - + public static class Counter extends Mapper, AvroValue, NullWritable, NullWritable> { @Override @@ -102,8 +102,8 @@ protected void map(AvroKey key, AvroValue value, Context context) throws IOException, InterruptedException { total += value.datum(); } - } - + } + @Test public void testIOFormat() throws Exception { checkOutputFormat(); checkInputFormat(); @@ -111,49 +111,49 @@ protected void map(AvroKey key, AvroValue value, Context context) public void checkOutputFormat() throws Exception { Job job = new Job(); - + WordCountUtil wordCountUtil = new WordCountUtil("trevniMapReduceKeyValueTest", "part-r-00000"); - + wordCountUtil.writeLinesFile(); - + AvroJob.setInputKeySchema(job, STRING); AvroJob.setOutputKeySchema(job, STRING); AvroJob.setOutputValueSchema(job, LONG); - + job.setMapperClass(WordCountMapper.class); job.setReducerClass(WordCountReducer.class); - + job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(LongWritable.class); - + FileInputFormat.setInputPaths(job, new Path(wordCountUtil.getDir().toString() + "/in")); FileOutputFormat.setOutputPath(job, new Path(wordCountUtil.getDir().toString() + "/out")); FileOutputFormat.setCompressOutput(job, true); - + job.setInputFormatClass(AvroKeyInputFormat.class); job.setOutputFormatClass(AvroTrevniKeyValueOutputFormat.class); job.waitForCompletion(true); - + wordCountUtil.validateCountsFileGenericRecord(); } - + public void checkInputFormat() throws Exception { Job job = new Job(); - + WordCountUtil wordCountUtil = new WordCountUtil("trevniMapReduceKeyValueTest"); - + job.setMapperClass(Counter.class); - + FileInputFormat.setInputPaths(job, new Path(wordCountUtil.getDir().toString() + "/out/*")); job.setInputFormatClass(AvroTrevniKeyValueInputFormat.class); - + job.setNumReduceTasks(0); job.setOutputFormatClass(NullOutputFormat.class); - + total = 0; job.waitForCompletion(true); assertEquals(WordCountUtil.TOTAL, total); - + } } diff --git a/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/mapreduce/TestKeyWordCount.java b/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/mapreduce/TestKeyWordCount.java index 8623fb49fcb..1ba50ff24c8 100644 --- a/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/mapreduce/TestKeyWordCount.java +++ b/lang/java/trevni/avro/src/test/java/org/apache/trevni/avro/mapreduce/TestKeyWordCount.java @@ -45,14 +45,14 @@ import org.junit.Test; public class TestKeyWordCount { - + private static long total = 0; static final Schema STRING = Schema.create(Schema.Type.STRING); static { GenericData.setStringType(STRING, GenericData.StringType.String); } static final Schema LONG = Schema.create(Schema.Type.LONG); - - + + private static class WordCountMapper extends Mapper, NullWritable, Text, LongWritable> { private LongWritable mCount = new LongWritable(); @@ -79,33 +79,33 @@ protected void map(AvroKey key, NullWritable value, Context context) } } - + private static class WordCountReducer extends Reducer< Text, LongWritable, AvroKey, NullWritable> { - + private AvroKey result ; - + @Override protected void setup(Context context) { result = new AvroKey(); result.datum(new Record(Pair.getPairSchema(STRING,LONG))); } - + @Override protected void reduce(Text key, Iterable values, Context context) throws IOException, InterruptedException { long count = 0; for (LongWritable value: values) { count += value.get(); } - + result.datum().put("key", key.toString()); result.datum().put("value", count); - + context.write(result, NullWritable.get()); } } - - + + public static class Counter extends Mapper, NullWritable, NullWritable, NullWritable> { @Override @@ -114,8 +114,8 @@ protected void map(AvroKey key, NullWritable value, Context total += (Long)key.datum().get("value"); } } - - + + @Test public void testIOFormat() throws Exception { checkOutputFormat(); checkInputFormat(); @@ -123,56 +123,56 @@ protected void map(AvroKey key, NullWritable value, Context public void checkOutputFormat() throws Exception { Job job = new Job(); - + WordCountUtil wordCountUtil = new WordCountUtil("trevniMapReduceKeyTest", "part-r-00000"); - + wordCountUtil.writeLinesFile(); - + AvroJob.setInputKeySchema(job, STRING); AvroJob.setOutputKeySchema(job, Pair.getPairSchema(STRING,LONG)); - + job.setMapperClass(WordCountMapper.class); job.setReducerClass(WordCountReducer.class); - + job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(LongWritable.class); - + FileInputFormat.setInputPaths(job, new Path(wordCountUtil.getDir().toString() + "/in")); FileOutputFormat.setOutputPath(job, new Path(wordCountUtil.getDir().toString() + "/out")); FileOutputFormat.setCompressOutput(job, true); - + job.setInputFormatClass(AvroKeyInputFormat.class); job.setOutputFormatClass(AvroTrevniKeyOutputFormat.class); job.waitForCompletion(true); - + wordCountUtil.validateCountsFile(); } - + public void checkInputFormat() throws Exception { Job job = new Job(); - + WordCountUtil wordCountUtil = new WordCountUtil("trevniMapReduceKeyTest"); - + job.setMapperClass(Counter.class); Schema subSchema = Schema.parse("{\"type\":\"record\"," + "\"name\":\"PairValue\","+ - "\"fields\": [ " + - "{\"name\":\"value\", \"type\":\"long\"}" + + "\"fields\": [ " + + "{\"name\":\"value\", \"type\":\"long\"}" + "]}"); AvroJob.setInputKeySchema(job, subSchema); - + FileInputFormat.setInputPaths(job, new Path(wordCountUtil.getDir().toString() + "/out/*")); job.setInputFormatClass(AvroTrevniKeyInputFormat.class); - + job.setNumReduceTasks(0); job.setOutputFormatClass(NullOutputFormat.class); - + total = 0; job.waitForCompletion(true); assertEquals(WordCountUtil.TOTAL, total); - + } - + } diff --git a/lang/java/trevni/core/pom.xml b/lang/java/trevni/core/pom.xml index c5004442c99..42e73e75626 100644 --- a/lang/java/trevni/core/pom.xml +++ b/lang/java/trevni/core/pom.xml @@ -37,7 +37,7 @@ snappy-java ${snappy.version} compile - + org.apache.commons commons-compress diff --git a/lang/java/trevni/core/src/main/java/org/apache/trevni/BZip2Codec.java b/lang/java/trevni/core/src/main/java/org/apache/trevni/BZip2Codec.java index 1c0d64bca19..9513ed4678d 100644 --- a/lang/java/trevni/core/src/main/java/org/apache/trevni/BZip2Codec.java +++ b/lang/java/trevni/core/src/main/java/org/apache/trevni/BZip2Codec.java @@ -29,7 +29,7 @@ public class BZip2Codec extends Codec { private ByteArrayOutputStream outputBuffer; public static final int DEFAULT_BUFFER_SIZE = 64 * 1024; - + @Override ByteBuffer compress(ByteBuffer uncompressedData) throws IOException { ByteArrayOutputStream baos = getOutputBuffer(uncompressedData.remaining()); @@ -55,23 +55,23 @@ ByteBuffer decompress(ByteBuffer compressedData) throws IOException { byte[] buffer = new byte[DEFAULT_BUFFER_SIZE]; int readCount = -1; - + while ( (readCount = inputStream.read(buffer, compressedData.position(), buffer.length))> 0) { baos.write(buffer, 0, readCount); } - + ByteBuffer result = ByteBuffer.wrap(baos.toByteArray()); return result; } finally { inputStream.close(); } } - + private ByteArrayOutputStream getOutputBuffer(int suggestedLength) { if (null == outputBuffer) outputBuffer = new ByteArrayOutputStream(suggestedLength); outputBuffer.reset(); return outputBuffer; } - + } diff --git a/lang/java/trevni/core/src/main/java/org/apache/trevni/BlockDescriptor.java b/lang/java/trevni/core/src/main/java/org/apache/trevni/BlockDescriptor.java index 5f2c0f32611..cbb15bd11bd 100644 --- a/lang/java/trevni/core/src/main/java/org/apache/trevni/BlockDescriptor.java +++ b/lang/java/trevni/core/src/main/java/org/apache/trevni/BlockDescriptor.java @@ -25,13 +25,13 @@ class BlockDescriptor { int compressedSize; BlockDescriptor() {} - + BlockDescriptor(int rowCount, int uncompressedSize, int compressedSize) { this.rowCount = rowCount; this.uncompressedSize = uncompressedSize; this.compressedSize = compressedSize; } - + public void writeTo(OutputBuffer out) throws IOException { out.writeFixed32(rowCount); out.writeFixed32(uncompressedSize); diff --git a/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnDescriptor.java b/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnDescriptor.java index 6a052d19c28..3cbabac51d5 100644 --- a/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnDescriptor.java +++ b/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnDescriptor.java @@ -76,7 +76,7 @@ public void ensureBlocksRead() throws IOException { firstValues[i] = in.readValue(metaData.getType()); } dataStart = in.tell(); - + // compute blockStarts and firstRows Checksum checksum = Checksum.get(metaData); blockStarts = new long[blocks.length]; diff --git a/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnFileReader.java b/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnFileReader.java index ec080b8afa5..cb475f54a21 100644 --- a/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnFileReader.java +++ b/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnFileReader.java @@ -131,7 +131,7 @@ private void readColumnStarts(InputBuffer in) throws IOException { for (int i = 0; i < columnCount; i++) columns[i].start = in.readFixed64(); } - + /** Return an iterator over values in the named column. */ public ColumnValues getValues(String columnName) throws IOException { diff --git a/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnFileWriter.java b/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnFileWriter.java index 0f4a21ed9e8..5eb92aad471 100644 --- a/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnFileWriter.java +++ b/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnFileWriter.java @@ -68,7 +68,7 @@ private void checkColumns(ColumnMetaData[] columnMeta) { if (parent != null && !seen.contains(parent.getName())) throw new TrevniRuntimeException("Parent must precede child: "+name); seen.add(name); - } + } } void incrementSize(int n) { size += n; } @@ -133,7 +133,7 @@ public void writeTo(File file) throws IOException { /** Write all rows added to the named output stream. */ public void writeTo(OutputStream out) throws IOException { writeHeader(out); - + for (int column = 0; column < columnCount; column++) columns[column].writeTo(out); } diff --git a/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnOutputBuffer.java b/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnOutputBuffer.java index b689915847f..32177530673 100644 --- a/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnOutputBuffer.java +++ b/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnOutputBuffer.java @@ -90,9 +90,9 @@ void flushBuffer() throws IOException { ? firstValues.get(firstValues.size()-1).length : 0) + data.position(); // data - + writer.incrementSize(sizeIncrement); - size += sizeIncrement; + size += sizeIncrement; buffer = new OutputBuffer(); rowCount = 0; diff --git a/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnValues.java b/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnValues.java index a47fc854476..9df153f4134 100644 --- a/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnValues.java +++ b/lang/java/trevni/core/src/main/java/org/apache/trevni/ColumnValues.java @@ -34,7 +34,7 @@ public class ColumnValues private InputBuffer values; private int block = -1; private long row = 0; - private T previous; + private T previous; private int arrayLength; diff --git a/lang/java/trevni/core/src/main/java/org/apache/trevni/DeflateCodec.java b/lang/java/trevni/core/src/main/java/org/apache/trevni/DeflateCodec.java index 7e9a0be590b..96077bb5b7a 100644 --- a/lang/java/trevni/core/src/main/java/org/apache/trevni/DeflateCodec.java +++ b/lang/java/trevni/core/src/main/java/org/apache/trevni/DeflateCodec.java @@ -45,13 +45,13 @@ ByteBuffer decompress(ByteBuffer data) throws IOException { writeAndClose(data, new InflaterOutputStream(baos, getInflater())); return ByteBuffer.wrap(baos.toByteArray()); } - + private void writeAndClose(ByteBuffer data, OutputStream out) throws IOException { out.write(data.array(), data.position(), data.remaining()); out.close(); } - + private Inflater getInflater() { if (null == inflater) inflater = new Inflater(true); @@ -65,7 +65,7 @@ private Deflater getDeflater() { deflater.reset(); return deflater; } - + private ByteArrayOutputStream getOutputBuffer(int suggestedLength) { if (null == outputBuffer) outputBuffer = new ByteArrayOutputStream(suggestedLength); diff --git a/lang/java/trevni/core/src/main/java/org/apache/trevni/InputBuffer.java b/lang/java/trevni/core/src/main/java/org/apache/trevni/InputBuffer.java index e3bd415ddf7..402373157bf 100644 --- a/lang/java/trevni/core/src/main/java/org/apache/trevni/InputBuffer.java +++ b/lang/java/trevni/core/src/main/java/org/apache/trevni/InputBuffer.java @@ -35,7 +35,7 @@ class InputBuffer { private int limit; // end of valid buffer data private CharsetDecoder utf8 = Charset.forName("UTF-8").newDecoder(); - + private int bitCount; // position in booleans private int runLength; // length of run @@ -233,7 +233,7 @@ public long readLong() throws IOException { } return (l >>> 1) ^ -(l & 1); // back to two's-complement } - + // splitting readLong up makes it faster because of the JVM does more // optimizations on small methods private long innerLongDecode(long l) throws IOException { @@ -302,7 +302,7 @@ public String readString() throws IOException { byte[] bytes = new byte[length]; readFully(bytes, 0, length); return utf8.decode(ByteBuffer.wrap(bytes, 0, length)).toString(); - } + } public byte[] readBytes() throws IOException { byte[] result = new byte[readInt()]; diff --git a/lang/java/trevni/core/src/main/java/org/apache/trevni/MetaData.java b/lang/java/trevni/core/src/main/java/org/apache/trevni/MetaData.java index 648d8a17a2a..08d00721b6c 100644 --- a/lang/java/trevni/core/src/main/java/org/apache/trevni/MetaData.java +++ b/lang/java/trevni/core/src/main/java/org/apache/trevni/MetaData.java @@ -44,7 +44,7 @@ public T setCodec(String codec) { setReserved(CODEC_KEY, codec); return (T)this; } - + /** Return the checksum algorithm name. */ public String getChecksum() { return getString(CHECKSUM_KEY); } diff --git a/lang/java/trevni/core/src/main/java/org/apache/trevni/OutputBuffer.java b/lang/java/trevni/core/src/main/java/org/apache/trevni/OutputBuffer.java index 41174fbd9ba..0bba8ac1796 100644 --- a/lang/java/trevni/core/src/main/java/org/apache/trevni/OutputBuffer.java +++ b/lang/java/trevni/core/src/main/java/org/apache/trevni/OutputBuffer.java @@ -98,7 +98,7 @@ public void writeBytes(ByteBuffer bytes) throws IOException { int len = bytes.limit() - pos; writeBytes(bytes.array(), start, len); } - + public void writeBytes(byte[] bytes) throws IOException { writeBytes(bytes, 0, bytes.length); } @@ -158,7 +158,7 @@ public void writeInt(int n) throws IOException { } } } - } + } buf[count++] = (byte) n; } @@ -203,7 +203,7 @@ public void writeLong(long n) throws IOException { } buf[count++] = (byte) n; } - + private void ensure(int n) { if (count + n > buf.length) buf = Arrays.copyOf(buf, Math.max(buf.length << 1, count + n)); diff --git a/lang/java/trevni/core/src/main/java/org/apache/trevni/ValueType.java b/lang/java/trevni/core/src/main/java/org/apache/trevni/ValueType.java index 712a7d9ea4a..dddcb5abbb5 100644 --- a/lang/java/trevni/core/src/main/java/org/apache/trevni/ValueType.java +++ b/lang/java/trevni/core/src/main/java/org/apache/trevni/ValueType.java @@ -30,5 +30,5 @@ public enum ValueType { public static ValueType forName(String name) { return valueOf(name.toUpperCase()); } - + } diff --git a/lang/java/trevni/core/src/test/java/org/apache/trevni/TestBZip2Codec.java b/lang/java/trevni/core/src/test/java/org/apache/trevni/TestBZip2Codec.java index c4a39de4a48..ac7c81b42bb 100644 --- a/lang/java/trevni/core/src/test/java/org/apache/trevni/TestBZip2Codec.java +++ b/lang/java/trevni/core/src/test/java/org/apache/trevni/TestBZip2Codec.java @@ -25,42 +25,42 @@ import org.junit.Test; public class TestBZip2Codec { - + @Test public void testBZip2CompressionAndDecompression() throws IOException { - + MetaData meta = new MetaData(); meta.setCodec("bzip2"); Codec codec = Codec.get(meta); - + //Confirm that the right codec Came back assertTrue(codec instanceof BZip2Codec); - + //This is 3 times the byte buffer on the BZip2 decompress plus some extra final int inputByteSize = BZip2Codec.DEFAULT_BUFFER_SIZE * 3 + 42; - + byte[] inputByteArray = new byte[inputByteSize]; - + //Generate something that will compress well for (int i = 0; i < inputByteSize; i++) { inputByteArray[i] = (byte)(65 + i % 10); } - + ByteBuffer inputByteBuffer = ByteBuffer.wrap(inputByteArray); - + ByteBuffer compressedBuffer = codec.compress(inputByteBuffer); - + //Make sure something returned assertTrue(compressedBuffer.array().length > 0); //Make sure the compressed output is smaller then the original assertTrue(compressedBuffer.array().length < inputByteArray.length); - + ByteBuffer decompressedBuffer = codec.decompress(compressedBuffer); - + //The original array should be the same length as the decompressed array assertTrue(decompressedBuffer.array().length == inputByteArray.length); - - //Every byte in the outputByteArray should equal every byte in the input array + + //Every byte in the outputByteArray should equal every byte in the input array byte[] outputByteArray = decompressedBuffer.array(); for (int i = 0; i < inputByteSize; i++) { inputByteArray[i] = outputByteArray[i]; diff --git a/lang/java/trevni/core/src/test/java/org/apache/trevni/TestIOBuffers.java b/lang/java/trevni/core/src/test/java/org/apache/trevni/TestIOBuffers.java index 707848e83a6..a0b1068d969 100644 --- a/lang/java/trevni/core/src/test/java/org/apache/trevni/TestIOBuffers.java +++ b/lang/java/trevni/core/src/test/java/org/apache/trevni/TestIOBuffers.java @@ -52,7 +52,7 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); for (int i = 0; i < COUNT; i++) out.writeValue(random.nextBoolean(), ValueType.BOOLEAN); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); random = TestUtil.createRandom(); for (int i = 0; i < COUNT; i++) @@ -65,7 +65,7 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); for (int i = 0; i < COUNT; i++) out.writeInt(random.nextInt()); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); random = TestUtil.createRandom(); for (int i = 0; i < COUNT; i++) @@ -77,7 +77,7 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); for (int i = 0; i < COUNT; i++) out.writeLong(random.nextLong()); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); random = TestUtil.createRandom(); for (int i = 0; i < COUNT; i++) @@ -89,7 +89,7 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); for (int i = 0; i < COUNT; i++) out.writeFixed32(random.nextInt()); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); random = TestUtil.createRandom(); for (int i = 0; i < COUNT; i++) @@ -101,41 +101,41 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); for (int i = 0; i < COUNT; i++) out.writeFixed64(random.nextLong()); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); random = TestUtil.createRandom(); for (int i = 0; i < COUNT; i++) Assert.assertEquals(random.nextLong(), in.readFixed64()); } - + @Test public void testFloat() throws Exception { Random random = TestUtil.createRandom(); OutputBuffer out = new OutputBuffer(); for (int i = 0; i < COUNT; i++) out.writeFloat(random.nextFloat()); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); random = TestUtil.createRandom(); for (int i = 0; i < COUNT; i++) Assert.assertEquals(random.nextFloat(), in.readFloat(), 0); } - + @Test public void testDouble() throws Exception { OutputBuffer out = new OutputBuffer(); for (int i = 0; i < COUNT; i++) out.writeDouble(Double.MIN_VALUE); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); for (int i = 0; i < COUNT; i++) Assert.assertEquals(Double.MIN_VALUE, in.readDouble(), 0); } - + @Test public void testBytes() throws Exception { Random random = TestUtil.createRandom(); OutputBuffer out = new OutputBuffer(); for (int i = 0; i < COUNT; i++) out.writeBytes(TestUtil.randomBytes(random)); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); random = TestUtil.createRandom(); for (int i = 0; i < COUNT; i++) @@ -147,7 +147,7 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); for (int i = 0; i < COUNT; i++) out.writeString(TestUtil.randomString(random)); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); random = TestUtil.createRandom(); for (int i = 0; i < COUNT; i++) @@ -158,7 +158,7 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); out.writeValue(null, ValueType.NULL); out.writeLong(sentinel); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.NULL); Assert.assertEquals(sentinel, in.readLong()); @@ -168,7 +168,7 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); out.writeValue(false, ValueType.BOOLEAN); out.writeLong(sentinel); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.BOOLEAN); Assert.assertEquals(sentinel, in.readLong()); @@ -178,7 +178,7 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); out.writeValue(Integer.MAX_VALUE, ValueType.INT); out.writeLong(sentinel); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.INT); Assert.assertEquals(sentinel, in.readLong()); @@ -188,7 +188,7 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); out.writeValue(Long.MAX_VALUE, ValueType.LONG); out.writeLong(sentinel); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.LONG); Assert.assertEquals(sentinel, in.readLong()); @@ -198,7 +198,7 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); out.writeValue(Integer.MAX_VALUE, ValueType.FIXED32); out.writeLong(sentinel); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.LONG); Assert.assertEquals(sentinel, in.readLong()); @@ -208,7 +208,7 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); out.writeValue(Long.MAX_VALUE, ValueType.FIXED64); out.writeLong(sentinel); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.LONG); Assert.assertEquals(sentinel, in.readLong()); @@ -218,7 +218,7 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); out.writeValue(Float.MAX_VALUE, ValueType.FLOAT); out.writeLong(sentinel); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.FLOAT); Assert.assertEquals(sentinel, in.readLong()); @@ -228,7 +228,7 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); out.writeValue(Double.MAX_VALUE, ValueType.DOUBLE); out.writeLong(sentinel); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.DOUBLE); Assert.assertEquals(sentinel, in.readLong()); @@ -238,7 +238,7 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); out.writeValue("trevni", ValueType.STRING); out.writeLong(sentinel); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.STRING); Assert.assertEquals(sentinel, in.readLong()); @@ -248,7 +248,7 @@ public class TestIOBuffers { OutputBuffer out = new OutputBuffer(); out.writeValue("trevni".getBytes(), ValueType.BYTES); out.writeLong(sentinel); - + InputBuffer in = new InputBuffer(new InputBytes(out.toByteArray())); in.skipValue(ValueType.BYTES); Assert.assertEquals(sentinel, in.readLong()); diff --git a/lang/java/trevni/core/src/test/java/org/apache/trevni/TestInputBytes.java b/lang/java/trevni/core/src/test/java/org/apache/trevni/TestInputBytes.java index c4cb2aacc4d..c55b53242ca 100644 --- a/lang/java/trevni/core/src/test/java/org/apache/trevni/TestInputBytes.java +++ b/lang/java/trevni/core/src/test/java/org/apache/trevni/TestInputBytes.java @@ -38,7 +38,7 @@ public class TestInputBytes { random.nextBytes(data); Input in = new InputBytes(data); - + for (int i = 0; i < COUNT; i++) { int p = random.nextInt(length); int l = Math.min(random.nextInt(SIZE/10), length-p); diff --git a/lang/java/trevni/core/src/test/java/org/apache/trevni/TestUtil.java b/lang/java/trevni/core/src/test/java/org/apache/trevni/TestUtil.java index ab4796d5024..22bbae951fe 100644 --- a/lang/java/trevni/core/src/test/java/org/apache/trevni/TestUtil.java +++ b/lang/java/trevni/core/src/test/java/org/apache/trevni/TestUtil.java @@ -39,7 +39,7 @@ public static long getRandomSeed() { String configured = System.getProperty("test.seed"); if (configured != null) seed = Long.valueOf(configured); - else + else seed = System.currentTimeMillis(); System.err.println("test.seed="+seed); seedSet = true; diff --git a/lang/py/build.xml b/lang/py/build.xml index 61c3f4c5e36..5ef521482ad 100644 --- a/lang/py/build.xml +++ b/lang/py/build.xml @@ -17,7 +17,7 @@ --> - + @@ -66,7 +66,7 @@ - + @@ -79,13 +79,13 @@ - + - + @@ -102,9 +102,9 @@ toFile="${build.dir}/src/avro/ipc.py" overwrite="true"> - - diff --git a/lang/py/ivysettings.xml b/lang/py/ivysettings.xml index 31de16eddb2..22104c7fed9 100644 --- a/lang/py/ivysettings.xml +++ b/lang/py/ivysettings.xml @@ -19,8 +19,8 @@ - - + + diff --git a/lang/py3/scripts/avro b/lang/py3/scripts/avro old mode 100644 new mode 100755 diff --git a/share/test/interop/bin/test_rpc_interop.sh b/share/test/interop/bin/test_rpc_interop.sh index 75681bebc54..20ee77f76d4 100755 --- a/share/test/interop/bin/test_rpc_interop.sh +++ b/share/test/interop/bin/test_rpc_interop.sh @@ -15,13 +15,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -set -e # exit on error +set -e # exit on error -cd `dirname "$0"`/../../../.. # connect to root +cd `dirname "$0"`/../../../.. # connect to root VERSION=`cat share/VERSION.txt` -#set -x # echo commands +#set -x # echo commands java_client="java -jar lang/java/tools/target/avro-tools-$VERSION.jar rpcsend" java_server="java -jar lang/java/tools/target/avro-tools-$VERSION.jar rpcreceive" @@ -32,7 +32,7 @@ py_server="python lang/py/build/src/avro/tool.py rpcreceive" ruby_client="ruby -rubygems -Ilang/ruby/lib lang/ruby/test/tool.rb rpcsend" ruby_server="ruby -rubygems -Ilang/ruby/lib lang/ruby/test/tool.rb rpcreceive" -export PYTHONPATH=lang/py/build/src # path to avro Python module +export PYTHONPATH=lang/py/build/src # path to avro Python module clients=("$java_client" "$py_client" "$ruby_client") servers=("$java_server" "$py_server" "$ruby_server") @@ -42,41 +42,41 @@ proto=share/test/schemas/simple.avpr portfile=/tmp/interop_$$ function cleanup() { - rm -rf $portfile - for job in `jobs -p` ; do kill $job; done + rm -rf $portfile + for job in `jobs -p` ; do kill $job; done } trap 'cleanup' EXIT for server in "${servers[@]}" do - for msgDir in share/test/interop/rpc/* + for msgDir in share/test/interop/rpc/* + do + msg=`basename "$msgDir"` + for c in ${msgDir}/* do - msg=`basename "$msgDir"` - for c in ${msgDir}/* - do - echo TEST: $c - for client in "${clients[@]}" - do + echo TEST: $c + for client in "${clients[@]}" + do rm -rf $portfile - $server http://127.0.0.1:0/ $proto $msg -file $c/response.avro \ - > $portfile & + $server http://127.0.0.1:0/ $proto $msg -file $c/response.avro \ + > $portfile & count=0 while [ ! -s $portfile ] do - sleep 1 - if [ $count -ge 10 ] - then - echo $server did not start. - exit 1 - fi - count=`expr $count + 1` + sleep 1 + if [ $count -ge 10 ] + then + echo $server did not start. + exit 1 + fi + count=`expr $count + 1` done - read ignore port < $portfile - $client http://127.0.0.1:$port $proto $msg -file $c/request.avro - wait - done - done + read ignore port < $portfile + $client http://127.0.0.1:$port $proto $msg -file $c/request.avro + wait + done + done done done From b9940d798e0cb2db524b5ad6ff3589b15659cfd2 Mon Sep 17 00:00:00 2001 From: Niels Basjes Date: Thu, 5 May 2016 21:02:30 +0200 Subject: [PATCH 053/116] Update the gitignore files to hide generated files --- .gitignore | 2 ++ CHANGES.txt | 2 ++ doc/.gitignore | 1 + lang/c++/.gitignore | 3 +++ lang/csharp/.gitignore | 3 +++ lang/java/.gitignore | 3 +++ lang/js/.gitignore | 2 ++ lang/perl/.gitignore | 1 + lang/php/.gitignore | 1 + lang/py/.gitignore | 3 +++ lang/py3/.gitignore | 6 ++++++ lang/ruby/.gitignore | 4 ++++ pom.xml | 1 + 13 files changed, 32 insertions(+) create mode 100644 doc/.gitignore create mode 100644 lang/js/.gitignore create mode 100644 lang/php/.gitignore create mode 100644 lang/py/.gitignore create mode 100644 lang/py3/.gitignore diff --git a/.gitignore b/.gitignore index 372789a7208..d5b1b749992 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ *.iml *.ipr *.iws +*.swp +*~ .idea/ .project .settings diff --git a/CHANGES.txt b/CHANGES.txt index a8ed79f6f3d..6c8e0423311 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -33,6 +33,8 @@ Trunk (not yet released) AVRO-1828: Add EditorConfig file and cleanup of whitespace violations (nielsbasjes) + AVRO-1839: Update the gitignore files to hide generated files (nielsbasjes) + BUG FIXES AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are diff --git a/doc/.gitignore b/doc/.gitignore new file mode 100644 index 00000000000..567609b1234 --- /dev/null +++ b/doc/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/lang/c++/.gitignore b/lang/c++/.gitignore index 091cd7f5411..76f0125955a 100644 --- a/lang/c++/.gitignore +++ b/lang/c++/.gitignore @@ -1,2 +1,5 @@ build/ build.mac/ +doc/ +test.avro +test6.df diff --git a/lang/csharp/.gitignore b/lang/csharp/.gitignore index 511adaf3c24..b8e088c6160 100644 --- a/lang/csharp/.gitignore +++ b/lang/csharp/.gitignore @@ -47,3 +47,6 @@ .builds *.dotCover *.nupkg + +#Test results +TestResult.xml diff --git a/lang/java/.gitignore b/lang/java/.gitignore index 92c171c5d4e..1bb3fcb54b8 100644 --- a/lang/java/.gitignore +++ b/lang/java/.gitignore @@ -17,3 +17,6 @@ /.classpath /.eclipse /.project +dependency-reduced-pom.xml +mapred/userlogs/ +tools/userlogs/ diff --git a/lang/js/.gitignore b/lang/js/.gitignore new file mode 100644 index 00000000000..b509c88b364 --- /dev/null +++ b/lang/js/.gitignore @@ -0,0 +1,2 @@ +coverage/ +node_modules/ diff --git a/lang/perl/.gitignore b/lang/perl/.gitignore index ca296d172e0..2e672792cb6 100644 --- a/lang/perl/.gitignore +++ b/lang/perl/.gitignore @@ -8,3 +8,4 @@ Makefile.old pm_to_blib *~ /blib +Avro-*.tar.gz diff --git a/lang/php/.gitignore b/lang/php/.gitignore new file mode 100644 index 00000000000..5fff1d9c188 --- /dev/null +++ b/lang/php/.gitignore @@ -0,0 +1 @@ +pkg diff --git a/lang/py/.gitignore b/lang/py/.gitignore new file mode 100644 index 00000000000..df3cd4d4897 --- /dev/null +++ b/lang/py/.gitignore @@ -0,0 +1,3 @@ +build/ +lib/ +userlogs/ diff --git a/lang/py3/.gitignore b/lang/py3/.gitignore new file mode 100644 index 00000000000..777f026dade --- /dev/null +++ b/lang/py3/.gitignore @@ -0,0 +1,6 @@ +avro/HandshakeRequest.avsc +avro/HandshakeResponse.avsc +avro/VERSION.txt +avro/tests/interop.avsc +avro_python3.egg-info/ +dist/ diff --git a/lang/ruby/.gitignore b/lang/ruby/.gitignore index 3f9ddafa2ea..63c96e1bb28 100644 --- a/lang/ruby/.gitignore +++ b/lang/ruby/.gitignore @@ -1,3 +1,7 @@ tmp data.avr Gemfile.lock +.bundle/ +.gem/ +avro.gemspec +pkg/ diff --git a/pom.xml b/pom.xml index 7311deb52d7..7402ec85bb6 100644 --- a/pom.xml +++ b/pom.xml @@ -242,6 +242,7 @@ lang/ruby/avro.gemspec lang/ruby/.gem/** lang/ruby/pkg/** + lang/ruby/.bundle/** lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Player.java lang/java/tools/src/test/compiler/output-string/avro/examples/baseball/Position.java lang/java/tools/src/test/compiler/output/Player.java From 6de8e985675034fbb3cac4dc8bd3cbed31461b33 Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Sun, 8 May 2016 15:26:37 -0700 Subject: [PATCH 054/116] AVRO-1711: Java: Fix JsonDecoder#skipChildren skipping extra tokens. Contributed by Zoltan Farkas and Thiruvalluvan M. G. --- CHANGES.txt | 3 +++ .../java/org/apache/avro/io/JsonDecoder.java | 9 +++++---- .../org/apache/avro/io/TestJsonDecoder.java | 17 +++++++++++++++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 6c8e0423311..86f280dd522 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -57,6 +57,9 @@ Trunk (not yet released) AVRO-1814: Generated java code fails on variables with a TLD name like 'org' (nielsbasjes) + AVRO-1711: Java: Fix JsonParser#skipChildren to implement its defined contract. + (Zoltan Farkas and Thiruvalluvan M. G. via blue) + Avro 1.8.0 (22 January 2016) INCOMPATIBLE CHANGES diff --git a/lang/java/avro/src/main/java/org/apache/avro/io/JsonDecoder.java b/lang/java/avro/src/main/java/org/apache/avro/io/JsonDecoder.java index 8045199ecb7..34a1862de03 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/io/JsonDecoder.java +++ b/lang/java/avro/src/main/java/org/apache/avro/io/JsonDecoder.java @@ -579,9 +579,10 @@ public JsonToken nextToken() throws IOException { @Override public JsonParser skipChildren() throws IOException { - int level = 0; - do { - switch(elements.get(pos++).token) { + JsonToken tkn = elements.get(pos).token; + int level = (tkn == JsonToken.START_ARRAY || tkn == JsonToken.END_ARRAY) ? 1 : 0; + while (level > 0) { + switch(elements.get(++pos).token) { case START_ARRAY: case START_OBJECT: level++; @@ -591,7 +592,7 @@ public JsonParser skipChildren() throws IOException { level--; break; } - } while (level > 0); + } return this; } diff --git a/lang/java/avro/src/test/java/org/apache/avro/io/TestJsonDecoder.java b/lang/java/avro/src/test/java/org/apache/avro/io/TestJsonDecoder.java index 4ac07eb80a3..6ee6fcbf943 100644 --- a/lang/java/avro/src/test/java/org/apache/avro/io/TestJsonDecoder.java +++ b/lang/java/avro/src/test/java/org/apache/avro/io/TestJsonDecoder.java @@ -60,4 +60,21 @@ private void checkNumeric(String type, Object value) throws Exception { } } + // Ensure that even if the order of fields in JSON is different from the order in schema, + // it works. + @Test public void testReorderFields() throws Exception { + String w = + "{\"type\":\"record\",\"name\":\"R\",\"fields\":" + +"[{\"type\":\"long\",\"name\":\"l\"}," + +"{\"type\":{\"type\":\"array\",\"items\":\"int\"},\"name\":\"a\"}" + +"]}"; + Schema ws = Schema.parse(w); + DecoderFactory df = DecoderFactory.get(); + String data = "{\"a\":[1,2],\"l\":100}{\"l\": 200, \"a\":[1,2]}"; + JsonDecoder in = df.jsonDecoder(ws, data); + Assert.assertEquals(100, in.readLong()); + in.skipArray(); + Assert.assertEquals(200, in.readLong()); + in.skipArray(); + } } From c6b5368af236f2c2e7ae72fb754bea734062364c Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Sun, 8 May 2016 15:57:52 -0700 Subject: [PATCH 055/116] AVRO-1838: Java: Update checkstyle to catch trailing whitespace. Contributed by Niels Basjes. --- CHANGES.txt | 3 ++ lang/java/checkstyle.xml | 59 --------------------------------- lang/java/pom.xml | 26 --------------- lang/java/trevni/avro/pom.xml | 4 --- lang/java/trevni/checkstyle.xml | 59 --------------------------------- lang/java/trevni/core/pom.xml | 9 ----- pom.xml | 32 ++++++++++++++++++ 7 files changed, 35 insertions(+), 157 deletions(-) delete mode 100644 lang/java/checkstyle.xml delete mode 100644 lang/java/trevni/checkstyle.xml diff --git a/CHANGES.txt b/CHANGES.txt index 86f280dd522..4eac4157d9f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -35,6 +35,9 @@ Trunk (not yet released) AVRO-1839: Update the gitignore files to hide generated files (nielsbasjes) + AVRO-1838: Java: Update checkstyle to catch trailing whitespace. + (nielsbasjes via blue) + BUG FIXES AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are diff --git a/lang/java/checkstyle.xml b/lang/java/checkstyle.xml deleted file mode 100644 index a51089a981f..00000000000 --- a/lang/java/checkstyle.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lang/java/pom.xml b/lang/java/pom.xml index dd6007b57bf..d37c5ecbcaa 100644 --- a/lang/java/pom.xml +++ b/lang/java/pom.xml @@ -74,7 +74,6 @@ 1.3.9-1 - 2.12.1 2.5.3 3.1 1.3.2 @@ -234,27 +233,6 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - ${checkstyle-plugin.version} - - true - checkstyle.xml - - - - - checkstyle-check - test - - check - - - - org.apache.maven.plugins maven-javadoc-plugin @@ -307,10 +285,6 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - org.apache.felix maven-bundle-plugin diff --git a/lang/java/trevni/avro/pom.xml b/lang/java/trevni/avro/pom.xml index aa67ce55d88..a92ba54e6ef 100644 --- a/lang/java/trevni/avro/pom.xml +++ b/lang/java/trevni/avro/pom.xml @@ -48,10 +48,6 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - org.apache.maven.plugins maven-jar-plugin diff --git a/lang/java/trevni/checkstyle.xml b/lang/java/trevni/checkstyle.xml deleted file mode 100644 index a51089a981f..00000000000 --- a/lang/java/trevni/checkstyle.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lang/java/trevni/core/pom.xml b/lang/java/trevni/core/pom.xml index 42e73e75626..aee43334eec 100644 --- a/lang/java/trevni/core/pom.xml +++ b/lang/java/trevni/core/pom.xml @@ -44,15 +44,6 @@ - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - - - diff --git a/pom.xml b/pom.xml index 7402ec85bb6..7912d5c7c32 100644 --- a/pom.xml +++ b/pom.xml @@ -44,6 +44,7 @@ Java artifacts are copied to the final build destination with a custom profile. --> + UTF-8 dist build/avro-doc-${project.version}/api @@ -53,9 +54,11 @@ 1.7 1.3.1 0.9 + 2.17 + dev-tools lang/java @@ -118,6 +121,35 @@ true + + org.apache.maven.plugins + maven-checkstyle-plugin + ${checkstyle-plugin.version} + + + org.apache.avro + dev-tools + ${project.version} + + + + true + checkstyle/checkstyle.xml + checkstyle/suppressions.xml + + + + + checkstyle-check + test + + check + + + + From a0663ae2b40baf697fda3936642a5bb95fac3f5d Mon Sep 17 00:00:00 2001 From: Niels Basjes Date: Mon, 9 May 2016 10:29:15 +0200 Subject: [PATCH 056/116] AVRO-1840: Ensure that build.sh clean really cleans all generated files --- CHANGES.txt | 2 ++ build.sh | 15 +++++++++++++++ lang/c++/build.sh | 1 + lang/c/build.sh | 6 ++++-- lang/csharp/build.sh | 3 ++- lang/js/build.sh | 2 +- lang/ruby/build.sh | 1 + 7 files changed, 26 insertions(+), 4 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 4eac4157d9f..c33e74316c8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -38,6 +38,8 @@ Trunk (not yet released) AVRO-1838: Java: Update checkstyle to catch trailing whitespace. (nielsbasjes via blue) + AVRO-1840: Ensure that build.sh clean really cleans all generated files (nielsbasjes) + BUG FIXES AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are diff --git a/build.sh b/build.sh index a373c2c2b1e..93654dbe44b 100755 --- a/build.sh +++ b/build.sh @@ -167,9 +167,20 @@ do (cd doc; ant clean) (mvn clean) + rm -rf lang/java/*/userlogs/ + rm -rf lang/java/*/dependency-reduced-pom.xml (cd lang/py; ant clean) + rm -rf lang/py/userlogs/ + (cd lang/py3; python3 setup.py clean) + rm -rf lang/py3/dist + rm -rf lang/py3/avro_python3.egg-info + rm -f lang/py3/avro/*.avsc + rm -f lang/py3/avro/VERSION.txt + rm -rf lang/py3/avro/__pycache__/ + rm -f lang/py3/avro/tests/interop.avsc + rm -rf lang/py3/avro/tests/__pycache__/ (cd lang/c; ./build.sh clean) @@ -184,6 +195,10 @@ do (cd lang/php; ./build.sh clean) (cd lang/perl; [ ! -f Makefile ] || make clean) + rm -f lang/perl/Avro-*.tar.gz + rm -f lang/perl/META.yml + rm -f lang/perl/Makefile.old + rm -rf lang/perl/inc/ ;; docker) diff --git a/lang/c++/build.sh b/lang/c++/build.sh index e5beaea63ea..2c988856e04 100755 --- a/lang/c++/build.sh +++ b/lang/c++/build.sh @@ -97,6 +97,7 @@ case "$target" in clean) (cd build && make clean) + rm -rf doc test.avro test6.df ;; install) diff --git a/lang/c/build.sh b/lang/c/build.sh index e00db691405..f76f035506b 100755 --- a/lang/c/build.sh +++ b/lang/c/build.sh @@ -36,9 +36,11 @@ function prepare_build { function clean { if [ -d $build_dir ]; then - find $build_dir | xargs chmod 755 - rm -rf $build_dir + find $build_dir | xargs chmod 755 + rm -rf $build_dir fi + rm -f VERSION.txt + rm -f examples/quickstop.db } case "$1" in diff --git a/lang/csharp/build.sh b/lang/csharp/build.sh index 66520c18bb1..97beaf80275 100755 --- a/lang/csharp/build.sh +++ b/lang/csharp/build.sh @@ -53,8 +53,9 @@ case "$1" in ;; clean) - rm -rf src/apache/{main,test,codegen,ipc}/obj + rm -rf src/apache/{main,test,codegen,ipc,msbuild,perf}/obj rm -rf build + rm -f TestResult.xml ;; *) diff --git a/lang/js/build.sh b/lang/js/build.sh index 08823fcba42..45a31f5a46d 100755 --- a/lang/js/build.sh +++ b/lang/js/build.sh @@ -30,7 +30,7 @@ case "$1" in mv avro-js-*.tgz ../../dist/js ;; clean) - rm -rf node_modules + rm -rf coverage ;; *) echo "Usage: $0 {test|dist|clean}" >&2 diff --git a/lang/ruby/build.sh b/lang/ruby/build.sh index 0198400571f..dc3193c3346 100755 --- a/lang/ruby/build.sh +++ b/lang/ruby/build.sh @@ -40,6 +40,7 @@ case "$1" in clean) bundle install bundle exec rake clean + rm -rf tmp avro.gemspec data.avr ;; *) From 2ecd0a547f97da9608e6dbae72f8dc2076dfa2fe Mon Sep 17 00:00:00 2001 From: Niels Basjes Date: Mon, 9 May 2016 15:57:10 +0200 Subject: [PATCH 057/116] AVRO-1838: Java: Update checkstyle to catch trailing whitespace. Added missing files. --- dev-tools/pom.xml | 31 ++++++++ .../main/resources/checkstyle/checkstyle.xml | 70 +++++++++++++++++++ .../resources/checkstyle/suppressions.xml | 26 +++++++ 3 files changed, 127 insertions(+) create mode 100644 dev-tools/pom.xml create mode 100644 dev-tools/src/main/resources/checkstyle/checkstyle.xml create mode 100644 dev-tools/src/main/resources/checkstyle/suppressions.xml diff --git a/dev-tools/pom.xml b/dev-tools/pom.xml new file mode 100644 index 00000000000..cedb95a5d1b --- /dev/null +++ b/dev-tools/pom.xml @@ -0,0 +1,31 @@ + + + + 4.0.0 + + org.apache.avro + dev-tools + 1.9.0-SNAPSHOT + + Apache Avro Developer tools + http://avro.apache.org + + + diff --git a/dev-tools/src/main/resources/checkstyle/checkstyle.xml b/dev-tools/src/main/resources/checkstyle/checkstyle.xml new file mode 100644 index 00000000000..fe5f008bdf9 --- /dev/null +++ b/dev-tools/src/main/resources/checkstyle/checkstyle.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev-tools/src/main/resources/checkstyle/suppressions.xml b/dev-tools/src/main/resources/checkstyle/suppressions.xml new file mode 100644 index 00000000000..c9524953038 --- /dev/null +++ b/dev-tools/src/main/resources/checkstyle/suppressions.xml @@ -0,0 +1,26 @@ + + + + + + + + + From bd369bafbfcecbfdda8666f5fadc4ddc44a8fcaf Mon Sep 17 00:00:00 2001 From: Niels Basjes Date: Wed, 11 May 2016 00:16:39 +0200 Subject: [PATCH 058/116] AVRO-1841: Add clientside githooks to do basic commit validation --- CHANGES.txt | 2 ++ build.sh | 8 +++++++- share/githooks/commit-msg | 43 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 share/githooks/commit-msg diff --git a/CHANGES.txt b/CHANGES.txt index c33e74316c8..bccaf1743e2 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -40,6 +40,8 @@ Trunk (not yet released) AVRO-1840: Ensure that build.sh clean really cleans all generated files (nielsbasjes) + AVRO-1841: Add clientside githooks to do basic commit validation (nielsbasjes) + BUG FIXES AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are diff --git a/build.sh b/build.sh index 93654dbe44b..c0c31df5385 100755 --- a/build.sh +++ b/build.sh @@ -22,7 +22,7 @@ cd `dirname "$0"` # connect to root VERSION=`cat share/VERSION.txt` function usage { - echo "Usage: $0 {test|dist|sign|clean|docker|rat}" + echo "Usage: $0 {test|dist|sign|clean|docker|rat|githooks}" exit 1 } @@ -235,6 +235,12 @@ UserSpecificDocker mvn test -Dmaven.main.skip=true -Dmaven.test.skip=true -DskipTests=true -P rat -pl :avro-toplevel ;; + githooks) + echo "Installing AVRO git hooks." + cp share/githooks/* .git/hooks + find .git/hooks/ -type f | fgrep -v sample | xargs chmod 755 + ;; + *) usage ;; diff --git a/share/githooks/commit-msg b/share/githooks/commit-msg new file mode 100644 index 00000000000..07bbcc874c7 --- /dev/null +++ b/share/githooks/commit-msg @@ -0,0 +1,43 @@ +#!/bin/bash +# +# Client side pre-commit hook to assist the committers to ensure the commit messages +# follow the chosen convention. + +LOGMESSAGE_FORMAT='^AVRO-[1-9][0-9]*: .*' +COMMIT_MSG_FILE=$1 + +echo "==========================" +echo "Doing basic commit validation" + +echo -n "= Single line commit message: " +COMMIT_LINES=$(cat ${COMMIT_MSG_FILE} | wc -l) +if [ ${COMMIT_LINES} -eq 1 ]; +then + echo "Ok" +else + echo "Fail: Found ${COMMIT_LINES} lines" + exit 1 +fi + +echo -n "= Commit message format: " +if grep -q "${LOGMESSAGE_FORMAT}" ${COMMIT_MSG_FILE} +then + echo "Ok" +else + echo "Fail: Must be in this format: ${LOGMESSAGE_FORMAT}" + exit 1 +fi + +ISSUE_ID=$(head -1 ${COMMIT_MSG_FILE} | cut -d':' -f1) + +echo -n "= CHANGES.txt mentions ${ISSUE_ID}: " +if grep -q "${ISSUE_ID}[^0-9]" CHANGES.txt +then + echo "Ok" +else + echo "Fail" + exit 1 +fi +echo "==========================" + +exit 0 From 4f9faeb6c2148c3f79deb822afee969a622ee58e Mon Sep 17 00:00:00 2001 From: Niels Basjes Date: Wed, 11 May 2016 14:48:00 +0200 Subject: [PATCH 059/116] AVRO-1841: Add clientside githooks to do basic commit validation. Add missing copyright header. --- share/githooks/commit-msg | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/share/githooks/commit-msg b/share/githooks/commit-msg index 07bbcc874c7..6a50adc1c3e 100644 --- a/share/githooks/commit-msg +++ b/share/githooks/commit-msg @@ -1,5 +1,20 @@ #!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 # +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Client side pre-commit hook to assist the committers to ensure the commit messages # follow the chosen convention. From 85b4313dce7e7a896d9ea1d9869baeebeb05a998 Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Sun, 8 May 2016 19:25:40 -0700 Subject: [PATCH 060/116] AVRO-1807: Java/JSON: Throw for unsupported objects rather than ignoring. --- CHANGES.txt | 2 ++ .../main/java/org/apache/avro/util/internal/JacksonUtils.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index bccaf1743e2..f5284c8b684 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -42,6 +42,8 @@ Trunk (not yet released) AVRO-1841: Add clientside githooks to do basic commit validation (nielsbasjes) + AVRO-1807: Java/JSON: Throw for unsupported objects rather than ignoring. (blue) + BUG FIXES AVRO-1493. Java: Avoid the "Turkish Locale Problem". Schema fingerprints are diff --git a/lang/java/avro/src/main/java/org/apache/avro/util/internal/JacksonUtils.java b/lang/java/avro/src/main/java/org/apache/avro/util/internal/JacksonUtils.java index 8d5661bdd32..ca98e4c540d 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/util/internal/JacksonUtils.java +++ b/lang/java/avro/src/main/java/org/apache/avro/util/internal/JacksonUtils.java @@ -83,6 +83,8 @@ static void toJson(Object datum, JsonGenerator generator) throws IOException { generator.writeNumber((Integer) datum); } else if (datum instanceof Boolean) { // boolean generator.writeBoolean((Boolean) datum); + } else { + throw new AvroRuntimeException("Unknown datum class: " + datum.getClass()); } } From bb9b589e0ebd7aed7fa477b273881c42409969ac Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Thu, 28 May 2015 16:59:40 -0700 Subject: [PATCH 061/116] AVRO-1684: Add time types to the specific compiler. This adds a dependency on Joda time for both the compiler and the compiled classes. When generating Java classes, any conversion that is registered with the compiler's SpecificData instance will be used. Closes #86. --- .../avro/generic/GenericDatumWriter.java | 4 +- .../avro/specific/SpecificDatumReader.java | 24 + .../avro/specific/SpecificDatumWriter.java | 21 + .../avro/specific/SpecificRecordBase.java | 10 + .../specific/TestRecordWithLogicalTypes.java | 697 ++++++++++++++++++ .../TestRecordWithoutLogicalTypes.java | 503 +++++++++++++ .../specific/TestSpecificLogicalTypes.java | 210 ++++++ .../resources/record_with_logical_types.avsc | 45 ++ lang/java/compiler/pom.xml | 4 + .../compiler/specific/SpecificCompiler.java | 44 ++ .../org/apache/avro/compiler/idl/idl.jj | 10 + .../specific/templates/java/classic/record.vm | 20 + .../src/test/idl/input/mr_events.avdl | 6 +- .../compiler/src/test/idl/input/simple.avdl | 2 + .../src/test/idl/output/mr_events.avpr | 8 +- .../compiler/src/test/idl/output/simple.avpr | 10 +- .../specific/TestSpecificCompiler.java | 34 + .../logical_types_with_multiple_fields.avsc | 30 + lang/java/pom.xml | 1 - 19 files changed, 1672 insertions(+), 11 deletions(-) create mode 100644 lang/java/avro/src/test/java/org/apache/avro/specific/TestRecordWithLogicalTypes.java create mode 100644 lang/java/avro/src/test/java/org/apache/avro/specific/TestRecordWithoutLogicalTypes.java create mode 100644 lang/java/avro/src/test/java/org/apache/avro/specific/TestSpecificLogicalTypes.java create mode 100644 lang/java/avro/src/test/resources/record_with_logical_types.avsc create mode 100644 lang/java/compiler/src/test/resources/logical_types_with_multiple_fields.avsc diff --git a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java index 63fa025d0aa..e66726e6c63 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java +++ b/lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumWriter.java @@ -74,8 +74,8 @@ protected void write(Schema schema, Object datum, Encoder out) } } - private Object convert(Schema schema, LogicalType logicalType, - Conversion conversion, Object datum) { + protected Object convert(Schema schema, LogicalType logicalType, + Conversion conversion, Object datum) { if (conversion == null) { return datum; } diff --git a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumReader.java b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumReader.java index 870d16f548c..774ca094451 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumReader.java +++ b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumReader.java @@ -17,10 +17,13 @@ */ package org.apache.avro.specific; +import org.apache.avro.Conversion; import org.apache.avro.Schema; import org.apache.avro.AvroRuntimeException; import org.apache.avro.generic.GenericDatumReader; +import org.apache.avro.io.ResolvingDecoder; import org.apache.avro.util.ClassUtils; +import java.io.IOException; /** {@link org.apache.avro.io.DatumReader DatumReader} for generated Java classes. */ public class SpecificDatumReader extends GenericDatumReader { @@ -98,5 +101,26 @@ private Class getPropAsClass(Schema schema, String prop) { } } + @Override + protected void readField(Object r, Schema.Field f, Object oldDatum, + ResolvingDecoder in, Object state) + throws IOException { + if (r instanceof SpecificRecordBase) { + Conversion conversion = ((SpecificRecordBase) r).getConversion(f.pos()); + + Object datum; + if (conversion != null) { + datum = readWithConversion( + oldDatum, f.schema(), f.schema().getLogicalType(), conversion, in); + } else { + datum = readWithoutConversion(oldDatum, f.schema(), in); + } + + getData().setField(r, f.name(), f.pos(), datum); + + } else { + super.readField(r, f, oldDatum, in, state); + } + } } diff --git a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumWriter.java b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumWriter.java index 128b02e9237..7bee02a653c 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumWriter.java +++ b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificDatumWriter.java @@ -19,6 +19,8 @@ import java.io.IOException; +import org.apache.avro.Conversion; +import org.apache.avro.LogicalType; import org.apache.avro.Schema; import org.apache.avro.generic.GenericDatumWriter; import org.apache.avro.io.Encoder; @@ -69,5 +71,24 @@ && getSpecificData().isStringable(datum.getClass())) { writeString(datum, out); } + @Override + protected void writeField(Object datum, Schema.Field f, Encoder out, + Object state) throws IOException { + if (datum instanceof SpecificRecordBase) { + Conversion conversion = ((SpecificRecordBase) datum).getConversion(f.pos()); + Schema fieldSchema = f.schema(); + LogicalType logicalType = fieldSchema.getLogicalType(); + + Object value = getData().getField(datum, f.name(), f.pos()); + if (conversion != null && logicalType != null) { + value = convert(fieldSchema, logicalType, conversion, value); + } + + writeWithoutConversion(fieldSchema, value, out); + + } else { + super.writeField(datum, f, out, state); + } + } } diff --git a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBase.java b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBase.java index 77d0928cfbb..baedeb872f7 100644 --- a/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBase.java +++ b/lang/java/avro/src/main/java/org/apache/avro/specific/SpecificRecordBase.java @@ -22,6 +22,7 @@ import java.io.ObjectInput; import java.io.IOException; +import org.apache.avro.Conversion; import org.apache.avro.Schema; import org.apache.avro.generic.GenericRecord; @@ -34,6 +35,11 @@ public abstract class SpecificRecordBase public abstract Object get(int field); public abstract void put(int field, Object value); + public Conversion getConversion(int field) { + // for backward-compatibility. no older specific classes have conversions. + return null; + } + @Override public void put(String fieldName, Object value) { put(getSchema().getField(fieldName).pos(), value); @@ -44,6 +50,10 @@ public Object get(String fieldName) { return get(getSchema().getField(fieldName).pos()); } + public Conversion getConverion(String fieldName) { + return getConversion(getSchema().getField(fieldName).pos()); + } + @Override public boolean equals(Object that) { if (that == this) return true; // identical object diff --git a/lang/java/avro/src/test/java/org/apache/avro/specific/TestRecordWithLogicalTypes.java b/lang/java/avro/src/test/java/org/apache/avro/specific/TestRecordWithLogicalTypes.java new file mode 100644 index 00000000000..a01e450e01e --- /dev/null +++ b/lang/java/avro/src/test/java/org/apache/avro/specific/TestRecordWithLogicalTypes.java @@ -0,0 +1,697 @@ +/** + * Autogenerated by Avro + * + * DO NOT EDIT DIRECTLY + */ +package org.apache.avro.specific; +@SuppressWarnings("all") +@org.apache.avro.specific.AvroGenerated +public class TestRecordWithLogicalTypes extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { + private static final long serialVersionUID = -4211233492739285532L; + public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"TestRecordWithLogicalTypes\",\"namespace\":\"org.apache.avro.specific\",\"fields\":[{\"name\":\"b\",\"type\":\"boolean\"},{\"name\":\"i32\",\"type\":\"int\"},{\"name\":\"i64\",\"type\":\"long\"},{\"name\":\"f32\",\"type\":\"float\"},{\"name\":\"f64\",\"type\":\"double\"},{\"name\":\"s\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"d\",\"type\":{\"type\":\"int\",\"logicalType\":\"date\"}},{\"name\":\"t\",\"type\":{\"type\":\"int\",\"logicalType\":\"time-millis\"}},{\"name\":\"ts\",\"type\":{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}}]}"); + public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } + @Deprecated public boolean b; + @Deprecated public int i32; + @Deprecated public long i64; + @Deprecated public float f32; + @Deprecated public double f64; + @Deprecated public java.lang.CharSequence s; + @Deprecated public org.joda.time.LocalDate d; + @Deprecated public org.joda.time.LocalTime t; + @Deprecated public org.joda.time.DateTime ts; + + /** + * Default constructor. Note that this does not initialize fields + * to their default values from the schema. If that is desired then + * one should use newBuilder(). + */ + public TestRecordWithLogicalTypes() {} + + /** + * All-args constructor. + */ + public TestRecordWithLogicalTypes(java.lang.Boolean b, java.lang.Integer i32, java.lang.Long i64, java.lang.Float f32, java.lang.Double f64, java.lang.CharSequence s, org.joda.time.LocalDate d, org.joda.time.LocalTime t, org.joda.time.DateTime ts) { + this.b = b; + this.i32 = i32; + this.i64 = i64; + this.f32 = f32; + this.f64 = f64; + this.s = s; + this.d = d; + this.t = t; + this.ts = ts; + } + + public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. + public java.lang.Object get(int field$) { + switch (field$) { + case 0: return b; + case 1: return i32; + case 2: return i64; + case 3: return f32; + case 4: return f64; + case 5: return s; + case 6: return d; + case 7: return t; + case 8: return ts; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value="unchecked") + public void put(int field$, java.lang.Object value$) { + switch (field$) { + case 0: b = (java.lang.Boolean)value$; break; + case 1: i32 = (java.lang.Integer)value$; break; + case 2: i64 = (java.lang.Long)value$; break; + case 3: f32 = (java.lang.Float)value$; break; + case 4: f64 = (java.lang.Double)value$; break; + case 5: s = (java.lang.CharSequence)value$; break; + case 6: d = (org.joda.time.LocalDate)value$; break; + case 7: t = (org.joda.time.LocalTime)value$; break; + case 8: ts = (org.joda.time.DateTime)value$; break; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } + + /** + * Gets the value of the 'b' field. + */ + public java.lang.Boolean getB() { + return b; + } + + /** + * Sets the value of the 'b' field. + * @param value the value to set. + */ + public void setB(java.lang.Boolean value) { + this.b = value; + } + + /** + * Gets the value of the 'i32' field. + */ + public java.lang.Integer getI32() { + return i32; + } + + /** + * Sets the value of the 'i32' field. + * @param value the value to set. + */ + public void setI32(java.lang.Integer value) { + this.i32 = value; + } + + /** + * Gets the value of the 'i64' field. + */ + public java.lang.Long getI64() { + return i64; + } + + /** + * Sets the value of the 'i64' field. + * @param value the value to set. + */ + public void setI64(java.lang.Long value) { + this.i64 = value; + } + + /** + * Gets the value of the 'f32' field. + */ + public java.lang.Float getF32() { + return f32; + } + + /** + * Sets the value of the 'f32' field. + * @param value the value to set. + */ + public void setF32(java.lang.Float value) { + this.f32 = value; + } + + /** + * Gets the value of the 'f64' field. + */ + public java.lang.Double getF64() { + return f64; + } + + /** + * Sets the value of the 'f64' field. + * @param value the value to set. + */ + public void setF64(java.lang.Double value) { + this.f64 = value; + } + + /** + * Gets the value of the 's' field. + */ + public java.lang.CharSequence getS() { + return s; + } + + /** + * Sets the value of the 's' field. + * @param value the value to set. + */ + public void setS(java.lang.CharSequence value) { + this.s = value; + } + + /** + * Gets the value of the 'd' field. + */ + public org.joda.time.LocalDate getD() { + return d; + } + + /** + * Sets the value of the 'd' field. + * @param value the value to set. + */ + public void setD(org.joda.time.LocalDate value) { + this.d = value; + } + + /** + * Gets the value of the 't' field. + */ + public org.joda.time.LocalTime getT() { + return t; + } + + /** + * Sets the value of the 't' field. + * @param value the value to set. + */ + public void setT(org.joda.time.LocalTime value) { + this.t = value; + } + + /** + * Gets the value of the 'ts' field. + */ + public org.joda.time.DateTime getTs() { + return ts; + } + + /** + * Sets the value of the 'ts' field. + * @param value the value to set. + */ + public void setTs(org.joda.time.DateTime value) { + this.ts = value; + } + + protected static final org.apache.avro.data.TimeConversions.DateConversion DATE_CONVERSION = new org.apache.avro.data.TimeConversions.DateConversion(); + protected static final org.apache.avro.data.TimeConversions.TimeConversion TIME_CONVERSION = new org.apache.avro.data.TimeConversions.TimeConversion(); + protected static final org.apache.avro.data.TimeConversions.TimestampConversion TIMESTAMP_CONVERSION = new org.apache.avro.data.TimeConversions.TimestampConversion(); + + private final org.apache.avro.Conversion[] conversions = + new org.apache.avro.Conversion[] { + null, + null, + null, + null, + null, + null, + DATE_CONVERSION, + TIME_CONVERSION, + TIMESTAMP_CONVERSION, + null + }; + + @Override + public org.apache.avro.Conversion getConversion(int field) { + return conversions[field]; + } + + /** Creates a new TestRecordWithLogicalTypes RecordBuilder */ + public static TestRecordWithLogicalTypes.Builder newBuilder() { + return new TestRecordWithLogicalTypes.Builder(); + } + + /** Creates a new TestRecordWithLogicalTypes RecordBuilder by copying an existing Builder */ + public static TestRecordWithLogicalTypes.Builder newBuilder(TestRecordWithLogicalTypes.Builder other) { + return new TestRecordWithLogicalTypes.Builder(other); + } + + /** Creates a new TestRecordWithLogicalTypes RecordBuilder by copying an existing TestRecordWithLogicalTypes instance */ + public static TestRecordWithLogicalTypes.Builder newBuilder(TestRecordWithLogicalTypes other) { + return new TestRecordWithLogicalTypes.Builder(other); + } + + /** + * RecordBuilder for TestRecordWithLogicalTypes instances. + */ + public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase + implements org.apache.avro.data.RecordBuilder { + + private boolean b; + private int i32; + private long i64; + private float f32; + private double f64; + private java.lang.CharSequence s; + private org.joda.time.LocalDate d; + private org.joda.time.LocalTime t; + private org.joda.time.DateTime ts; + + /** Creates a new Builder */ + private Builder() { + super(TestRecordWithLogicalTypes.SCHEMA$); + } + + /** Creates a Builder by copying an existing Builder */ + private Builder(TestRecordWithLogicalTypes.Builder other) { + super(other); + if (isValidValue(fields()[0], other.b)) { + this.b = data().deepCopy(fields()[0].schema(), other.b); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.i32)) { + this.i32 = data().deepCopy(fields()[1].schema(), other.i32); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.i64)) { + this.i64 = data().deepCopy(fields()[2].schema(), other.i64); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.f32)) { + this.f32 = data().deepCopy(fields()[3].schema(), other.f32); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.f64)) { + this.f64 = data().deepCopy(fields()[4].schema(), other.f64); + fieldSetFlags()[4] = true; + } + if (isValidValue(fields()[5], other.s)) { + this.s = data().deepCopy(fields()[5].schema(), other.s); + fieldSetFlags()[5] = true; + } + if (isValidValue(fields()[6], other.d)) { + this.d = data().deepCopy(fields()[6].schema(), other.d); + fieldSetFlags()[6] = true; + } + if (isValidValue(fields()[7], other.t)) { + this.t = data().deepCopy(fields()[7].schema(), other.t); + fieldSetFlags()[7] = true; + } + if (isValidValue(fields()[8], other.ts)) { + this.ts = data().deepCopy(fields()[8].schema(), other.ts); + fieldSetFlags()[8] = true; + } + } + + /** Creates a Builder by copying an existing TestRecordWithLogicalTypes instance */ + private Builder(TestRecordWithLogicalTypes other) { + super(TestRecordWithLogicalTypes.SCHEMA$); + if (isValidValue(fields()[0], other.b)) { + this.b = data().deepCopy(fields()[0].schema(), other.b); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.i32)) { + this.i32 = data().deepCopy(fields()[1].schema(), other.i32); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.i64)) { + this.i64 = data().deepCopy(fields()[2].schema(), other.i64); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.f32)) { + this.f32 = data().deepCopy(fields()[3].schema(), other.f32); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.f64)) { + this.f64 = data().deepCopy(fields()[4].schema(), other.f64); + fieldSetFlags()[4] = true; + } + if (isValidValue(fields()[5], other.s)) { + this.s = data().deepCopy(fields()[5].schema(), other.s); + fieldSetFlags()[5] = true; + } + if (isValidValue(fields()[6], other.d)) { + this.d = data().deepCopy(fields()[6].schema(), other.d); + fieldSetFlags()[6] = true; + } + if (isValidValue(fields()[7], other.t)) { + this.t = data().deepCopy(fields()[7].schema(), other.t); + fieldSetFlags()[7] = true; + } + if (isValidValue(fields()[8], other.ts)) { + this.ts = data().deepCopy(fields()[8].schema(), other.ts); + fieldSetFlags()[8] = true; + } + } + + /** + * Gets the value of the 'b' field. + */ + public java.lang.Boolean getB() { + return b; + } + + /** + * Sets the value of the 'b' field. + * @param value the value to set. + */ + public TestRecordWithLogicalTypes.Builder setB(boolean value) { + validate(fields()[0], value); + this.b = value; + fieldSetFlags()[0] = true; + return this; + } + + /** + * Checks whether the 'b' field has been set. + */ + public boolean hasB() { + return fieldSetFlags()[0]; + } + + + /** + * Clears the value of the 'b' field. + */ + public TestRecordWithLogicalTypes.Builder clearB() { + fieldSetFlags()[0] = false; + return this; + } + + /** + * Gets the value of the 'i32' field. + */ + public java.lang.Integer getI32() { + return i32; + } + + /** + * Sets the value of the 'i32' field. + * @param value the value to set. + */ + public TestRecordWithLogicalTypes.Builder setI32(int value) { + validate(fields()[1], value); + this.i32 = value; + fieldSetFlags()[1] = true; + return this; + } + + /** + * Checks whether the 'i32' field has been set. + */ + public boolean hasI32() { + return fieldSetFlags()[1]; + } + + + /** + * Clears the value of the 'i32' field. + */ + public TestRecordWithLogicalTypes.Builder clearI32() { + fieldSetFlags()[1] = false; + return this; + } + + /** + * Gets the value of the 'i64' field. + */ + public java.lang.Long getI64() { + return i64; + } + + /** + * Sets the value of the 'i64' field. + * @param value the value to set. + */ + public TestRecordWithLogicalTypes.Builder setI64(long value) { + validate(fields()[2], value); + this.i64 = value; + fieldSetFlags()[2] = true; + return this; + } + + /** + * Checks whether the 'i64' field has been set. + */ + public boolean hasI64() { + return fieldSetFlags()[2]; + } + + + /** + * Clears the value of the 'i64' field. + */ + public TestRecordWithLogicalTypes.Builder clearI64() { + fieldSetFlags()[2] = false; + return this; + } + + /** + * Gets the value of the 'f32' field. + */ + public java.lang.Float getF32() { + return f32; + } + + /** + * Sets the value of the 'f32' field. + * @param value the value to set. + */ + public TestRecordWithLogicalTypes.Builder setF32(float value) { + validate(fields()[3], value); + this.f32 = value; + fieldSetFlags()[3] = true; + return this; + } + + /** + * Checks whether the 'f32' field has been set. + */ + public boolean hasF32() { + return fieldSetFlags()[3]; + } + + + /** + * Clears the value of the 'f32' field. + */ + public TestRecordWithLogicalTypes.Builder clearF32() { + fieldSetFlags()[3] = false; + return this; + } + + /** + * Gets the value of the 'f64' field. + */ + public java.lang.Double getF64() { + return f64; + } + + /** + * Sets the value of the 'f64' field. + * @param value the value to set. + */ + public TestRecordWithLogicalTypes.Builder setF64(double value) { + validate(fields()[4], value); + this.f64 = value; + fieldSetFlags()[4] = true; + return this; + } + + /** + * Checks whether the 'f64' field has been set. + */ + public boolean hasF64() { + return fieldSetFlags()[4]; + } + + + /** + * Clears the value of the 'f64' field. + */ + public TestRecordWithLogicalTypes.Builder clearF64() { + fieldSetFlags()[4] = false; + return this; + } + + /** + * Gets the value of the 's' field. + */ + public java.lang.CharSequence getS() { + return s; + } + + /** + * Sets the value of the 's' field. + * @param value the value to set. + */ + public TestRecordWithLogicalTypes.Builder setS(java.lang.CharSequence value) { + validate(fields()[5], value); + this.s = value; + fieldSetFlags()[5] = true; + return this; + } + + /** + * Checks whether the 's' field has been set. + */ + public boolean hasS() { + return fieldSetFlags()[5]; + } + + + /** + * Clears the value of the 's' field. + */ + public TestRecordWithLogicalTypes.Builder clearS() { + s = null; + fieldSetFlags()[5] = false; + return this; + } + + /** + * Gets the value of the 'd' field. + */ + public org.joda.time.LocalDate getD() { + return d; + } + + /** + * Sets the value of the 'd' field. + * @param value the value to set. + */ + public TestRecordWithLogicalTypes.Builder setD(org.joda.time.LocalDate value) { + validate(fields()[6], value); + this.d = value; + fieldSetFlags()[6] = true; + return this; + } + + /** + * Checks whether the 'd' field has been set. + */ + public boolean hasD() { + return fieldSetFlags()[6]; + } + + + /** + * Clears the value of the 'd' field. + */ + public TestRecordWithLogicalTypes.Builder clearD() { + fieldSetFlags()[6] = false; + return this; + } + + /** + * Gets the value of the 't' field. + */ + public org.joda.time.LocalTime getT() { + return t; + } + + /** + * Sets the value of the 't' field. + * @param value the value to set. + */ + public TestRecordWithLogicalTypes.Builder setT(org.joda.time.LocalTime value) { + validate(fields()[7], value); + this.t = value; + fieldSetFlags()[7] = true; + return this; + } + + /** + * Checks whether the 't' field has been set. + */ + public boolean hasT() { + return fieldSetFlags()[7]; + } + + + /** + * Clears the value of the 't' field. + */ + public TestRecordWithLogicalTypes.Builder clearT() { + fieldSetFlags()[7] = false; + return this; + } + + /** + * Gets the value of the 'ts' field. + */ + public org.joda.time.DateTime getTs() { + return ts; + } + + /** + * Sets the value of the 'ts' field. + * @param value the value to set. + */ + public TestRecordWithLogicalTypes.Builder setTs(org.joda.time.DateTime value) { + validate(fields()[8], value); + this.ts = value; + fieldSetFlags()[8] = true; + return this; + } + + /** + * Checks whether the 'ts' field has been set. + */ + public boolean hasTs() { + return fieldSetFlags()[8]; + } + + + /** + * Clears the value of the 'ts' field. + */ + public TestRecordWithLogicalTypes.Builder clearTs() { + fieldSetFlags()[8] = false; + return this; + } + + @Override + public TestRecordWithLogicalTypes build() { + try { + TestRecordWithLogicalTypes record = new TestRecordWithLogicalTypes(); + record.b = fieldSetFlags()[0] ? this.b : (java.lang.Boolean) defaultValue(fields()[0]); + record.i32 = fieldSetFlags()[1] ? this.i32 : (java.lang.Integer) defaultValue(fields()[1]); + record.i64 = fieldSetFlags()[2] ? this.i64 : (java.lang.Long) defaultValue(fields()[2]); + record.f32 = fieldSetFlags()[3] ? this.f32 : (java.lang.Float) defaultValue(fields()[3]); + record.f64 = fieldSetFlags()[4] ? this.f64 : (java.lang.Double) defaultValue(fields()[4]); + record.s = fieldSetFlags()[5] ? this.s : (java.lang.CharSequence) defaultValue(fields()[5]); + record.d = fieldSetFlags()[6] ? this.d : (org.joda.time.LocalDate) defaultValue(fields()[6]); + record.t = fieldSetFlags()[7] ? this.t : (org.joda.time.LocalTime) defaultValue(fields()[7]); + record.ts = fieldSetFlags()[8] ? this.ts : (org.joda.time.DateTime) defaultValue(fields()[8]); + return record; + } catch (Exception e) { + throw new org.apache.avro.AvroRuntimeException(e); + } + } + } + + private static final org.apache.avro.io.DatumWriter + WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$); + + @Override public void writeExternal(java.io.ObjectOutput out) + throws java.io.IOException { + WRITER$.write(this, org.apache.avro.specific.SpecificData.getEncoder(out)); + } + + private static final org.apache.avro.io.DatumReader + READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$); + + @Override public void readExternal(java.io.ObjectInput in) + throws java.io.IOException { + READER$.read(this, org.apache.avro.specific.SpecificData.getDecoder(in)); + } + +} diff --git a/lang/java/avro/src/test/java/org/apache/avro/specific/TestRecordWithoutLogicalTypes.java b/lang/java/avro/src/test/java/org/apache/avro/specific/TestRecordWithoutLogicalTypes.java new file mode 100644 index 00000000000..afe7d11747c --- /dev/null +++ b/lang/java/avro/src/test/java/org/apache/avro/specific/TestRecordWithoutLogicalTypes.java @@ -0,0 +1,503 @@ +/** + * Autogenerated by Avro + * + * DO NOT EDIT DIRECTLY + */ +package org.apache.avro.specific; +@SuppressWarnings("all") +@org.apache.avro.specific.AvroGenerated +public class TestRecordWithoutLogicalTypes extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { + public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"TestRecordWithoutLogicalTypes\",\"namespace\":\"org.apache.avro.specific\",\"fields\":[{\"name\":\"b\",\"type\":\"boolean\"},{\"name\":\"i32\",\"type\":\"int\"},{\"name\":\"i64\",\"type\":\"long\"},{\"name\":\"f32\",\"type\":\"float\"},{\"name\":\"f64\",\"type\":\"double\"},{\"name\":\"s\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"d\",\"type\":{\"type\":\"int\",\"logicalType\":\"date\"}},{\"name\":\"t\",\"type\":{\"type\":\"int\",\"logicalType\":\"time-millis\"}},{\"name\":\"ts\",\"type\":{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}}]}"); + public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } + private boolean b; + private int i32; + private long i64; + private float f32; + private double f64; + private java.lang.String s; + private int d; + private int t; + private long ts; + + /** + * Default constructor. Note that this does not initialize fields + * to their default values from the schema. If that is desired then + * one should use {@link \#newBuilder()}. + */ + public TestRecordWithoutLogicalTypes() {} + + /** + * All-args constructor. + */ + public TestRecordWithoutLogicalTypes(java.lang.Boolean b, java.lang.Integer i32, java.lang.Long i64, java.lang.Float f32, java.lang.Double f64, java.lang.String s, java.lang.Integer d, java.lang.Integer t, java.lang.Long ts) { + this.b = b; + this.i32 = i32; + this.i64 = i64; + this.f32 = f32; + this.f64 = f64; + this.s = s; + this.d = d; + this.t = t; + this.ts = ts; + } + + public org.apache.avro.Schema getSchema() { return SCHEMA$; } + // Used by DatumWriter. Applications should not call. + public java.lang.Object get(int field$) { + switch (field$) { + case 0: return b; + case 1: return i32; + case 2: return i64; + case 3: return f32; + case 4: return f64; + case 5: return s; + case 6: return d; + case 7: return t; + case 8: return ts; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } + // Used by DatumReader. Applications should not call. + @SuppressWarnings(value="unchecked") + public void put(int field$, java.lang.Object value$) { + switch (field$) { + case 0: b = (java.lang.Boolean)value$; break; + case 1: i32 = (java.lang.Integer)value$; break; + case 2: i64 = (java.lang.Long)value$; break; + case 3: f32 = (java.lang.Float)value$; break; + case 4: f64 = (java.lang.Double)value$; break; + case 5: s = (java.lang.String)value$; break; + case 6: d = (java.lang.Integer)value$; break; + case 7: t = (java.lang.Integer)value$; break; + case 8: ts = (java.lang.Long)value$; break; + default: throw new org.apache.avro.AvroRuntimeException("Bad index"); + } + } + + /** + * Gets the value of the 'b' field. + */ + public java.lang.Boolean getB() { + return b; + } + + + /** + * Gets the value of the 'i32' field. + */ + public java.lang.Integer getI32() { + return i32; + } + + + /** + * Gets the value of the 'i64' field. + */ + public java.lang.Long getI64() { + return i64; + } + + + /** + * Gets the value of the 'f32' field. + */ + public java.lang.Float getF32() { + return f32; + } + + + /** + * Gets the value of the 'f64' field. + */ + public java.lang.Double getF64() { + return f64; + } + + + /** + * Gets the value of the 's' field. + */ + public java.lang.String getS() { + return s; + } + + + /** + * Gets the value of the 'd' field. + */ + public java.lang.Integer getD() { + return d; + } + + + /** + * Gets the value of the 't' field. + */ + public java.lang.Integer getT() { + return t; + } + + + /** + * Gets the value of the 'ts' field. + */ + public java.lang.Long getTs() { + return ts; + } + + + /** Creates a new TestRecordWithoutLogicalTypes RecordBuilder */ + public static TestRecordWithoutLogicalTypes.Builder newBuilder() { + return new TestRecordWithoutLogicalTypes.Builder(); + } + + /** Creates a new TestRecordWithoutLogicalTypes RecordBuilder by copying an existing Builder */ + public static TestRecordWithoutLogicalTypes.Builder newBuilder(TestRecordWithoutLogicalTypes.Builder other) { + return new TestRecordWithoutLogicalTypes.Builder(other); + } + + /** Creates a new TestRecordWithoutLogicalTypes RecordBuilder by copying an existing TestRecordWithoutLogicalTypes instance */ + public static TestRecordWithoutLogicalTypes.Builder newBuilder(TestRecordWithoutLogicalTypes other) { + return new TestRecordWithoutLogicalTypes.Builder(other); + } + + /** + * RecordBuilder for TestRecordWithoutLogicalTypes instances. + */ + public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase + implements org.apache.avro.data.RecordBuilder { + + private boolean b; + private int i32; + private long i64; + private float f32; + private double f64; + private java.lang.String s; + private int d; + private int t; + private long ts; + + /** Creates a new Builder */ + private Builder() { + super(TestRecordWithoutLogicalTypes.SCHEMA$); + } + + /** Creates a Builder by copying an existing Builder */ + private Builder(TestRecordWithoutLogicalTypes.Builder other) { + super(other); + if (isValidValue(fields()[0], other.b)) { + this.b = data().deepCopy(fields()[0].schema(), other.b); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.i32)) { + this.i32 = data().deepCopy(fields()[1].schema(), other.i32); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.i64)) { + this.i64 = data().deepCopy(fields()[2].schema(), other.i64); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.f32)) { + this.f32 = data().deepCopy(fields()[3].schema(), other.f32); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.f64)) { + this.f64 = data().deepCopy(fields()[4].schema(), other.f64); + fieldSetFlags()[4] = true; + } + if (isValidValue(fields()[5], other.s)) { + this.s = data().deepCopy(fields()[5].schema(), other.s); + fieldSetFlags()[5] = true; + } + if (isValidValue(fields()[6], other.d)) { + this.d = data().deepCopy(fields()[6].schema(), other.d); + fieldSetFlags()[6] = true; + } + if (isValidValue(fields()[7], other.t)) { + this.t = data().deepCopy(fields()[7].schema(), other.t); + fieldSetFlags()[7] = true; + } + if (isValidValue(fields()[8], other.ts)) { + this.ts = data().deepCopy(fields()[8].schema(), other.ts); + fieldSetFlags()[8] = true; + } + } + + /** Creates a Builder by copying an existing TestRecordWithoutLogicalTypes instance */ + private Builder(TestRecordWithoutLogicalTypes other) { + super(TestRecordWithoutLogicalTypes.SCHEMA$); + if (isValidValue(fields()[0], other.b)) { + this.b = data().deepCopy(fields()[0].schema(), other.b); + fieldSetFlags()[0] = true; + } + if (isValidValue(fields()[1], other.i32)) { + this.i32 = data().deepCopy(fields()[1].schema(), other.i32); + fieldSetFlags()[1] = true; + } + if (isValidValue(fields()[2], other.i64)) { + this.i64 = data().deepCopy(fields()[2].schema(), other.i64); + fieldSetFlags()[2] = true; + } + if (isValidValue(fields()[3], other.f32)) { + this.f32 = data().deepCopy(fields()[3].schema(), other.f32); + fieldSetFlags()[3] = true; + } + if (isValidValue(fields()[4], other.f64)) { + this.f64 = data().deepCopy(fields()[4].schema(), other.f64); + fieldSetFlags()[4] = true; + } + if (isValidValue(fields()[5], other.s)) { + this.s = data().deepCopy(fields()[5].schema(), other.s); + fieldSetFlags()[5] = true; + } + if (isValidValue(fields()[6], other.d)) { + this.d = data().deepCopy(fields()[6].schema(), other.d); + fieldSetFlags()[6] = true; + } + if (isValidValue(fields()[7], other.t)) { + this.t = data().deepCopy(fields()[7].schema(), other.t); + fieldSetFlags()[7] = true; + } + if (isValidValue(fields()[8], other.ts)) { + this.ts = data().deepCopy(fields()[8].schema(), other.ts); + fieldSetFlags()[8] = true; + } + } + + /** Gets the value of the 'b' field */ + public java.lang.Boolean getB() { + return b; + } + + /** Sets the value of the 'b' field */ + public TestRecordWithoutLogicalTypes.Builder setB(boolean value) { + validate(fields()[0], value); + this.b = value; + fieldSetFlags()[0] = true; + return this; + } + + /** Checks whether the 'b' field has been set */ + public boolean hasB() { + return fieldSetFlags()[0]; + } + + /** Clears the value of the 'b' field */ + public TestRecordWithoutLogicalTypes.Builder clearB() { + fieldSetFlags()[0] = false; + return this; + } + + /** Gets the value of the 'i32' field */ + public java.lang.Integer getI32() { + return i32; + } + + /** Sets the value of the 'i32' field */ + public TestRecordWithoutLogicalTypes.Builder setI32(int value) { + validate(fields()[1], value); + this.i32 = value; + fieldSetFlags()[1] = true; + return this; + } + + /** Checks whether the 'i32' field has been set */ + public boolean hasI32() { + return fieldSetFlags()[1]; + } + + /** Clears the value of the 'i32' field */ + public TestRecordWithoutLogicalTypes.Builder clearI32() { + fieldSetFlags()[1] = false; + return this; + } + + /** Gets the value of the 'i64' field */ + public java.lang.Long getI64() { + return i64; + } + + /** Sets the value of the 'i64' field */ + public TestRecordWithoutLogicalTypes.Builder setI64(long value) { + validate(fields()[2], value); + this.i64 = value; + fieldSetFlags()[2] = true; + return this; + } + + /** Checks whether the 'i64' field has been set */ + public boolean hasI64() { + return fieldSetFlags()[2]; + } + + /** Clears the value of the 'i64' field */ + public TestRecordWithoutLogicalTypes.Builder clearI64() { + fieldSetFlags()[2] = false; + return this; + } + + /** Gets the value of the 'f32' field */ + public java.lang.Float getF32() { + return f32; + } + + /** Sets the value of the 'f32' field */ + public TestRecordWithoutLogicalTypes.Builder setF32(float value) { + validate(fields()[3], value); + this.f32 = value; + fieldSetFlags()[3] = true; + return this; + } + + /** Checks whether the 'f32' field has been set */ + public boolean hasF32() { + return fieldSetFlags()[3]; + } + + /** Clears the value of the 'f32' field */ + public TestRecordWithoutLogicalTypes.Builder clearF32() { + fieldSetFlags()[3] = false; + return this; + } + + /** Gets the value of the 'f64' field */ + public java.lang.Double getF64() { + return f64; + } + + /** Sets the value of the 'f64' field */ + public TestRecordWithoutLogicalTypes.Builder setF64(double value) { + validate(fields()[4], value); + this.f64 = value; + fieldSetFlags()[4] = true; + return this; + } + + /** Checks whether the 'f64' field has been set */ + public boolean hasF64() { + return fieldSetFlags()[4]; + } + + /** Clears the value of the 'f64' field */ + public TestRecordWithoutLogicalTypes.Builder clearF64() { + fieldSetFlags()[4] = false; + return this; + } + + /** Gets the value of the 's' field */ + public java.lang.String getS() { + return s; + } + + /** Sets the value of the 's' field */ + public TestRecordWithoutLogicalTypes.Builder setS(java.lang.String value) { + validate(fields()[5], value); + this.s = value; + fieldSetFlags()[5] = true; + return this; + } + + /** Checks whether the 's' field has been set */ + public boolean hasS() { + return fieldSetFlags()[5]; + } + + /** Clears the value of the 's' field */ + public TestRecordWithoutLogicalTypes.Builder clearS() { + s = null; + fieldSetFlags()[5] = false; + return this; + } + + /** Gets the value of the 'd' field */ + public java.lang.Integer getD() { + return d; + } + + /** Sets the value of the 'd' field */ + public TestRecordWithoutLogicalTypes.Builder setD(int value) { + validate(fields()[6], value); + this.d = value; + fieldSetFlags()[6] = true; + return this; + } + + /** Checks whether the 'd' field has been set */ + public boolean hasD() { + return fieldSetFlags()[6]; + } + + /** Clears the value of the 'd' field */ + public TestRecordWithoutLogicalTypes.Builder clearD() { + fieldSetFlags()[6] = false; + return this; + } + + /** Gets the value of the 't' field */ + public java.lang.Integer getT() { + return t; + } + + /** Sets the value of the 't' field */ + public TestRecordWithoutLogicalTypes.Builder setT(int value) { + validate(fields()[7], value); + this.t = value; + fieldSetFlags()[7] = true; + return this; + } + + /** Checks whether the 't' field has been set */ + public boolean hasT() { + return fieldSetFlags()[7]; + } + + /** Clears the value of the 't' field */ + public TestRecordWithoutLogicalTypes.Builder clearT() { + fieldSetFlags()[7] = false; + return this; + } + + /** Gets the value of the 'ts' field */ + public java.lang.Long getTs() { + return ts; + } + + /** Sets the value of the 'ts' field */ + public TestRecordWithoutLogicalTypes.Builder setTs(long value) { + validate(fields()[8], value); + this.ts = value; + fieldSetFlags()[8] = true; + return this; + } + + /** Checks whether the 'ts' field has been set */ + public boolean hasTs() { + return fieldSetFlags()[8]; + } + + /** Clears the value of the 'ts' field */ + public TestRecordWithoutLogicalTypes.Builder clearTs() { + fieldSetFlags()[8] = false; + return this; + } + + @Override + public TestRecordWithoutLogicalTypes build() { + try { + TestRecordWithoutLogicalTypes record = new TestRecordWithoutLogicalTypes(); + record.b = fieldSetFlags()[0] ? this.b : (java.lang.Boolean) defaultValue(fields()[0]); + record.i32 = fieldSetFlags()[1] ? this.i32 : (java.lang.Integer) defaultValue(fields()[1]); + record.i64 = fieldSetFlags()[2] ? this.i64 : (java.lang.Long) defaultValue(fields()[2]); + record.f32 = fieldSetFlags()[3] ? this.f32 : (java.lang.Float) defaultValue(fields()[3]); + record.f64 = fieldSetFlags()[4] ? this.f64 : (java.lang.Double) defaultValue(fields()[4]); + record.s = fieldSetFlags()[5] ? this.s : (java.lang.String) defaultValue(fields()[5]); + record.d = fieldSetFlags()[6] ? this.d : (java.lang.Integer) defaultValue(fields()[6]); + record.t = fieldSetFlags()[7] ? this.t : (java.lang.Integer) defaultValue(fields()[7]); + record.ts = fieldSetFlags()[8] ? this.ts : (java.lang.Long) defaultValue(fields()[8]); + return record; + } catch (Exception e) { + throw new org.apache.avro.AvroRuntimeException(e); + } + } + } +} diff --git a/lang/java/avro/src/test/java/org/apache/avro/specific/TestSpecificLogicalTypes.java b/lang/java/avro/src/test/java/org/apache/avro/specific/TestSpecificLogicalTypes.java new file mode 100644 index 00000000000..c545c5a0045 --- /dev/null +++ b/lang/java/avro/src/test/java/org/apache/avro/specific/TestSpecificLogicalTypes.java @@ -0,0 +1,210 @@ +package org.apache.avro.specific; + +import org.apache.avro.Schema; +import org.apache.avro.data.TimeConversions.DateConversion; +import org.apache.avro.data.TimeConversions.TimeConversion; +import org.apache.avro.data.TimeConversions.TimestampConversion; +import org.apache.avro.file.DataFileReader; +import org.apache.avro.file.DataFileWriter; +import org.apache.avro.file.FileReader; +import org.apache.avro.io.DatumReader; +import org.apache.avro.io.DatumWriter; +import org.joda.time.DateTime; +import org.joda.time.DateTimeZone; +import org.joda.time.LocalDate; +import org.joda.time.LocalTime; +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/** + * This tests compatibility between classes generated before and after + * AVRO-1684. TestRecordWithoutLogicalTypes and TestRecordWithLogicalTypes were + * generated from the same schema, found in + * src/test/resources/record_with_logical_types.avsc, and + * TestRecordWithoutLogicalTypes was renamed to avoid the conflict. + * + * The classes should not be re-generated because they test compatibility of + * Avro with existing Avro-generated sources. When using classes generated + * before AVRO-1684, logical types should not be applied by the read or write + * paths. Those files should behave as they did before. + */ +public class TestSpecificLogicalTypes { + + @Rule + public final TemporaryFolder temp = new TemporaryFolder(); + + @Test + public void testRecordWithLogicalTypes() throws IOException { + TestRecordWithLogicalTypes record = new TestRecordWithLogicalTypes( + true, + 34, + 35L, + 3.14F, + 3019.34, + null, + LocalDate.now(), + LocalTime.now(), + DateTime.now().withZone(DateTimeZone.UTC) + ); + + File data = write(TestRecordWithLogicalTypes.getClassSchema(), record); + List actual = read( + TestRecordWithLogicalTypes.getClassSchema(), data); + + Assert.assertEquals("Should match written record", record, actual.get(0)); + } + + @Test + public void testRecordWithoutLogicalTypes() throws IOException { + // the significance of the record without logical types is that it has the + // same schema (besides record name) as the one with logical types, + // including the type annotations. this verifies that the type annotations + // are only applied if the record was compiled to use those types. this + // ensures compatibility with already-compiled code. + + TestRecordWithoutLogicalTypes record = new TestRecordWithoutLogicalTypes( + true, + 34, + 35L, + 3.14F, + 3019.34, + null, + new DateConversion().toInt(LocalDate.now(), null, null), + new TimeConversion().toInt(LocalTime.now(), null, null), + new TimestampConversion().toLong( + DateTime.now().withZone(DateTimeZone.UTC), null, null) + ); + + File data = write(TestRecordWithoutLogicalTypes.getClassSchema(), record); + List actual = read( + TestRecordWithoutLogicalTypes.getClassSchema(), data); + + Assert.assertEquals("Should match written record", record, actual.get(0)); + } + + @Test + public void testRecordWritePrimitivesReadLogicalTypes() throws IOException { + LocalDate date = LocalDate.now(); + LocalTime time = LocalTime.now(); + DateTime timestamp = DateTime.now().withZone(DateTimeZone.UTC); + + TestRecordWithoutLogicalTypes record = new TestRecordWithoutLogicalTypes( + true, + 34, + 35L, + 3.14F, + 3019.34, + null, + new DateConversion().toInt(date, null, null), + new TimeConversion().toInt(time, null, null), + new TimestampConversion().toLong(timestamp, null, null) + ); + + File data = write(TestRecordWithoutLogicalTypes.getClassSchema(), record); + // read using the schema with logical types + List actual = read( + TestRecordWithLogicalTypes.getClassSchema(), data); + + TestRecordWithLogicalTypes expected = new TestRecordWithLogicalTypes( + true, + 34, + 35L, + 3.14F, + 3019.34, + null, + date, + time, + timestamp + ); + + Assert.assertEquals("Should match written record", expected, actual.get(0)); + } + + @Test + public void testRecordWriteLogicalTypesReadPrimitives() throws IOException { + LocalDate date = LocalDate.now(); + LocalTime time = LocalTime.now(); + DateTime timestamp = DateTime.now().withZone(DateTimeZone.UTC); + + TestRecordWithLogicalTypes record = new TestRecordWithLogicalTypes( + true, + 34, + 35L, + 3.14F, + 3019.34, + null, + date, + time, + timestamp + ); + + File data = write(TestRecordWithLogicalTypes.getClassSchema(), record); + // read using the schema with logical types + List actual = read( + TestRecordWithoutLogicalTypes.getClassSchema(), data); + + TestRecordWithoutLogicalTypes expected = new TestRecordWithoutLogicalTypes( + true, + 34, + 35L, + 3.14F, + 3019.34, + null, + new DateConversion().toInt(date, null, null), + new TimeConversion().toInt(time, null, null), + new TimestampConversion().toLong(timestamp, null, null) + ); + + Assert.assertEquals("Should match written record", expected, actual.get(0)); + } + + private List read(Schema schema, File file) + throws IOException { + DatumReader reader = newReader(schema); + List data = new ArrayList(); + FileReader fileReader = null; + + try { + fileReader = new DataFileReader(file, reader); + for (D datum : fileReader) { + data.add(datum); + } + } finally { + if (fileReader != null) { + fileReader.close(); + } + } + + return data; + } + + @SuppressWarnings("unchecked") + private DatumReader newReader(Schema schema) { + return SpecificData.get().createDatumReader(schema); + } + + @SuppressWarnings("unchecked") + private File write(Schema schema, D... data) + throws IOException { + File file = temp.newFile(); + DatumWriter writer = SpecificData.get().createDatumWriter(schema); + DataFileWriter fileWriter = new DataFileWriter(writer); + + try { + fileWriter.create(schema, file); + for (D datum : data) { + fileWriter.append(datum); + } + } finally { + fileWriter.close(); + } + + return file; + } +} diff --git a/lang/java/avro/src/test/resources/record_with_logical_types.avsc b/lang/java/avro/src/test/resources/record_with_logical_types.avsc new file mode 100644 index 00000000000..9932f95056f --- /dev/null +++ b/lang/java/avro/src/test/resources/record_with_logical_types.avsc @@ -0,0 +1,45 @@ +{ + "type" : "record", + "name" : "TestRecordWithLogicalTypes", + "doc" : "Schema for TestRecordWithLogicalTypes and TestRecordWithoutLogicalTypes, see TestSpecificLogicalTypes" + "namespace" : "org.apache.avro.specific", + "fields" : [ { + "name" : "b", + "type" : "boolean" + }, { + "name" : "i32", + "type" : "int" + }, { + "name" : "i64", + "type" : "long" + }, { + "name" : "f32", + "type" : "float" + }, { + "name" : "f64", + "type" : "double" + }, { + "name" : "s", + "type" : [ "null", "string" ], + "default" : null + }, { + "name" : "d", + "type" : { + "type" : "int", + "logicalType" : "date" + } + }, { + "name" : "t", + "type" : { + "type" : "int", + "logicalType" : "time-millis" + } + }, { + "name" : "ts", + "type" : { + "type" : "long", + "logicalType" : "timestamp-millis" + } + } ] +} + diff --git a/lang/java/compiler/pom.xml b/lang/java/compiler/pom.xml index d49e4f15c1d..919e367c388 100644 --- a/lang/java/compiler/pom.xml +++ b/lang/java/compiler/pom.xml @@ -129,6 +129,10 @@ provided + + joda-time + joda-time + diff --git a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java index 823a2ef298d..6bf7bd567e3 100644 --- a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java +++ b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java @@ -34,6 +34,11 @@ import java.util.Map; import java.util.Set; +import org.apache.avro.Conversion; +import org.apache.avro.LogicalTypes; +import org.apache.avro.data.TimeConversions.DateConversion; +import org.apache.avro.data.TimeConversions.TimeConversion; +import org.apache.avro.data.TimeConversions.TimestampConversion; import org.apache.avro.specific.SpecificData; import org.codehaus.jackson.JsonNode; @@ -86,6 +91,13 @@ public static enum FieldVisibility { PUBLIC, PUBLIC_DEPRECATED, PRIVATE } + private static final SpecificData SPECIFIC = new SpecificData(); + static { + SPECIFIC.addLogicalTypeConversion(new DateConversion()); + SPECIFIC.addLogicalTypeConversion(new TimeConversion()); + SPECIFIC.addLogicalTypeConversion(new TimestampConversion()); + } + private final Set queue = new HashSet(); private Protocol protocol; private VelocityEngine velocityEngine; @@ -552,6 +564,12 @@ private String getStringType(JsonNode overrideClassProperty) { /** Utility for template use. Returns the java type for a Schema. */ public String javaType(Schema schema) { + Conversion conversion = SPECIFIC + .getConversionFor(schema.getLogicalType()); + if (conversion != null) { + return conversion.getConvertedType().getName(); + } + switch (schema.getType()) { case RECORD: case ENUM: @@ -583,6 +601,12 @@ public String javaType(Schema schema) { /** Utility for template use. Returns the unboxed java type for a Schema. */ public String javaUnbox(Schema schema) { + Conversion conversion = SPECIFIC + .getConversionFor(schema.getLogicalType()); + if (conversion != null) { + return conversion.getConvertedType().getName(); + } + switch (schema.getType()) { case INT: return "int"; case LONG: return "long"; @@ -593,6 +617,26 @@ public String javaUnbox(Schema schema) { } } + public boolean hasLogicalTypeField(Schema schema) { + for (Schema.Field field : schema.getFields()) { + if (field.schema().getLogicalType() != null) { + return true; + } + } + return false; + } + + public String conversionInstance(Schema schema) { + if (LogicalTypes.date().equals(schema.getLogicalType())) { + return "DATE_CONVERSION"; + } else if (LogicalTypes.timeMillis().equals(schema.getLogicalType())) { + return "TIME_CONVERSION"; + } else if (LogicalTypes.timestampMillis().equals(schema.getLogicalType())) { + return "TIMESTAMP_CONVERSION"; + } + return "null"; + } + /** Utility for template use. Returns the java annotations for a schema. */ public String[] javaAnnotations(JsonProperties props) { JsonNode value = props.getJsonProp("javaAnnotation"); diff --git a/lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj b/lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj index 8f60b83b90b..775a8cb27c5 100644 --- a/lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj +++ b/lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj @@ -69,6 +69,7 @@ import java.util.Map; import java.net.URL; import org.apache.avro.Schema; +import org.apache.avro.LogicalTypes; import org.apache.avro.Schema.*; import org.apache.avro.Protocol; import org.apache.avro.Protocol.*; @@ -236,6 +237,9 @@ TOKEN : | < TRUE: "true" > | < UNION: "union" > | < VOID: "void" > +| < DATE: "date" > +| < TIME: "time_ms" > +| < TIMESTAMP: "timestamp_ms" > } /* LITERALS */ @@ -1481,6 +1485,9 @@ Schema PrimitiveType(): | "double" { return Schema.create(Type.DOUBLE); } | "long" { return Schema.create(Type.LONG); } | "null" { return Schema.create(Type.NULL); } +| "date" { return LogicalTypes.date().addToSchema(Schema.create(Type.INT)); } +| "time_ms" { return LogicalTypes.timeMillis().addToSchema(Schema.create(Type.INT)); } +| "timestamp_ms" { return LogicalTypes.timestampMillis().addToSchema(Schema.create(Type.LONG)); } } /** @@ -1545,6 +1552,9 @@ Token AnyIdentifier(): t = | t = | t = | + t = | + t =

    21. * Avro type