aboutsummaryrefslogtreecommitdiffstats
path: root/ext/psych/extconf.rb
diff options
context:
space:
mode:
authortenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-28 04:34:41 +0000
committertenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-28 04:34:41 +0000
commit14099149f403f4cfbaa4cd673f04bf20cc3c5ac5 (patch)
treeff14c2027bb9d2ae751580452c8b266bc27fca65 /ext/psych/extconf.rb
parent694c77633c80a106a1e526870ad5076bfac30640 (diff)
downloadruby-14099149f403f4cfbaa4cd673f04bf20cc3c5ac5.tar.gz
* ext/psych/extconf.rb: use embedded libyaml if no system libyaml is
found. [ruby-core:49463] * ext/psych/lib/psych.rb: updating to psych 2.0.0 * ext/psych/lib/psych/deprecated.rb: updated docs * ext/psych/psych.gemspec: updated to psych 2.0.0 * ext/psych/psych.h: fixing header file include for rename * ext/psych/psych_emitter.c: renamed to avoid libyaml conflict. * ext/psych/psych_emitter.h: ditto * ext/psych/psych_parser.c: ditto * ext/psych/psych_parser.h: ditto * ext/psych/psych_to_ruby.c: ditto * ext/psych/psych_to_ruby.h: ditto * ext/psych/psych_yaml_tree.c: ditto * ext/psych/psych_yaml_tree.h: ditto * ext/psych/yaml/LICENSE: embedding libyaml 0.1.4 * ext/psych/yaml/api.c: ditto * ext/psych/yaml/config.h: ditto * ext/psych/yaml/dumper.c: ditto * ext/psych/yaml/emitter.c: ditto * ext/psych/yaml/loader.c: ditto * ext/psych/yaml/parser.c: ditto * ext/psych/yaml/reader.c: ditto * ext/psych/yaml/scanner.c: ditto * ext/psych/yaml/writer.c: ditto * ext/psych/yaml/yaml.h: ditto * ext/psych/yaml/yaml_private.h: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych/extconf.rb')
-rw-r--r--ext/psych/extconf.rb35
1 files changed, 30 insertions, 5 deletions
diff --git a/ext/psych/extconf.rb b/ext/psych/extconf.rb
index ccc8c9c304..b294aabcff 100644
--- a/ext/psych/extconf.rb
+++ b/ext/psych/extconf.rb
@@ -1,15 +1,40 @@
require 'mkmf'
+require 'fileutils'
# :stopdoc:
dir_config 'libyaml'
-def asplode missing
- raise "#{missing} is missing. Please install libyaml."
-end
+unless find_header('yaml.h') && find_library('yaml', 'yaml_get_version')
+ # Embed libyaml since we could not find it.
+
+ srcdir = File.expand_path File.dirname __FILE__
+ files = Dir.chdir File.join(srcdir, 'yaml') do
+ Dir.entries(Dir.pwd).find_all { |f|
+ File.file?(f) && File.extname(f) =~ /^\.[hc]/
+ }.map { |f| File.expand_path f }
+ end
+
+ FileUtils.cp_r files, srcdir
-asplode('yaml.h') unless find_header 'yaml.h'
-asplode('libyaml') unless find_library 'yaml', 'yaml_get_version'
+ if $mswin
+ $CFLAGS += " -DYAML_DECLARE_STATIC -DHAVE_CONFIG_H"
+ end
+
+ have_header 'dlfcn.h'
+ have_header 'inttypes.h'
+ have_header 'memory.h'
+ have_header 'stdint.h'
+ have_header 'stdlib.h'
+ have_header 'strings.h'
+ have_header 'string.h'
+ have_header 'sys/stat.h'
+ have_header 'sys/types.h'
+ have_header 'unistd.h'
+
+ find_header 'yaml.h'
+ have_header 'config.h'
+end
create_makefile 'psych'